|
![]() |
#1 |
Участник
|
crmtipoftheday: Tip #1322: Incorrect increment and decrement in Power Automate
Источник: https://crmtipoftheday.com/1322/inco...ower-automate/
============== &tl;dr When using Increment variable or Decrement variable actions, use coalesce function in the parameter to avoid unexpected results. Explanation It was a dark and stormy night. The tax was calculated in a Power Automate flow by looping through the array of applicable records and incrementing a total variable by the tax field value. The client threw a book at me and said that total tax is off by a few dollars. True story. (Except the throw and the book, the storm was real). It’s not uncommon in Common Data Service (lol) to imply that when a decimal or money field contains null it’s equivalent to 0. For example, null tax means no tax or zero tax. The fun begins when you try to calculate total over an array of records. What’s the result of this flow? ![]() The fix is easy – use coalesce function. coalesce(items('Apply_to_each'),0)And the result is now 6 which is about as much as Facebook pays in tax in a year. The above applies to Decrement variable action as well. Duh… Cover photo by George Becker Источник: https://crmtipoftheday.com/1322/inco...ower-automate/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|