Scenario 2
John is working with a requirement according to which he needs to populate the category and subcategory of a selected product on the form. He is using JavaScript for this. There are three different lookups on the form: Product
, Category
, and Sub Category
. Now, as per John's requirement, when a user selects a product in the lookup field, the category and subcategory of the product need to be populated on the onchange
event of the product lookup on the form. Therefore, we can make a Web API call from JavaScript to retrieve both the category and the subcategory of a selected product and can further set those values for lookups using JavaScript functions.
Why use Web API?
Using JavaScript is one of the most convenient ways to perform operations on data in Dynamics 365; you can do this with the help of the Web API.
The Web API sends and receives data in JSON format, which is easy to convert into objects in JavaScript. So, most developers use the Web API for performing CRUD operations...