Tuesday, 7 April 2015

Open a Pre-populated child Record in CRM using Javascript


In 1:N relationship,sometimes you need to opea a child record by pre filled value(from the mapping). The below script will be used to do it.

var parameters = {};
var childEntityName=”contact”;

//Provide parent record guid

parameters["_CreateFromId"] = "08A03761-0996-E311-BC31-00155D000807″;

//Provide parent record entity type code

parameters["_CreateFromType"] = "1″;

//provide child entity name and pass parameter to open new record

Xrm.Utility.openEntityForm(childEntityName, null, parameters);

Parameters:

• _CreateFromId: Pass parent entity record’s GUID

• _CreateFromType: Pass parent entity type code

• childEntityName: Child entity name which need to open with mapping field

With this above code, you can add a custom button to simulate the + button on the child subgrids.

No comments:

Post a Comment