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.

  • Verified answer
    Bipin D365 Profile Picture
    28,981 Moderator 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
    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
    28,981 Moderator 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

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

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

#1
Vahid Ghafarpour Profile Picture

Vahid Ghafarpour 32 Super User 2025 Season 1

#2
Sahra Profile Picture

Sahra 21

#3
Mansi Soni Profile Picture

Mansi Soni 15

Overall leaderboard

Product updates

Dynamics 365 release plans