Показать сообщение отдельно
Старый 17.10.2013, 23:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
Gareth Tucker: Using Business Rules for Calculated Fields in CRM 2013
Источник: http://garethtuckercrm.com/2013/10/1...s-in-crm-2013/
==============

Business Rules are a viable alternative to JavaScript for basic field calculations, such as the below example where I want Line Total to be calculated based on Unit Amount x Qty:



To automate this simple calculation I configured 3 Business Rules.  Firstly, the rule that sets Line Total =  Unit Amount x Qty (when both those fields are populated):



And two additional Business Rules to clear the Line Total field once either of the input fields are cleared:

 

And:



</p></p>I describe this as a JavaScript replacement and it is.  However, that doesn’t mean either JavaScript or a Business Rule is the right solution to this automation requirement.  They both have the same weakness, they only fire when the data is changed through the CRM form.   Understanding when Business Rules fire is easy, just think of them as JavaScripts.  Behind the scenes the Business Rules you author are translated into JavaScript so there really is no difference.    Implementing a calculation via just a JavaScript or Business Rule leaves your data integrity exposed to updates via Bulk Edit, Data Import, Mobile Express, API and Workflow updates where updates to your fields won’t trigger the recalc of the calculated field.   For that reason, I would meet this requirement with a combination of a Business Rule and a Plug-in.  The Business Rule provides a real time calculation experience for the user, the Plug-in ensures the calculation happens regardless of the source of the update.    Wondering whether a simple Real Time Workflow could do the job of the Plug-in?  The answer is no, the workflow designer doesn’t provide the ability to define this type of calculation.




Источник: http://garethtuckercrm.com/2013/10/1...s-in-crm-2013/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.