Skip to main content

Notifications

Announcements

No record found.

Service | Customer Service, Contact Center, Fie...
Suggested answer

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

Posted on by 41

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
    Hari Narayanan 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

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans