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

Announcements

No record found.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 182 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 123

#3
CU11031447-0 Profile Picture

CU11031447-0 100

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans