How to retrieve the ID of a parent entity

I saw this topic several times in the Microsoft CRM Developer Community and I decided to share this line of code with you 🙂

Let’s take a simple example. We want to retrieve the Quote’s ID (guid) when we open the Quote Details form (pressing the New Quote Product on the Quote entity). All we have to do is add the following code on the OnLoad() Event of the child entity (Quote Detail in our case):

var MyOpenerID = opener.document.crmForm.ObjectId;
alert(MyOpenerID);

In the same way, we can also take other values (fields) from the parent entity. Feel free to test 😉

1 comment

Leave a comment

Your email address will not be published. Required fields are marked *