Hi everyone
I'm getting following error from custom ribbon button:
"Unable to get property 'getFormContext' of undefined or null reference"
js code:
var Sdk = window.Sdk || {};
(function () {
this.startclock = function (executionContext) {
var formContext = executionContext.getFormContext();
var triggervalue = formContext.getAttribute("acc1_startclocktrigger");
var notice = formContext.getAttribute("acc1_wfnotice");
var oldvalue = triggervalue.getValue();
var newvalue = ++oldvalue;
triggervalue.setValue(newvalue);
notice.setValue("0");
formContext.data.entity.save();
}
}).call(Sdk);
Any ideas?
Thank you in advance
Decio
Thank you Lu Hao, problem sorted
Hi Decio ,
Please make sure you are pissing execution context and the function calling using namespace like below.
Hi Decio,
On UCI, please use var executionContext = primaryControl, instead of var formContext = executionContext.getFormContext().
We can get the form field values properties using executionContext itself in Dynamics 365.
var executionContext = primaryControl; var triggervalue = executionContext.getAttribute("acc1_startclocktrigger");
You could refer to this article. The problem with this post is very similar to yours.
Hope this helps.
Best Regards,
Lu Hao
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156