The cloud has become an indispensable part of most companies’ strategy. A large number of IT managers today think of the cloud when implementing new systems or upgrading existing ones. Your Micr...
Ribbon Enable Rules using Asynchronous processing
This can be demonstrated with an example that enables or disables a ribbon button on the Account entity if the account has any contacts.
Problematic code example:
We will need a Boolean variable called buttonProcessing with a scope outside the method that will store the actual value to be returned to the Enable Rule. For safety, this variable can have an initial value of false. This is so that a ribbon button is not enabled while the asynchronous call is awaiting its response.
Corrected code example:
This ribbon button is now enabled or not based a value set during an asynchronous callback.
There is a performance consideration that we should take into account when calling refreshRibbon. All buttons in the form ribbon will be refreshed, so this may have an impact if a lot of buttons have been added to form. Fortunately, if the above pattern is followed, the logic behind each custom Enable Rule will be executed only once per form load.
To read more about the refreshRibbon method, please see https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/formcontext-ui/refreshribbon
More relevant news
How to manage expected operational cost versus the actual costs received16 October 2020
In an earlier blogpost (How to manage additional cost coming with a trade deal) we highlight the automatic calculation of expected operational cost during trade capture. Within this post we highl...