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

Community site session details

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

Javascript method to open contextual email box in cases

(0) ShareShare
ReportReport
Posted on by 2,171

Hi all,

Just wondering if there's any specific client side built in javascript method to open the enhanced email's contextual email box in cases? So for example when I press the + button on the timeline and add a email it'll open this contextual box. I want to mimic this with my own custom button but not sure if there's a documented method to do this. Screenshot below:

pastedimage1666064947920v1.png

I have the same question (0)
  • Suggested answer
    Abdul Wahab Profile Picture
    12,119 Moderator on at
    RE: Javascript method to open contextual email box in cases

    Hi MikeC282,

    You need to analyse the behaviour of this button to mimic it. I wrote a blog post: Post: Edit (blogger.com) on how to customize the existing or out-of-the-box button. It might be helpful for you.

    If I answer your question then please mark it as verified.

    Let me know if I can provide you with more details.

    Thanks
    Regards,

    Abdul Wahab
    Power Platform & Customer Engagement Developer/Lead/Solution Architecture/Project Manager
    Direct/WhatsApp:+923323281237
    E-mail: abdulwahabubit@outlook.com
    Skype: abdul.wahabubit
    Linkedin: www.linkedin.com/.../

  • MikeC282 Profile Picture
    2,171 on at
    RE: Javascript method to open contextual email box in cases
    [quote user="Abdul Wahab"]

    Hi MikeC282,

    You need to analyse the behaviour of this button to mimic it. I wrote a blog post: Post: Edit (blogger.com) on how to customize the existing or out-of-the-box button. It might be helpful for you.

    If I answer your question then please mark it as verified.

    Let me know if I can provide you with more details.

    Thanks
    Regards,

    Abdul Wahab
    Power Platform & Customer Engagement Developer/Lead/Solution Architecture/Project Manager
    Direct/WhatsApp:+923323281237
    E-mail: abdulwahabubit@outlook.com
    Skype: abdul.wahabubit
    Linkedin: www.linkedin.com/.../

    [/quote]

    Hey Abdul Wahab ,

    I can't seem to see this blog post. It's asking me to sign up to blogger when I use the link. I think you're linking to the backend editing page of blogger.

    pastedimage1666070738901v1.png

    Kind regards,

    Mike

  • Suggested answer
    Abdul Wahab Profile Picture
    12,119 Moderator on at
    RE: Javascript method to open contextual email box in cases

    Hi MikeC282,

    Sorry. Here you are https://powerplatformaw.blogspot.com/2022/09/how-to-show-and-hide-button-based-on.html.

    If I answer your question then please mark it as verified.

    Let me know if I can provide you with more details.

    Thanks
    Regards,

    Abdul Wahab
    Power Platform & Customer Engagement Developer/Lead/Solution Architecture/Project Manager
    Direct/WhatsApp:+923323281237
    E-mail: abdulwahabubit@outlook.com
    Skype: abdul.wahabubit
    Linkedin: www.linkedin.com/.../

  • Suggested answer
    Bipin D365 Profile Picture
    28,983 Moderator on at
    RE: Javascript method to open contextual email box in cases

    Hi,

    Can you please try below code

    learn.microsoft.com/.../navigateto

  • MikeC282 Profile Picture
    2,171 on at
    RE: Javascript method to open contextual email box in cases

    Hey 

    [quote user="Bipin Kumar"]

    Hi,

    Can you please try below code

    learn.microsoft.com/.../navigateto

    [/quote]

    Hey bud,

    So I use the navigateTo method often but that just opens a modal dialog box either centre or on the side. I want to recreate the email pop out box.

  • Suggested answer
    Ray Profile Picture
    1,537 on at
    RE: Javascript method to open contextual email box in cases

    Hi Mike,

    Try this:

    var entityFormOptions = {};
    entityFormOptions["entityName"] = "email";
    entityFormOptions["openInNewWindow"] = true;
    
    
    // Open the form.
    Xrm.Navigation.openForm(entityFormOptions, {}).then(
        function (success) {
            console.log(success);
        },
        function (error) {
            console.log(error);
        });

    This function also support pass parameter to the new form, you may read more here: Link for document

  • scr1pt Profile Picture
    130 on at
    RE: Javascript method to open contextual email box in cases

    Hi Mike, did you find the solution?

  • Verified answer
    jestuder Profile Picture
    158 on at
    Javascript method to open contextual email box in cases
    Given the date on this post, not sure if you still need the answer to this.  But, I thought I would provide it as I just ran into this and I found the solution to it.  Before I post it, this approach it 100% unsupported as you will need to step out of the supported client reference documentation.
     
    There is a web resource that gets added and removed from the form when you click the "+" on the timeline then email.  It is "webresources/cc_MscrmControls.AppCommon.ContextualEmail.ContextualEmailControl/ContextualEmailControl.js".  Add that to your main form.  This way its statically have access.  Now that it's on the form, you will call:
     
    MscrmControls.AppCommon.ContextualEmail.PopupManager.createNewPopup();
     
    This method take 1 parameter.
     
    {
         appId: GET THIS FROM THE QUERY STRING PARAMETER OF THE URL,
         dataParams: {
                parentrecordid: GUID OF THE RECORD YOU ARE OPENING THE RECORD FROM,
                parentrecordname: NAME OF THE RECORD YOU ARE OPENING THE DIALOG FROM,
                parentrecordtype: RECORD TYPE OF THE RECORD YOU ARE OPENING THE DIALOG FROM
         },
         emailFormId: IN THE JAVASCRIPT IS A LIST OF CONSTANTS THE GUID IS HARDED THERE
    }
     
    In the dataParams you can pass other fields like To, From will auto populate.  I don't have the full code written, I just did a quick test in the the console debugging to see if I could get it to work while I was trying to figure out the code and I did get it to successful open the dialog and operate just as it would out of the box.  Hopefully Microsoft gives us a supported way.  If I do end up writing the JavaScript out for this, I will post it for anyone else that needs it.
  • Community member Profile Picture
    3 on at
    Javascript method to open contextual email box in cases
    @jestuder

    Can you please post the script you have used here
  • SG-12071144-0 Profile Picture
    6 on at
    Javascript method to open contextual email box in cases
    Hi @jestuder,
     
    I was able to open the enhanced email popup in the console like you suggested but when i try to call the same on the JS embedded on the form, i face error. Method not recognized. Any ideas?

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 120

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 120 Super User 2025 Season 2

#3
#ManoVerse Profile Picture

#ManoVerse 56

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans