Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Custom global action output parameters always return empty

(0) ShareShare
ReportReport
Posted on by 15

Hi all

I've created a custom plugin with three parameters:

  1. Url, input: A parameter with the URL pointing to a file stored in a file server
  2. B64, output: A string parameter to contain the file entered as input, encoded as B64 string
  3. MIMEType, output: A string parameter to contain the mime type of the file entered as input

I registered the plugin with Plugin Registration Tool without additional steps. My error COULD BE here, but I don't know how to register a step to a global action not tied to any entity; the tool asks for an Event Handler and I don't know which one to assign, because all the Event Handlers available to me refer to other actions of the plugin that are not remotely related to this one.

Then I've created a custom process on my Dynamics organization (v8.2) and created the input and output parameters. I've added a step to insert the value of the input parameter, but I haven't created any additional steps to fill the values of the output parameter because when I try to do it none of the offered values look sensible to me. Even though, I've tried with those values and get errors.

Then I've created a javascript function to call the plugin from inside a webresource. 

And the situation is as follows:

  • The plugin works. The javascript is able to execute the plugin and I've traced every step of the plugin's C# code and it's OK. The local variables I use to store the two values are filled with correct data, and then the [OutputParameter] variables are also filled; I've checked their values and they're ok. 
  • The javascript receives a 200 response with the two expected parameters, but the parameters are NULL. Always null. There's a middle step I'm missing between my C# code establishes the values in the output parameters and the custom action returns those values to the javascript, but I don't know where's the problem. 

I've also tried the following:

In Dynamics' custom action form, I've tried to insert a "perform action" step, and then I was able to set the output variables with the results of the action call. BUT if I do it this way, when the javascript makes the request to my organization API with the name of the custom action, the action is stopped because it would become an infinite loop; as it should be: I'm calling an action that calls itself!

Please help, I'm really stumped with this. 

  • Priyanka Maru Profile Picture
    55 on at
    RE: Custom global action output parameters always return empty

    it works for me. Thanks

  • Brandon Duncan Profile Picture
    20 on at
    RE: Custom global action output parameters always return empty

    Switching it to synchronous fixed the issue for me. I wish I knew why async won't work, but it doesn't.

  • Verified answer
    anthonywestphal Profile Picture
    35 on at
    RE: Custom global action output parameters always return empty

    Hi

    I had a similar issue. I have a global action I was using to trigger a plugin from a ribbon button. The plugin would execute without any issues however all output parameters would return as null.

    After hrs of debugging and triple checking both the JS code and the C# code it turned out that I had left the plugin as an asynchronous plugin in the registration tool. When I changed back to a synchronous plugin the output parameters started coming through no problems.

    pastedimage1637619345405v1.png

  • CarlosMPerez Profile Picture
    15 on at
    RE: Custom global action output parameters always return empty

    Hi, thanks for the reply.

    Sadly, I'm having the same problems calling the Action from Javascript or from C# console: the return arguments are always null. As I've said, I know the arguments should NOT be null because the internal logic of my Action gets the values and establishes those values on the return parameters. It's the ACTION defined in Dynamics the one that seems unable to get those values, I suspect because I'm missing a step, there's have to be something after defining an output parameter in a custom action that I'm missing.

    Also please note that one of the things that I tried was to bypass my C# action code completely and just return literal values as a test, for example return a "HELLO" on one of the variables and an empty string on the other, and got null values on both anyways. 

  • Bipin D365 Profile Picture
    28,981 Moderator on at
    RE: Custom global action output parameters always return empty

    Hi,

    You can try couple of things-

    1. Use Rest Builder tool to fire your Custom action to see response in this tool.

    Download link - github.com/.../releases

    2. Try to execute your custom action using C# console code. Find code in below link. Then check the reponse and see if it contains your output parameter.

    mscrmdynamicssite.wordpress.com/.../

    Please mark my answer verified if i were helpful

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 225 Super User 2025 Season 1

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 106 Most Valuable Professional

#3
Eugen Podkorytov Profile Picture

Eugen Podkorytov 102

Overall leaderboard

Product updates

Dynamics 365 release plans