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

  • Kevin Grech Profile Picture
    380 on at
    RE: Auto-open Email record created from workflow

    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)

  • Verified answer
    gdas Profile Picture
    50,091 Moderator on at
    RE: Auto-open Email record created from workflow

    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);

    }

  • Verified answer
    SCV Profile Picture
    1,004 on at
    RE: Auto-open Email record created from workflow

    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.

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
Victor Onyebuchi Profile Picture

Victor Onyebuchi 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans