Skip to main content

Notifications

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;});
}

  • Suggested answer
    cloflyMao Profile Picture
    25,208 on at
    RE: Using Out of the box command bar javascript functions in Custom command bar buttons

    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

  • Suggested answer
    Pawar Pravin  Profile Picture
    5,237 on at
    RE: Using Out of the box command bar javascript functions in Custom command bar buttons

    Hi Krish,

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

    pravinpawarweb.wordpress.com/.../

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: Using Out of the box command bar javascript functions in Custom command bar buttons

    Hello,

    This should work fine. Have you tried it already?

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 the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 225 Super User 2025 Season 1

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 106 Most Valuable Professional

#3
Eugen Podkorytov Profile Picture

Eugen Podkorytov 102

Overall leaderboard

Product updates

Dynamics 365 release plans