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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Auto-open Email record created from workflow

(0) ShareShare
ReportReport
Posted on by 1,328

I have an on-demand workflow on the opportunity that creates an email record. I would like to automatically open that email record after workflow succeeds.

Does this require using the JS function Xrm.Utility.openEntityForm? If so, can someone guide me on how to trigger the function when the email is created?

Thanks.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    SCV Profile Picture
    1,004 on at

    Introduce a ribbon button to call a JavaScript function. Inside that function call the workflow which creates the email. (make it a synchronous workflow). Then in the JavaScript wait for a couple of seconds and query to get the created email. You can use REST builder to achieve this. Then open that email activity record using the window.open(URL) javascript method.. You will have to build the URL manually using the email records’ GUID.

  • Verified answer
    gdas Profile Picture
    50,091 Moderator on at

    Hi ,

    You are correct  you need to write custom JavaScript code using openEntityForm.OOB it's not possible.

    I would suggest try to add code in your opportunity ribbon action which fires automatically after certain interval and check email is created or not.

    function OppOnloadCheckEmail()

    {    

       var intervalId = window.setInterval(

        function () {

             window.clearInterval(intervalId);

            // Retrieve email based on some condition , make sure you need to write some logic that it will open only once.

            if (email != null) {  

                // openEntityForm    

            }

        }, 2000);

    }

  • Kevin Grech Profile Picture
    380 on at

    You can accomplish this using custom ribbon buttons and an Action with an entity reference as an output parameter. If your workflow is on demand and not executed on an event, you can replace it by the action and assign the newly created email as an output parameter.

    Then, you can create a ribbon button that calls the action using JS (through Web API for CRM2016+ using XMLHttpRequest)

    In the callback you provide, the action output parameter will be available as an object and therefore, you can call Xrm.Utility.openEntityForm with the returned value.

    Edit: I saw the tag with CRM2015. You can accomplish this with Sdk.Soap.js and CRM SDK Message Generator for CRM 2015 (or you can try the same with XMLHttpRequest against the OrganizationData.svc)

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans