D365 CE Setting party list and lookup’s using Xrm.Utility.openEntityForm

Hello there,

Recently I was trying to set field values for partylist while launching a new record from parent record using Javascript on CRM 365, but it was erroring, then went to regular SDK blog

Setting Party list/Lookup via querystirng parameters on the form load, requires three parameters initial setup on the form properties of Target entity.

How do we set? eg: “if you want to open new campaignresponse form from Account record, set customer field(Party List) on the campaignresponse on lauch”. Simple go to the campaignresponse form customizations -> formproperties -> parameters tab then add below three parameters

1)ss_custId ->UniqueId -> Get accountId

2)ss_custName -> SafeString -> Get account name using Xrm.Page.getAttribute(“<logicalname of Name field>”).getValue()

3)ss_custType -> SafeString -> Get type of entity -><Logical name of Account entity>

Next, construct the parameters to pass on the openEntityForm function

var windowOptions = {
 openInNewWindow: true
};

PartyList

var parameters = {};
parameters["ss_custId "] = Xrm.Page.data.entity.getId();
parameters["ss_custName"] = "<name value of the account form>";
parameters["ss_custType"] = Xrm.Page.data.entity.getEntityName(); //account

 

Lookup

var parameters = {};
parameters["ss_custId "] = Xrm.Page.data.entity.getId();
parameters["ss_custName"] = "<name value of the account record>";
parameters["ss_custType"] = Xrm.Page.context.getQueryStringParameters().etc;

Xrm.Utility.openEntityForm(“campaignresponse”, null, parameters, windowOptions );

 

Thus a new form trigger from account form, launches a new campaignresponse with partylist customer autopopulate including custom lookup field.

Happy CRMing!

%d bloggers like this: