Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Dynamics 365 general forum

TypeError: executionContext.getFormContext is not a function

(1) ShareShare
ReportReport
Posted on by

Hello Community,

After upgrading to 9.0 recently, we have been experiencing this issue whenever a lead is disqualified or reactivated.

1538.error.PNG

Here is the full error log:

TypeError: executionContext.getFormContext is not a function
at SetUppercase (https://***.crm.dynamics.com/%7B636700249930001087%7D/WebResources/***_Common.js?ver=2021682843:19:40)
at eval (eval at RunHandlerInternal (https://***.crm.dynamics.com/form/ClientApiWrapper.aspx?ver=2021682843:153:1), <anonymous>:1:1)
at RunHandlerInternal (https://***.crm.dynamics.com/form/ClientApiWrapper.aspx?ver=2021682843:159:1)
at RunHandlers (https://***.crm.dynamics.com/form/ClientApiWrapper.aspx?ver=2021682843:118:1)
at ExecuteHandler (https://***.crm.dynamics.com/form/ClientApiWrapper.aspx?ver=2021682843:81:1)
at Mscrm.TurboForm.Control.CustomScriptsManager.$De_1 (https://***.crm.dynamics.com/_static/form/formcontrols.js?ver=2021682843:5093:100)
at Mscrm.TurboForm.Control.CustomScriptsManager.executeHandler (https://***.crm.dynamics.com/_static/form/formcontrols.js?ver=2021682843:5031:18)
at Mscrm.TurboForm.Control.CustomScriptsManager.executeHandlerByDescriptor (https://***.crm.dynamics.com/_static/form/formcontrols.js?ver=2021682843:5062:18)
at https://***.crm.dynamics.com/_static/form/formcontrols.js?ver=2021682843:5073:19
at https://***.crm.dynamics.com/_common/global.ashx?ver=2021682843:6823:193161

Here is the function where the problem is happening in our custom web resource.

function SetUppercase(executionContext, fields) {
var formContext = executionContext.getFormContext();
fields.forEach(function (field) {
if (formContext.getAttribute(field).getValue())
formContext.getAttribute(field).setValue(formContext.getAttribute(field).getValue().toUpperCase());
});
}

Not sure why this started being a problem.

Any help is appreciated. 

Thanks!

Kodor

  • Community Member Profile Picture
    on at
    RE: TypeError: executionContext.getFormContext is not a function

    Thanks very much,

    the javascript change from var formContext = executionContext.getFormContext();

    to var formContext = primaryControl.getFormContext(); did the trick.

    Much appreciated!

  • Verified answer
    Ben Thompson Profile Picture
    6,350 on at
    RE: TypeError: executionContext.getFormContext is not a function

    When you are calling the qualifying the lead you are doing it from the ribbon menu not the form itself - hence while you have access to the execution context, that context doesn’t have automatic access to the form context.

    stackoverflow.com/.../how-to-get-formcontext-in-ribbon-command-of-dynamics-365-9-0 Shows you how to resolve the issue with pictures.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,001 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,837 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans