Hallo,
I need your help,i try to create a javascript code for this scenario:
i want to add a lead then a company for this lead i want that when i go to new "company" that the field name (Lead ) be automatically set as company name.
Thanks.
*This post is locked for comments
Make sure you are passing executionContext in the form editor where you registered "SetLocalStorage" function.
hallo Goutam ,
it is my code :
function SetLocalStorage(executionContext)
{
var formContext = executionContext.getFormContext();
var firstName = formContext.getControl("fullname").getAttribute().getValue().toString();
localStorage.setItem("FirstName",firstName );
}
i wanna to storage the fullname from Lead (onsave)
but he schow me thismistake :
TypeError: Cannot read property 'getFormContext' of undefined
at SetLocalStorage (4cosmobn.crm4.dynamics.com/.../new_LeadAufgabe
at eval (eval at RunHandlerInternal (4cosmobn.crm4.dynamics.com/.../ClientApiWrapper.aspx, <anonymous>:1:1)
at RunHandlerInternal (4cosmobn.crm4.dynamics.com/.../ClientApiWrapper.aspx
at RunHandlers (4cosmobn.crm4.dynamics.com/.../ClientApiWrapper.aspx
at ExecuteHandler (4cosmobn.crm4.dynamics.com/.../ClientApiWrapper.aspx
at Mscrm.TurboForm.Control.CustomScriptsManager.$Dq_1 (4cosmobn.crm4.dynamics.com/.../formcontrols.js
at Mscrm.TurboForm.Control.CustomScriptsManager.executeHandler (4cosmobn.crm4.dynamics.com/.../formcontrols.js
at Mscrm.TurboForm.Control.CustomScriptsManager.executeHandlerByDescriptor (4cosmobn.crm4.dynamics.com/.../formcontrols.js
Mohamed Amine Mahmoudi
83
Super User 2025 Season 1
Community Member
54
Victor Onyebuchi
6