Reputation: 9633
I fetch the Guid of Record using below code in Silverlight Application in CRM.
dynamic xrmnew = (ScriptObject)HtmlPage.Window.GetProperty("Xrm");
Guid Id1 = new Guid(xrmnew.Page.data.entity.getId());
textBox2.Text = Id1.ToString();
Thats fine i got the Guid of Record from Silverlight Application using above code.But if i deploy this Silverlight Page in HTML Page and then try to get Guid of Record using above code then it doesnt able to fetch the Guid.
Upvotes: 1
Views: 1298
Reputation: 9633
Finally after a lot of hard work i got the answer
dynamic xrmnew = (ScriptObject)HtmlPage.Window.GetProperty("Xrm");
if (xrmnew == null)
{
HtmlWindow parentWindow = HtmlPage.Window.GetProperty("parent") as HtmlWindow;
xrmnew = (ScriptObject)parentWindow.GetProperty("Xrm");
}
Guid Id = new Guid(xrmnew.Page.data.entity.getId());
Upvotes: 1