Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Answered

Javascript method to open contextual email box in cases

Posted on by 2,095

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

  • SG-12071144-0 Profile Picture
    SG-12071144-0 3 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?
  • Javascript method to open contextual email box in cases
    @jestuder

    Can you please post the script you have used here
  • Verified answer
    jestuder Profile Picture
    jestuder 156 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.
  • scr1pt Profile Picture
    scr1pt 130 on at
    RE: Javascript method to open contextual email box in cases

    Hi Mike, did you find the solution?

  • Suggested answer
    Ray Profile Picture
    Ray 1,505 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

  • MikeC282 Profile Picture
    MikeC282 2,095 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
    Bipin D365 Profile Picture
    Bipin D365 28,964 Super User 2024 Season 1 on at
    RE: Javascript method to open contextual email box in cases

    Hi,

    Can you please try below code

    learn.microsoft.com/.../navigateto

  • Suggested answer
    Abdul Wahab Profile Picture
    Abdul Wahab 12,070 Super User 2024 Season 1 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/.../

  • MikeC282 Profile Picture
    MikeC282 2,095 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
    Abdul Wahab 12,070 Super User 2024 Season 1 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/.../

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans