Run javascript on closed records eg update calculated fields when running workflow
-
Monday, August 13, 2012 11:01 AM
Hi,
Is there anyway to ensure javascript can run without needing to open the record?
In my situation, I have created a workflow which creates new invoice records. I also have a javascript function that calculates a salesperson commission by multiplying the commission rate by the invoice value, and updates the commission field on the invoice. When the workflow creates the new invoice, I can pull in the sales person comm rate and invoice values to create the invoices but the calculated field remains blank until I open the record (and the javascript function triggers).
What is the best way to calculate the commission amount when creating the record via the workflow? I realise that a plugin would do this but this is probably beyond my technical knowledge and I was hoping for a simple solution :-)
I'm using CRM 2011 Online by the way.
Thanks
All Replies
-
Monday, August 13, 2012 11:03 AMAnswerer
Hi,
Yes, you are right, a plugin is the best way to do this - so that the calculation is performed on the server side and not the client side (as with Javascript). If you are after a no-code solution you can use 'Formula Manager' from North52 - http://www.north52.com/default.htm
hth,
Scott
Scott Durow
Read my blog: www.develop1.net/public
If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful" -
Monday, August 13, 2012 11:08 AM
Thanks Scott,
I've tried the formula manager solution before - was ideal in theory, but it ended up preventing a vital workflow from working for some reason - most likely it was getting a Div/0 error somewhere and could be fixed, but after spending a whole day fixing the mess it created, I lost faith in it!
Do you know of a simple step by step guide on the net to creating a custom workflow plugin for 2011 Online? I could probably work it out if I had a clear guide
Thanks
-
Monday, August 13, 2012 1:57 PMAnswerer
Hi,
I've not had any issues with formula manager, but for custom workflow activites, the best place to start is the SDK: http://msdn.microsoft.com/en-us/library/gg509012.aspx
hth,
Scott
Scott Durow
Read my blog: www.develop1.net/public
If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"- Marked As Answer by BusinessWorks Monday, August 13, 2012 2:08 PM
-
Monday, August 13, 2012 2:08 PM
ok thanks Scott, looks a bit over my head unfortunately.
Shame Formula manager hasn't worked for me - I just tried installing the solution again, and it caused a dialog error straight away even though I have no formulas set up. It's a pretty standard dialog, but it gets interrupted halfway through with an unkonwn process error - the error log mentions North52 so it must be interfering somehow which is weird seeing as there are not even any formulas being triggered. Maybe its because we're using an online version of CRM.
I'll mark yours as the answer anyway, until I can get some custom workflows in place I think I'll have to just import/export to get data up to date. A pain, but can't see another way round it
thanks again