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

Using Out of the box command bar javascript functions in Custom command bar buttons

(0) ShareShare
ReportReport
Posted on by

Hi 

I have a requirement in Dynamics 365 8.2, just to give users an alert before sending an email. When users click on the send email button they want to see an alert are you sure you want to send this email. clicks ok (Yes) email will be sent. 

I created a custom send button and using below javascript action instead of updating out of the box button. Send email button uses send() function. I am using this function in my script below. Is this below script is fine or I have to mention the javascript library (/_static/activities/email.js) for send function explicitly? 

function EmailSendAlert()
{
//debugger;
Xrm.Utility.confirmDialog("Are you sure you want to send this Email", function(){ send(); },function(){return;});
}

I have the same question (0)
  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    This should work fine. Have you tried it already?

  • Suggested answer
    Pawar Pravin  Profile Picture
    5,237 on at

    Hi Krish,

    Please refer below url for your reference, I have tried to explain in details. It could help you

    pravinpawarweb.wordpress.com/.../

  • Suggested answer
    cloflyMao Profile Picture
    25,210 on at

    Hi Krish,

    As Pravin suggested, you could add your custom confirm dialog to send email by ribbon workbench, below is my process:

    Notice: my version is 9.0, but the process would be similar.

    1. I recommend you copy OOB SEND button and make customization on copied one.

    2. OOB Command name to send email is Mscrm.Form.email.Send, (1)

    script is $webresource:Activities/SystemLibraries/Email_main_system_library.js, (2)

    function is Activities.EmailCommands.send, (3)

    primary control is required. (4) (as executionContext)

    pastedimage1574404673126v1.png

    3. Copy the OOB command(1),

    copy all code inside Email_main_system_library.js(yours might be email.js) to our own web resource, (2)

    copy original function name. (3)

    pastedimage1574404936493v2.png

    4. Let custom Xrm.Utility.confirmDialog surrounds OOB snippet in EmailCommands.send function:

    pastedimage1574405201898v3.png

    5. Apply OOB display rules to custom button:

    pastedimage1574405465457v4.png

    6. Save and publish solution in ribbon.

    7. Everything work well after I click OK(I didn't hide OOB SEND button in test)

    pastedimage1574405589948v6.png

    Regards,

    Clofly

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 70 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 33 Most Valuable Professional

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans