Setting Template Field Value

NewUser5
Kilo Contributor

Hi, 

I need to setting defalut value for the template field whenever a new template is created.

 I create after update business rule.

(function executeRule(current, previous /*null when async*/) {

if(current.isNewRecord() && current.table=='incident')
current.template('u_template_name_used',current.name);

})(current,previous);

 

This doesnt to set the value after i submit the new template.And also i want the fields to remain set which i have already choose for templae field.

Please help.

Thanks

6 REPLIES 6

Then you must join strings with javascript variables properly with +

current.template = 'u_template_name_used=' + current.name + '^' + current.template;

Thanks a lot ! It works.

can you please help me in one more stuff.. 

Actually i track how many times a template is being used in incident form by using count field. and sort it against count field.

do you have any idea about sorting.As of now i have updated ui macro template_context for this.it sorts but only when i opened the list of template.