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

Announcements

News and Announcements icon
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
    766 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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Nagaraju_Matta Profile Picture

Nagaraju_Matta 119

#2
ManoVerse Profile Picture

ManoVerse 78 Super User 2026 Season 1

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 66 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans