Monday, 2 July 2018

Open new activity form with ‘Regarding’ field prefilled in Dynamic CRM

Open New Activity Form with Regarding and PartyList Field Prefilled

Description:

In this example we explain that how to open new activity form with “Regarding” field prefilled in Dynamic CRM using JavaScript. Or how to open Phone Call or Task Activity form with fill-up Regarding filed using JavaScript in Dynamic CRM.or open New Activity form with regarding and Party List field prefilled using JavaScript in Dynamic CRM.

So here we explain that how to use Xrm.Utility. openEntityForm with Regarding field in Dynamic CRM using JavaScript.
Code:

function openNewPhoneCall() {
        var id = Xrm.Page.data.entity.getId(); //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);

    }


0 comments:

Post a Comment