Used Multiple Forms in CRM 2011


As we all know that we have new multiple forms feature in CRM 2011, which allows us to create multiple forms for an entity. Today for the first time I got an opportunity to implement it.

Our scenario was something like this :-

We wanted only specific users to Reactivate Case and they shouldn’t be able to modify any value on the case that they are Reactivating.

We started by first figuring out the minimum rights required to Reactivate the case and they were

  1. Create
  2. Write
  3. Append To

for the Case entity.

Obviously with Write access user will be able to modify the values for the case.

So we did the following

  1. Created a new custom security role having the above mentioned privileges.
  2. Created a new form for the Case Entity.
  3. Removed few of the sections/fields and set the remaining fields as Read Only (through form customization and not JavaScript) for the new form.
  4. Used Assign Security Roles to and selected the newly created security roles as Display only to these selected security roles option


  5. For the main Information form, we selected the same option Display only to these selected security roles and this time checked all other roles and unchecked the new security roles created.

So now when the user having the new security role opens the case form for Reactivating the Case, he only sees the newly created form which has all the fields set as read only.

This solved our purpose.

Hope it helps.

Reactivate Case in CRM 2011


Hi,

Below the minimum rights required to Reactivate a closed or resolved Case in CRM.

Sample code to do it through code


private void Form_Load(object sender, EventArgs e)
 {
 Uri organizationUri = new Uri("http://servername/orgname/XRMServices/2011/Organization.svc");
 Uri homeRealmUri = null;
 ClientCredentials credentials = new ClientCredentials();
 credentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials;
 OrganizationServiceProxy orgProxy = new OrganizationServiceProxy(organizationUri, homeRealmUri, credentials, null);
 IOrganizationService _service = (IOrganizationService)orgProxy;
 ReactivateState("incident", new Guid("caseGuid"), 0, -1, _service);
 }

public static void ReactivateState(string entityName, Guid entityGuid, int state, int status, IOrganizationService orgService)
 {
 try
 {
 SetStateRequest req = new SetStateRequest();
 req.EntityMoniker = new EntityReference(entityName, entityGuid);
 req.State = new OptionSetValue(state);
 req.Status = new OptionSetValue(status);
 orgService.Execute(req);
 }
 catch (Exception ex)
 {

 }
 }

Bye.

Things to consider while using getServerUrl() in CRM 2011


Hi,

We recently faced an issue after we configured our CRM 2011 site for SSL\HTTPS.

While using context.getServerUrl() method in our web resources we were getting the url value having http instead of https. And the other issue that we regularly faced was the Access Denied one if we access our CRM server either through localhost or through IP address.

These two wonderful posts talk about how to deal with these issues

http://social.microsoft.com/Forums/is/crmdeployment/thread/dc35f48d-f528-44ee-91b5-73b6c42e6217

http://myencounterwithcrm.wordpress.com/2011/05/24/crm-2011-alternative-to-context-getserverurl/

getServerUrl() method returns  the url according to the configured values in the Deployment Manager, not based on the url you have used to navigate to the page

and using

var customServerURL = document.location.protocol + “//” + document.location.host +“/” + Xrm.Page.context.getOrgUniqueName();

Update : It works for on premise scenario only

Check this most helpful post on how to get the server url

http://danielcai.blogspot.com/2012/02/get-right-server-url-in-your-crm-client.html

Hope it helps

Issues while setting value for the field in Header of the form in CRM 2011


Hi,

We recently had a requirement to show in header of one of the form, the value from its related entity. So we thought that we will create a new custom field, move it to the header and populate it’s value using JScript in the onload event.

However as we were writing the JScript we realized that the field that is in the header of the form is not accesible using Xrm.Page.data.entity.attribute.

So the next thought was to add that field in the body of the form as well.

http://community.dynamics.com/product/crm/crmtechnical/b/crmcustomereffective/archive/2011/08/22/crm-2011-ability-to-add-the-same-field-to-the-form-more-than-once-and-javascript-challenges.aspx

So now we had that field in header as well as in the body. Now when we were setting the value of the field that was in the body, it was getting set properly as expected. But that value was not getting reflected in the same field in the header till we save the form.

We finally used document.getElementById to set the value for the field in the header.

Hope it helps.

Useful tool for Exporting all the JavaScripts in CRM 2011


Hi,

I have been regularly using the following tool developed by Tanguy for exporting the JScript web resources. The tool is extremely intuitive and helpful. Just thought of sharing it.

http://mscrmtools.blogspot.com/2011/06/new-tool-javascript-web-resource.html

Bye.

Book Review : Pro Business Applications with Silverlight 4 by Chris Anderson


Pro Business Applications with Silverlight 4Pro Business Applications with Silverlight 4 by Chris Anderson
My rating: 5 of 5 stars

It is surely one of the best books on business application development with Silverlight.

It starts with basics of Silverlight and XAML.

Then it gradually covers the important topics like Navigation Framework, WCF RIA Services, MVVM, OOB Mode etc.

It covers almost every aspect of developing a business application.

I don’t think there is any other book that explains this topic in such great detail.

I will highly recommend this book.

View all my reviews

Nishant Rana's Weblog

Everything related to Microsoft .NET Technology

Skip to content ↓