web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Answered

Javascript to Auto Fill Form Field Based on Other Field Forms

(0) ShareShare
ReportReport
Posted on by

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}

pastedimage1628503677979v1.png

I have try using print function in Javascript but no luck. Can anyone help me with the code?

Best Regards,

Farhan

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at

    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:

    https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/customize/configure-event-handlers-legacy?view=op-9-1#to-configure-an-event-handler

    Result:

    pastedimage1628577085234v1.png

    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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 45 Super User 2025 Season 2

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 27 Most Valuable Professional

#3
Soundari Profile Picture

Soundari 15

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans