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 :
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 ?

I have the same question (0)
  • Suggested answer
    Pawar Pravin  Profile Picture
    5,237 on at

    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/.../

  • Suggested answer
    Inogic Profile Picture
    682 on at

    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!

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 171 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 83

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans