04.08.2018, 00:26 | #1 |
Участник
|
powerobjects: Using an OnKeyPress Event to Dynamically Load Values from Global Option Sets
Источник: https://www.powerobjects.com/2018/08...l-option-sets/
============== Ever wish you could dynamically set the available values of a field to reflect picklist values? Sure, there are ways of filtering out unwanted options based on some filter criteria, but if you’re dealing with data constraints that are constantly changing (ex: the brands of cars sold by a merchant at a particular location) it can get pretty messy, pretty quickly. That said, the best way to achieve ease of consistency and maintainability when it comes to data is through the use of Global Option Sets and Auto-completion. First, you’ll want to create a Global Option Set that has the values you’d like to leverage. Next, you’ll need to write some JavaScript code that brings in the metadata of the Global Option Set (thanks to the CRM Web API, this is possible): Once that’s been completed, we’ll want to add some more JavaScript code to our OnLoad event to register our OnKeyPress logic with the appropriate control: Lastly, we’ll need to ensure that the text selected matches one of the available picklist values before saving the record: And that should do it! NOTE: For enhanced performance, you can make “picklistOptions” a global variable, and only populate when/if your picklist selection criteria changes. Be sure to subscribe to our blog for more helpful Dynamics 365 tips! Happy Dynamics 365’ing! Источник: https://www.powerobjects.com/2018/08...l-option-sets/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|