Would a simple workflow work to populate the description field?
Hi Sandy,
The following is modified sample code.
function autoPopulateData(executionContext) { var workerID = Xrm.Page.getAttribute("msdyn_name").getValue(); var att = Xrm.Page.getAttribute("new_description"); att.setValue(workerID); }
In my form, the Work Order Number field which name is "msdyn_name” is an auto-populated field.
So you just replace "msdyn_name” in the code with the name of the Work Order ID in your environment, the description field will be populated with the same WO ID automantically When the form onload.
Regards,
Clofly
Great!! Thank You Clofly.
It seems your code is pulling GUID.
My requirement is, an auto-populated field, named as Work Order ID, which need to be get & set in the description field in same form.
Hi Sandy,
You can populate description field with WO ID by following steps.
Here are steps.
1.write custom JavaScript code.
function autoPopulateData(executionContext) { var workerID = Xrm.Page.data.entity.getId().replace("{", "").replace("}", ""); var att = Xrm.Page.getAttribute("new_description"); att.setValue(workerID); }
2. Add your JavaScript code in a Script web resource.
3. Associate Script web resource to a form.
4. Test
Regards,
Clofly
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,269 Super User 2024 Season 2
Martin Dráb 230,198 Most Valuable Professional
nmaenpaa 101,156