Goals in Microsoft Dynamics CRM - owner and manager fields are different
Recently I have come across a fact, that fields Owner and Manager are different from the fields of the same names in other CRM entities.
What I mean?
Goal entity contains two lookup fields that are connected to the users or to the teams - these fields are called Goal Owner and Manager.
Goal Owner - goalownerid is a lookup, where user can fill in a team or system user. So this is the same behavior as an ownerid field in other user-owned entities.
Manager - ownerid is a lookup, where user can fill in only another user. So this behavior is different from regular ownerid field in other user-owned entities.
As you can see, eventhough there is an ownerid field on Goal entity, it is not normal Owner field. And same for the Goal owner field - it is not regular owner field.
I am not sure why Microsoft implemented this in such a way. This must have been some workaround or mistake during development.
However, let me explain what this means for further configuration.
We have tried to setup some goals which are assigned to the teams. So we set the Goal owner (goalownerid) to the specific team.
Manager is then some other user, who is controling the goals.
After the goals are properly set up, we wanted to created a new view where we want to display the goals of the team that the current user is member of.
For regular entities you can do this quite easily. Just go to the views, select filtering criteria and select
Equals Current User's Team.
Here is an example of such condition for Opportunities.
 |
Opportunity - Owner - Condition |
When we tried to do the same for goals, we realized, that we are not able to set such a condition, beacuse the CRM UI does not include it for
goalownerid field :-(
The system simply does not work with this field as an owner field, but it thinks it is regular lookup to user.
The condition for
Goal owner looks like this:
 |
Goals - Owner - Condition |
On the other hand, the field Manager (
ownerid), where you can insert only one single user has these conditions available:
 |
Goals - Manager - Condition |
This is really strange, isn't it?
So after some testing and trying, we realized, that the only way how to create the desired view is to modify the customization XML. To make it very simple, we have defined the filtering condition which we needed for the Goal Owner field for the Manager field instead (eventhough it does not make sense, because there cannot be a team in that field).
Then we exported the customizations and searched for the view in there.
It looks like this:
<savedquery>
<IsCustomizable>1</IsCustomizable>
<CanBeDeleted>1</CanBeDeleted>
<isquickfindquery>0</isquickfindquery>
<isprivate>0</isprivate>
<isdefault>0</isdefault>
<returnedtypecode>9600</returnedtypecode>
<savedqueryid>{02214737-f56f-e411-80ca-005056b52fe6}</savedqueryid>
<layoutxml>
<grid name="goals" object="9600" jump="title"
select="1" icon="1" preview="1">
<row name="goal" id="goalid">
<cell name="title" width="200" />
<cell name="targetstring" width="150" />
<cell name="percentage" width="150" />
<cell name="actualstring" disableSorting="1"
width="150" />
<cell name="inprogressstring" disableSorting="1"
width="150" />
<cell name="metricid" width="150" />
<cell name="parentgoalid" width="150" />
</row>
</grid>
</layoutxml>
<querytype>0</querytype>
<fetchxml>
<fetch version="1.0" output-format="xml-platform"
mapping="logical" distinct="false">
<entity
name="goal">
<attribute name="title" />
<attribute name="targetstring" />
<attribute name="percentage" />
<attribute name="actualstring" />
<attribute name="inprogressstring" />
<attribute name="metricid" />
<attribute name="parentgoalid" />
<order attribute="title" descending="false" />
<filter type="and">
<condition attribute="statecode" operator="eq"
value="0" />
<condition attribute="goalownerid" operator="eq-userid"
/>
<condition attribute="goalstartdate"
operator="this-fiscal-year" />
<condition attribute="goalenddate"
operator="this-fiscal-year" />
<condition attribute="ownerid"
operator="eq-userteams" />
</filter>
To get the desired condition we need to replace the row with this:
<condition attribute="goalownerid" operator="eq-userteams" />
Then save the customization file and import it back.
The view will show the correct results, but be carefull, never modify this view in CRM gui, or you will loose this modification.
In this post, I have screenshots from CRM 2015, but the same behavior is for CRM 2011 and 2013 as well.
I hope this helps.
Michal