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

Announcements

News and Announcements icon
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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

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

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 51 Super User 2026 Season 1

#1
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 51 Most Valuable Professional

#3
Nagaraju_Matta Profile Picture

Nagaraju_Matta 50

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans