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 365 | Integration, Dataverse...
Answered

I'm having an issue when updating some code to executionContext.

(0) ShareShare
ReportReport
Posted on by 270

Need help with the following in getting the URL, while trying to trigger a workflow.

I keep gettign the error "TypeError: executionContext.getClientUrl is not a function"

If is try also with "var url = executionContext.getContext.getClientUrl();" i get this error: TypeError: Cannot read property 'getClientUrl' of undefined

function RunCloseCaseWorkflowsTwo(executionContext) {

    var resolution = executionContext.getAttribute("xxx_resolution").getValue();
    var resolutionSummary = executionContext.getAttribute("xxx_resolutionsummary").getValue();

    if (resolution != null && resolutionSummary != null) {

        var recordId = executionContext.PrimaryEntityId;
        var workflowId = 'B9787009-353D-4BEA-8C82-752006F77E5E'
        var url = executionContext.getClientUrl();

        if (url != null) {

            var request = ""  
                ""  

Any help is apprecaited.

I have the same question (0)
  • Verified answer
    Bipin D365 Profile Picture
    28,983 Moderator on at

    Hi,

    Try below code to get URL from JS code.

    var globalContext = Xrm.Utility.getGlobalContext();

    var url=globalContext.getClientUrl();

    docs.microsoft.com/.../getclienturl

    Make sure you are using below line of code in your js to get formcontext.

    var formContext=executionContext.getFormContext();

    docs.microsoft.com/.../getformcontext

    Please mark my answer verified if i were helpful

  • GRedhead Profile Picture
    270 on at

    Great that got me further thanks, any idea how to refresh the page in the new UI in javascript?

  • Verified answer
    Bipin D365 Profile Picture
    28,983 Moderator on at

    Hi,

    Check below link to get the code to refresh the UI.

    docs.microsoft.com/.../refresh

    You can also use openform client api to reload/refresh the form UI.

    docs.microsoft.com/.../openform

    Please mark my answer verified if i were helpful

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 365 | Integration, Dataverse, and general topics

#1
Martin Dráb Profile Picture

Martin Dráb 47 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 38 Super User 2025 Season 2

#3
Pallavi Phade Profile Picture

Pallavi Phade 32

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans