Run business rule after template is applied

xiaix
Tera Guru

Yes, I read this Run Business rule after template is applied   but he/she is not looking to do what I'm looking to do... hence this new post.

I need to detect when a certain template is applied to an Incident form, and then do ... for lack of a better term, stuff to the form (change field values, etc..)

Kinda stuck on how to do this.   Do I apply a BR on the Incident table or the sys_template table?   Or is this "listener" even handled at the BR level at all?

9 REPLIES 9

Mike Allen
Mega Sage

I think you would have a field on the form that holds the template id, and then, you can either say:



Client Script:


onChange of template field, change the fields according to what newValue of that field is



or


Business Rule


before insert, if template field is A:


        current.field = A;


        current.field2 = A2;


else if template field is B:


        current.field = B;


        current.field2 = B2;


Okay, I can see that being a way.



Question though, how does this get triggered?



find_real_file.png



when I click this


find_real_file.png



on an Incident form?




Whatever logic pops up that notification is the same logic I'm looking to tap into.  


Hi David,


I'm looking to do something similar to this. I think what Mike's suggesting is that you would need the new field 'u_template_id' to itself be populated by the application of the template. In other words, part of the template definition would be to set the 'u_template_id' field on the form. That can then trigger its own client script or business rule.



Jamie.


Okay, so I've implemented your advice as such:



New read-only field on Task table:



find_real_file.png




Here's the template:


find_real_file.png




...and here's the error:


find_real_file.png




Why the error??