Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

how to return a value from plugin to action

(0) ShareShare
ReportReport
Posted on by 645

I have a button that calls an action that triggers a plugin, I want to pass a value from my plugin and show it to the user (by popup). I defined an output  parameter in my action.
How do I return the value (output parameter) I retrieved in my plugin back to my function js ?

  • Suggested answer
    Inogic Profile Picture
    438 on at
    RE: how to return a value from plugin to action

    Hi Sahara,

    You can set the Output parameters in the plugin for the Action using the below code,

    context.OutputParameters["OutputParameterName"] = OutputParameterValue

    If the result of executed action is fine (i.e. success.ok == true) then you can read your response (or output parameter value) via success.json() as it will parse your response.

    Please refer below code for the same,

     //Exceute Action

                        Xrm.WebApi.online.execute(customActionReq).then(

                            //Perform on success

                            (success) => {

                                success.json().then(function(Response){

                                  // In the Response.OutputParameterName you will get your out put value

                                });

                            },

                            //Perform on error

                            (error) => {

                                console.log("Error");

                            }

                        );

     

    Hope this helps!

  • Suggested answer
    Pawar Pravin  Profile Picture
    5,231 on at
    RE: how to return a value from plugin to action

    Hi Sahara,

    You can use "context.OutputParameters[“ReturnObject”] = ReturnValue" to return value form custom action (plugin code)

    Please refer below code for more details:

    pravinpawarweb.wordpress.com/.../

    To show alert on page :

    pravinpawarweb.wordpress.com/.../

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,688 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,643 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans