Skip to main content
Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Suggested answer

Setting field value with Javascript on form not triggering standard operations as if user entered data

(0) ShareShare
ReportReport
Posted on by 64

We are setting the Product lookup on the Work Order Product form in mobile with offline enabled.

The value is setting correctly on the form, showing the Product name, and with the Product ID set, but the Unit Amount is not being set as it is when a user adds the same product to the form directly.

How can we trigger the standard Microsoft operations to set the Unit Amount etc as if the user had input the value on the form?

The script is run from a new field that reads a Product barcode to save the users inputting the product number into the Work Order Product.

We did have another script on the Product field, which we disabled for testing, and still the standard Microsoft functionality is not triggered on adding the product to the form.

We cannot save the form, as the Unit Amount is a required field, and the user has not yet entered the Quantity.

  • Suggested answer
    Hari Narayanan Profile Picture
    589 on at
    RE: Setting field value with Javascript on form not triggering standard operations as if user entered data

    Have you tried fireonChange for the product?

    When a field is set via code, there is a safety mechanism to not trigger on Change by default as it could lead to infinite loops  or undesired results. so developer can choose to trigger the onChange via fireOnChange api.

    learn.microsoft.com/.../fireonchange

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

News and Announcements

Now Available: 2025 Release Wave 2

Quick Links

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

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

#1
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 51 Most Valuable Professional

#2
Ramesh Kumar Profile Picture

Ramesh Kumar 42

#3
David Shaw_UK Profile Picture

David Shaw_UK 27

Featured topics

Product updates

Dynamics 365 release plans