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 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.

(0) ShareShare
ReportReport
Posted on by 12

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:
I have the same question (0)
  • cloflyMao Profile Picture
    25,210 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 > Customer Service

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans