Sunday, December 30, 2012

Displaying associated views for the relationships missing in relationship explorer.


In CRM2011 we have relationship explorer as shown in screen shot.
image
We can drag any available relationship from the relationship explorer to the form navigation. The navigation link will display the associated view for that relationship.

The problem is that the relationship explorer does not display all the relationships. For e.g.  system relationship between user and leads(to display all the leads owned by the user).
We can use the following URL to display any associated view.
http://servername/orgname/userdefined/areas.aspx?oId=<guid of the entity>&oType=<entity type code>&pagemode=iframe&security=852023&tabSet=<relationship shema name>

I got this URL from the existing associated views. There are few more parameters that can be passed to this URL like formid but they are optional.

Replace the highlighted values with the values from your deployment.
Here is an example of the URL with all the values. This URL will display the associated view of the leads owned by the user specified in the URL.
http://servername/orgname/userdefined/areas.aspx?oId=%7b734F5966-827C-E111-A07F-00155DDBE211%7d&oType=8&pagemode=iframe&security=852023&tabSet=lead_owning_user

I hope this helps.

Saturday, December 22, 2012

Strange behaviour when using security roles with the teams in CRM2011

I was trying to setup the security roles on teams instead of assigning security role to the individual users. The end result is that it does not work very well.

Here are the details of what happened.

I had a user with security role named “Manager”. Everything was working as expected. The user was able to create and update the entities defined in the security role. We decided to the create a team named “Manager” and assign the  role to the team. I added the user to the team and remove the security role from the user. Here is what happened after that

I was able to open , create and update the entities as defined in the security roles until we created a new for form for an existing entity.

When I tried to  open the newly created form for the entity, I received the following error message.

image

I had a look in the event viewer. It was showing the following warning message.

Exception message: SecLib::AccessCheckEx failed. Returned hr = -2147187962, ObjectID: 3be48aca-0f39-e211-bce1-005056b8253f, OwnerId: 9cc2541a-9137-e211-bce1-005056b8253f,  OwnerIdType: 8 and CallingUser: 9cc2541a-9137-e211-bce1-005056b8253f. ObjectTypeCode: 2500, objectBusinessUnitId: bf221f51-8537-e211-bce1-005056b8253f, AccessRights: WriteAccess

The object type code 2500 represents the entity “User Entity UI Settings”. I checked the permissions on the entity. The user had the required permissions on the entity. The most annoying part was that I was able to open the existing form without a problem.

So I decided to look a bit deeper into the problem and here are my findings.

1. I created a new user and add the user to the team without assigning any role to the user.

I received an error message “Access Is Denied” every time I tried to open any entity form.

2. I added the same security role to the user as security role assigned to the team.

I tried to open account and contact entity form and I was able to open them without an error.

3. I removed the security role from the user again

I was able to open the entity forms I tried in step 2 but, I was unable to open the form for any other entity or different  form for the same entity.

Conclusion:

You have to have a security role assigned to the user to open any entity form minimum for the first time.

Tuesday, December 11, 2012

CRM fields and "Duplicate Field Name” error

Every time you create an option set or a lookup field in CRM, the system creates 2 fields. For example if you create a lookup field named “new_contact”, the system will create the following 2 fields:

  • “new_contact”
  • “new_contactname” ( the second field will have “name” at the end)

The first field is created as expected. But the system creates the second field automatically. If you ever looked into the filtered views, you must have noticed the extra name columns for lookup and option set fields. If you open a FilteredAccount view, you will notice primarycontactid and primarycontactidname columns. The primarycontactid column contains the guid of the primary contact and primarycontactidname contains the actual name of the contact.

In case of optionset field, the first field contains the integer value of the optionset and second field contains the optionset text value.

The problem is that the CRM UI does not display the second field. You won’t find primaryconactidname in the field’s grid of account entity.

To verify this behaviour, I created a lookup field name “new_contact” and then I tried to create a new field “new_contactname”. I received the following error message.

image

If you receive the “Duplicate Field Name” error, the reason can be a existing lookup or optionset field as explained above.