Milos Nikolic
Milos Nikolic

Reputation: 383

Call action using Process.js - CRM

I have made custom workflow activity, registered it with Plugin Registration Tool and now i want to execute it using Action. Action wont have input/output parameters. Unique name is ad_opportunity. It will be executed from Custom Entity ad_productsamplerequest

I will call this action from JavaScript using Process.js.

I am not familiar with Process.js, so I have a problem to make Action call.

Here is the call I made, but it doesn't work. Am I missing something here:

Process.callAction("ad_opportunity",
    [{
        key: "Target",
        type: Process.Type.EntityReference,
        value: { id: Xrm.Page.data.entity.getId(), entityType: "ad_productsamplerequest" }
    }],
    function (params) {
        //Success
    },
    function (e) {
        // Error
        alert(e);
    }
);

Upvotes: 1

Views: 3365

Answers (1)

Meet
Meet

Reputation: 159

Value mentioned in your code should be declared as EntityReference. Please refer below code for same

Process.callAction("mag_Retrieve",
    [{
        key: "Target",
        type: Process.Type.EntityReference,
        value: new Process.EntityReference("account", Xrm.Page.data.entity.getId())
    },
    {
        key: "ColumnSet",
        type: Process.Type.String,
        value: "name, statuscode"
    }],
    function (params) {
        // Success
    },
    function (e, t) {
        // Error
    });

Rest looks good

Upvotes: 1

Related Questions