
Hi, I am new in D365 and Javascript so I would be really appreciated if anyone could help me.
Basically, how can i auto-populate exactly like in the picture of field name "Name" based on value Min range, Max range, Requestor Workshop and Requester Position?
Objectives : Name : Range From {Minimumrange} to {Maximumrange}, For {Requestorworkshop} - {Requestorposition}
I have try using print function in Javascript but no luck. Can anyone help me with the code?
Best Regards,
Farhan
Hi,
Please try the following code:
function autoPopulate(executionContext){
var formContext = executionContext.getFormContext();
var frank123_minimumrange = formContext.getAttribute("frank123_minimumrange").getValue();
var frank123_maximumrange = formContext.getAttribute("frank123_maximumrange").getValue();
var frank123_requesterworkgroup = formContext.getAttribute("frank123_requesterworkgroup").getValue();
var frank123_requestorposition = formContext.getAttribute("frank123_requestorposition").getValue();
var frank123_name = formContext.getAttribute("frank123_name").setValue("Range From " frank123_minimumrange " to " frank123_maximumrange ", For " frank123_requesterworkgroup " - " frank123_requestorposition "");
}
You need to add OnSave event:
Result:
If this helped you, I'd appreciate it if you'd mark this as a Verified Answer, which may in turn help others as well.
Best Regards,
Frank Gong