Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

Show custom pop up message when plugin complete task

(3) ShareShare
ReportReport
Posted on by 2,632
Hi Everyone
Is there a way to show a message once the plugin complete a task- success or fail message. For example "Document created successfully!"
  • Verified answer
    Amit Katariya007 Profile Picture
    Amit Katariya007 10,203 Super User 2025 Season 1 on at
    Show custom pop up message when plugin complete task
    In Dynamics 365, plugins run server-side, so they don't have direct access to the user interface to display messages. However, you can achieve this functionality using one of the following approaches:
     
    1. Use a Custom Action and Synchronous Workflow/Plugin
     
    Create a custom action that triggers your plugin logic.
    Call this action from a JavaScript web resource or through Power Automate.
    Return the success or failure message as part of the action's response.
    Display the message to the user using JavaScript on the form or a dialog.
     
    Steps:
     
    1. Create a custom action in the Dynamics solution.
    2. Register the plugin on the custom action's execution.
    3. Use JavaScript to call the action and handle the response.
    4. Show error message using openAlerDialog api.
     
     
    2. Throw Exceptions in Plugin
     
    If the plugin fails, you can throw an exception with a user-friendly error message. Dynamics will display the error to the user.
    For successful operations, this method doesn't work, as no "success message" mechanism exists for plugins.
     
    Example:
     
    if (operationFailed)
    {
        throw new InvalidPluginExecutionException("Document creation failed due to invalid data.");
    }
     
    3. Use a Real-Time Workflow/Flow to Update a Field
     
    Update a custom field (e.g., "Status Message") on the record with the success or failure message after the plugin completes.
    Add a notification or JavaScript logic to display the message when the field is updated.
     
    Steps:
     
    1. Create a custom text field on the entity (e.g., statusmessage).
    2. Update the field from your plugin with the desired message.
    3. Use form scripting to display the field's value as a notification.
     
    var statusMessage = formContext.getAttribute("statusmessage").getValue();
    if (statusMessage) {
        Xrm.Navigation.openAlertDialog({ text: statusMessage });
    }
     
    4. Create a InApp Notification.
    You can create a InApp Notification from plugin it self. So no need of Any Client side code.
     
     
    Which Approach to Choose?
     
    Simple error messages: Throw exceptions in the plugin.
    Interactive success and error messages: Use Custom Actions or Custom APIs with JavaScript.
    Record-level feedback: Update a field with the message and display it using form scripting.

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 Our 2025 Season 1 Super Users!

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

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 231,287 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans