Skip to main content

Notifications

Announcements

No record found.

Customer Service forum

Hii,when click the button in email form then open a new tab and show the all email conversions with the perticular user.

Posted on by 10

In email form we have one button .by clicking thet button  open a new tab and then show the all email conversions with the user. by using jscript,html etc.

how can we achieve this please help me to solve this.

Categories:
  • cloflyMao Profile Picture
    cloflyMao 25,198 on at
    RE: Hii,when click the button in email form then open a new tab and show the all email conversions with the perticular user.

    Hi nani,

    Firstly, you could download a solution called Ribbon Workbench and import it into your CRM, it can help you adding custom button with script to form ribbon.

    https://www.develop1.net/public/rwb/ribbonworkbench.aspx

    Tutorial about how to add your own script to custom ribbon button.

    https://community.dynamics.com/crm/b/crmtipsfromadeveloper/posts/know-how-add-a-ribbon-button-using-ribbon-workbench

    Then execute script below to open a new window with email context when you click custom button:

    var entity = Xrm.Page.data.entity.getEntityName();
    var id = Xrm.Page.data.entity.getId().replace('{', '').replace('}', '');
    var user = Xrm.Page.context.getUserId().replace('{', '').replace('}', '');

    Xrm.WebApi.retrieveMultipleRecords(entity, "?$select=trackingtoken,description&$filter=_ownerid_value eq "+user).then(
        function success(result) {
            var w = window.open("");
            for (var i = 0; i < result.entities.length; i++) {
                w.document.write(result.entities[i].trackingtoken+"<hr>"+result.entities[i].description+"<br><br>");
            }
        },
        function (error) {
            console.log(error.message);
        }
    );

    Due to email content(Receive and Send) is formatted as HTML source code, so I just output raw HTML source code on new white page in my example,

    pastedimage1565604469462v1.png

    you could convert them to text with your business requirement.

    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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

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