I want to add two different web resources file one that contains code for create type form and one that contains js code for update of form...
Hello Sabahat,
Yes you are on right path. You can use the "getFormType" API which will provide form type i.e. Create, Update, Read only, etc.
And as per your requirement you can perform your task of lock and unlock field.
Basically make this fields as locked by default and Run a JS which will make this fields as Unlocked for Create form Type.
Please refer below JS which will help you to implement your requirement.
Thank you,
Amit Katariya
Hi,
Yes, you should use getFirmType to identity the form type and do your logic.
actually i want to add customized js code for the edit option of form like when i want to edit an attribute for example group code field of a contact it gives an alert that group code field is lock and actually locks the field during editing of already saved contact. While intitially during creation of contact group field was editable and unlocked.
I'm thinking of using getformType() method to do that. Is this the right track to do this task?
Hi Sabahat,
All client-side code is initiated by events. In model-driven apps, you associate a specific function in a JavaScript library (Script web resource) to be executed when an event occurs. This function is called an event handler. Each event handler specifies a single function within a JavaScript library and any parameters that can be passed to the function.
Form event handlers for Dynamics 365 Customer Engagement (on-premises) forms can be configured for the following areas in a form:
Set up event handlers for a form in Dynamics 365 Customer Engagement (on-premises) | Microsoft Docs
Based on your description,you can select events as follows:
(1)for create type form
Form OnSave
(2)for update of form
Form OnSave or Field OnChange
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,101 Super User 2024 Season 2
Martin Dráb 229,908 Most Valuable Professional
nmaenpaa 101,156