Hi Everyone,
Need some help to call Custom Action using jaavscrcipt and pass Input parameter as String with a serialized JSON object .
Can anyone suggest me any reference for this.
Thanks,
Hi Everyone,
Need some help to call Custom Action using jaavscrcipt and pass Input parameter as String with a serialized JSON object .
Can anyone suggest me any reference for this.
Thanks,
Hello,
Please check this example.
Hope this helps you.
Please mark the answer as verified if helpful. That will help others in future.
Hi, you didn't mention what how you are going to call it. The common way its using JS but it could be in c#, powerapp.
here an example with JavaScript
function callAction(parameterJSON) { var entity = {}; var requestAction = {}; requestAction.parameterJSON = parameterJSON; requestAction.getMetadata = function () { return { boundParameter: null, operationName: "NAME OF YOUR ACTION", operationType: 0, parameterTypes: "parameterJSON": { typeName: "Edm.String", structuralProperty: 1 } } }; }; Xrm.WebApi.execute(requestAction).then( function (result) { result.json().then( function (response) { console.log(response); //HERE YOU CAN DO WHATEVER YOU NEED WITH RESPONSE } ); }, function (error) { console.log(error); }); }
you can refer to HERE the official documentation
regards.
if this answered to your question please don't forget to mark it as an aswer .
Hi,
I have tried that but could not able to figure out the format for input parameter.
Please check the below code snippet.
var actionName = "msdyncrm_UpsertFile"; // Global Action Unique Name
//Pass the input parameters of action
var parameters = {
"InputFile" : "{\"msdyncrm_name\":\"Data\",\"msdyncrm_contenttype\":\".jpeg\",\"msdyncrm_width\":10,\"msdyncrm_height\":10}"
};
Please refer to this doc : docs.microsoft.com/.../migrate-files
Still giving me error.
Hi,
the easiest way is to use the CRM Rest Builder tool: github.com/.../releases
This tool will generate the code for you.
Good Luck !!
André Arnaud de Cal... 291,391 Super User 2024 Season 2
Martin Dráb 230,445 Most Valuable Professional
nmaenpaa 101,156