web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested Answer

Custom Action

(0) ShareShare
ReportReport
Posted on by 10

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,

I have the same question (0)
  • Suggested answer
    meelamri Profile Picture
    13,216 User Group Leader on at

    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 !!

  • Sahilkharbanda Profile Picture
    10 on at

    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.

    5543.Capture.PNG

  • Suggested answer
    PabloCRP Profile Picture
    1,088 on at

    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 .

  • Suggested answer
    Torrado Profile Picture
    1,270 on at

    Hello,

    Please check this example.

    Hope this helps you.

    Please mark the answer as verified if helpful. That will help others in future.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Siv Sagar Profile Picture

Siv Sagar 93 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 80

#3
Martin Dráb Profile Picture

Martin Dráb 64 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans