Hi,
I have a functionality to trigger the plugin on button click, so for that, I have created a custom button, on button click I am calling Js and there in Js I am triggering the action. This action I have created for the opportunity entity with Input parameter(type of entity reference).
All are going good my plugin also getting triggered but not able to ready the Input parameter value, like I don't know the syntax to ready the entity reference parameter of an action inside the plugin.
My Action
My code
I am getting error here in yellow highlighted, line number 46.
Please suggest me the syntax to read this parameter value
My plugin code is working fine, now I have created the XMLHTTP api for that action and now, I am passing the string parameter instead of entity reference.
I have already attached the ss in above qtn.
Hi,
Try to execute your custom action from c# console app to confirm it works.
www.ashishvishwakarma.com/.../
If it works then we know there is something wrong in js code
I would request you to generate js code using Dataverse rest builder tool
Hi Himanshu,
Can you post your code you are trying to ?
Thanks
Object reference is not set to an instance of an object.
Hi,
What is the error you are getting??
Here I have attached my JS.
function callActionToReopenOpp(primaryControl){
var formContext = primaryControl;
var Id = formContext.data.entity.getId().replace('{', '').replace('}', '');
var target = {};
target.entityType = "opportunity";
target.id = Id;
var req = {};
req.entity = target;
req.InputParam = target;
req.getMetadata = function () {
return {
boundParameter: "entity",
parameterTypes: {
"entity": {
typeName: "mscrm.opportunity",
structuralProperty: 5
}
},
"InputParam": {
"typeName": "mscrm.opportunity",
"structuralProperty": 5
},
operationType: 0,
operationName: "ReopenOpportunityFromDeclinedStage"
};
};
Xrm.WebApi.online.execute(req).then(
function success(result) {
if (result.ok) {
//Success - No Return Data - Do Something
alert("Web API Action Called Successfully...");
}
},
function(error) {
Xrm.Utility.alertDialog(error.message);
}
);
}
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156