Skip to main content
Dynamics 365 general forum
Answered

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

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

  • Verified answer
    Bipin D365 Profile Picture
    Bipin D365 28,934 Super User on at
    RE: I'm having an issue when updating some code to executionContext.

    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

  • GRedhead Profile Picture
    GRedhead 270 on at
    RE: I'm having an issue when updating some code to executionContext.

    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
    Bipin D365 28,934 Super User on at
    RE: I'm having an issue when updating some code to executionContext.

    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

Helpful resources

Quick Links

What Motivates a Super User?

We know many of you visit the Dynamics 365 Community and Power Platform…

Demystifying Copilot with Sundar…

Industry experts answer burning questions directly from our amazing Community…

Enabling Copilot Case and Conversation…

Agents can easily recap an ongoing chat, transcribe a voice conversation…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 282,978 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 222,562 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,138

Product updates

Dynamics 365 release plans