Monthly Archives: April 2012

Get Parent Customer ID based on contact id

Requirement: Sometime we have requirement to get contact’s parent customer id.

Solution: We can use REST retrieve method where we can pass record ID and get details from entiy

function ParentCustomerID(ContactId) {

var context = Xrm.Page.context;
var serverUrl = context.getServerUrl(); //Update: in MS CRM 2013 or 2015 you need to use getClientUrl() instead of getServerUrl()
var ODataPath = serverUrl + “/XRMServices/2011/OrganizationData.svc”;
var retrieveParentCustomer= new XMLHttpRequest();
retrieveParentCustomer.open(“GET”, ODataPath + “/ContactSet(guid'” + ContactId+ “‘)”, false); //Change entity if required
retrieveParentCustomer.setRequestHeader(“Accept”, “application/json”);
retrieveParentCustomer.setRequestHeader(“Content-Type”, “application/json; charset=utf-8”);
retrieveParentCustomer.onreadystatechange = function() {
retrieveParentCustomerCallBack(this);
};
retrieveParentCustomer.send();

}
function retrieveParentCustomerCallBack(retrieveParentCustomer) {
if (retrieveParentCustomer.readyState == 4 /* complete */) {
if (retrieveParentCustomer.status == 200) {

var retrievedParent = this.parent.JSON.parse(retrieveParentCustomer.responseText).d;

alert(retrievedParent.ParentCustomerId.Id); //for id
alert(retrievedParent.ParentCustomerId.Name); //for name

}

}}

Enjoy !!!

Leave a comment

Filed under MS CRM 2011

Are you interested in your connection list ??

If you are a sales person and using MS CRM 2011, I am sure you will be interested in your connection lists, so that you can easily associated/disassociate yourself with MS CRM records like account contact.  So how can you see your connection through OOB way, you need to follow below steps:

  • Navigation Setting->Administration->Users->select your record and open it.
  • Navigate to Connection from left navigation items under common section.

You can see all of your connected record.

But what about getting list of your connection directly from left navigation from MS CRM home page that will be great right ? we can easily create link in left navigation are to show view in MS CRM 2011.

So what we need to get that list :

  • Need to create Custom view to display connected entity record with you.
  • Need to get GUID of that view.
  • Modify site map to add new sub area item.

Here is step by step instruction

Create a Custom View to Show connected records and get View ID

  • Create a new Solution and add connection entity in your solution.
  • Navigation to Views under connection entity and select New.
  • Enter “My Connection” under name field and click Ok.
  • Click on “Edit filter criteria” under common tasks.
  • Add filter criteria like below and click Ok.

 

  • Click on “Add columns” to add required colums (make sure to add Connected From field).
  • Press F11 to get view URL.
  • Copy View ID from last, like below

http://Server:port/organization/tools/vieweditor/viewManager.aspx?appSolutionId=%7b739D3A05-017B-E111-88DE-000C296BC8C9%7d&entityId=%7bC7866019-D3D1-40D7-B483-381FCDCCFFB2%7d&id=%7bD7A29797-EF8D-E111-8B09-000C296BC8C9%7d#

  •  Save and Close view.
  • Set this view as Default from more actions.

Now we have created a view and fetched it’s guid, so let’s modify our site map.

You can customize site map manually or customize using wonderful tool Sitemap Editor.

I have used sitemap editor here, first you need to connect to your organization using sitemap editor once you are connected Click on “Load SiteMap” button to load default sitemap from your CRM.

Let’s say we want to create sub area item under My work, follow below steps to create new sub area

  • Navigation to Site Map->Area(Workplace)->Group(MyWork).
  • Right click on Group(myWork) and select Add SubArea.

  • Enter below information

         Id : “MyConnection”

          Entity: Connection

          Icon: specify icon this subarea.

          Title : My Connection

          Description: To Show my connection.

          URL: _root/homepage.aspx?etn=connection&viewid=%7bC4EB2710-A6A1-4CFD-BC94-664416807432%7d&viewtype=1039  //make sure to replace viewid with the id that we created

  • Click on Save button to save configuration for subarea.
  • Click on “Update SiteMap” to update sitemap in MS CRM 2011.
  • Start MS CRM you should get your “My Coonection” subarea under MyWork.

 Enjoy !!!

1 Comment

Filed under MS CRM 2011, Sitemap, Step By Step MS CRM 2011

A managed solution cannot overwrite the SavedQuery component with Id=xxxx-xxx-xxx-xxx-xxxx.. Error

Are you getting below error when trying to import managed solution exported from your dev environment where Activity feed is configured.

A managed solution cannot overwrite the SavedQuery component with Id=xxxx-xxx-xxx-xxx-xxxx  which has an unmanaged base instance.The most likely scenario for this error is that an unmanaged solution has installed a new unmanaged SavedQuery component on the target system, and now a managed solution from the same publisher is trying to install that same SavedQuery component as managed. This will cause an invalid layering of solutions on the target system and is not allowed.

If yes, you need to remove Activity feed configuration from source system before exporting your solution. You need to follow below steps

  1. Open your Dev envornment.
  2. Navigate to Activity Feeds Configuration under Setting->System.
  3. Delete all configuration records except for user entity.
  4. Delete user entity record.

 Now you can export your solution, make sure to click on “Publish All Customization” during export step.

Once solution imported into production envirnment, you can configure activity feed again.

 Enjoy !!!

reference : http://blogs.msdn.com/b/crm/archive/2012/01/26/activity-feeds-solution-amp-development-environment.aspx

1 Comment

Filed under MS CRM 2011

MS CRM 2011 Technical Interview Question Part -1

I have seen many times, where CRM developers asking for common interview question in CRM development forums. I am writing this post to collect some common question on MS CRM technical side that can crm developers community

  • Explain some new features in  MS CRM 2011.
  • What are the different webservice available in MS CRM 2011.
  • Which service can be used to access metadata information.
  • What are the different ways to consume MS CRM webservice from client side?
  • Rest Vs Soap.
  • Difference between Dialog and Workflow.
  • What is Solution?
  • Difference between Managed and unmanaged solution.
  • Is it possible to register plugin through solution?
  • What is field level security?
  • How can we use auditing in MS CRM 2011.
  • What is the use of document location entity in MS CRM 2011.
  •  How can we create a custom Ribbon button.
  • How can we rename a custom Ribbon button.
  • How can we open a custom webpage from ribbon button.
  • How can we use Filtered views in MS CRM 2011.
  • What is Webresource and what the different types of webresource.
  • How can deploy a Silverlight webresource in MS CRM 2011.
  • What is the use of subgrids?
  • What are the basic steps involved in developing plugin.
  • What is the use of tracingService in plugin development.
  • What are the new messages introduced for plugins in MS CRM 2011?
  • What is sandbox plugin.
  • What are the different ways to create custom report for MS CRM 2011.
  • Difference between Early bound and late bound.

Enjoy !!

Please refer for answer : https://mahenderpal.wordpress.com/2012/06/26/ms-crm-2011-technical-interview-question-part-2/

https://mahenderpal.wordpress.com/2012/08/30/ms-crm-2011-technical-interview-answer-part-2/

 

 

12 Comments

Filed under MS CRM 2011

Getting Current User Date and Time Format setting using Javascript MS CRM 2011

If you are looking to get current user Date and Time format you can use below code for the same

function RetrieveUserSettingRecord() {

 var context;

 var serverUrl;

 var ODataPath;

context = Xrm.Page.context; //get context

 serverUrl = context.getServerUrl();

 ODataPath = serverUrl +“/XRMServices/2011/OrganizationData.svc”;

 var UserID = Xrm.Page.context.getUserId();  //get current user id from context

 var RetrieveUserSetting = new XMLHttpRequest();

RetrieveUserSetting.open(“GET”, ODataPath + “/UserSettingsSet(guid'” + UserID + “‘)”, true);

RetrieveUserSetting.setRequestHeader(“Accept”, “application/json”);

RetrieveUserSetting.setRequestHeader(“Content-Type”, “application/json; charset=utf-8”);

RetrieveUserSetting.onreadystatechange =function() {

RetrieveUserSettingCallBack(this);

};

 RetrieveUserSetting.send();

 }

 function RetrieveUserSettingCallBack(retrievedUserSetting) {

 if (retrievedUserSetting.readyState == 4 /* complete */) {

 if(retrievedUserSetting.status == 200) {

 var retrievedUser = this.parent.JSON.parse(retrievedUserSetting.responseText).d;

 if (retrievedUser.TimeFormatString != null)

alert(retrievedUser.TimeFormatString);

 if (retrievedUser.DateFormatString != null)

alert(retrievedUser.DateFormatString);

 }}

 }

 Enjoy !!

 

5 Comments

Filed under MS CRM 2011