Open New Activity Form with Regarding and PartyList Field Prefilled

Xrm.Utility.openEntityForm() is used to open a new entity form. But if you are required to open the form with some fields prefilled you can pass it as parameters.

In this post you will learn how to open a phonecall activity form using openEntityForm with “Regarding” and “Call To” fields prefilled by passing as parameters.

In snippet below we are passing pId, pType, pName to set “Regarding” and partyid, partyname, partytype to set “Call To”.

// JavaScript custom method
function openNewPhoneCall() {
var id =; //Regarding record id
var ObjectTypeCode = Xrm.Page.context.getQueryStringParameters().etc; //Regarding record TypeCode
var name = Xrm.Page.getAttribute("name").getValue(); //Regarding record Name
var pratytypeCode = ObjectTypeCode;
var partname = name;
var partid = id;

var windowOptions = {
openInNewWindow: true
var parameters = {};
parameters['pId'] = id;
parameters['pType'] = ObjectTypeCode;
parameters['pName'] = name;
parameters['partyid'] = partid;
parameters['partyname'] = partname;
parameters['partytype'] = pratytypeCode;
Xrm.Utility.openEntityForm("phonecall", null, parameters, windowOptions);

Feel free to ask if you have any issues in following this post in the comments below.