Search This Blog

Tuesday, December 2, 2014

How to get Display Status of Tab

Below code will return you the display status of tab.

var tabState = Xrm.Page.ui.tabs.get('economyandinformation_tab').getDisplayState();

It will return you the tab status in below format (expanded or collapsed)

Monday, December 1, 2014

Cloning Microsoft CRM Records

Hi Below is the way you can create a multiple copies of any record of any entity.
Let say I have 1 record of contact which I need to make close
// Parent Contact Record
Entity oldcontact = crmservice.Retrieve("contact", ContactId,new ColumnSet(true));

// Child Contact Record
Entity newcontact;

newcontact = oldcontact.Clone(true);

newcontact.Attributes.Remove("contactid"); // This is very important step in cloning as you have to avoid duplicate primary key error.

newcontact.Id = Guid.NewGuid(); // create new GUID for new record


And you will get a copy of parentcontact record into childcontact