The CreatorCon Call for Content is officially open! Get started here.

How to override the change template value populated on change form based on some condition

Saranya2
Tera Contributor

Hi All,

- We have a catalog item, once we have closed the sc task, it will create change request and the values are populated from the template.

- This configuration I have made in workflow. I want to modify the assignment group which is populated from the template based on the catalog variable value.

- we have a variable (Yes/No) in catalog item, If Yes is selected then I need to populate assignment group as "xyz". If No is selected then It should populate assignment group from the template.

- I don't want to remove the assignment group from template, Is there any other way to achieve this?

I have tried as below, it is not working

 

var template = new GlideRecord('std_change_record_producer');
if (template.get(gs.getProperty('sys_id.changetemplate'))) {  
   chg.std_change_producer_version = template.current_version;
  if (current.variables.var_name == 'Yes'){
    chg.assignment_group = workflow.scratchpad.chginfoecGrp  ;
  gs.log("change ass grp"+chg.assignment_group);
  }
}

 

Thanks,

Saranya.

 

 

 

2 REPLIES 2

Tushar
Kilo Sage
Kilo Sage

Hi @Saranya2 

 

Can you please try with below updated script -

 

var template = new GlideRecord('std_change_record_producer');
if (template.get(gs.getProperty('sys_id.changetemplate'))) {
  chg.std_change_producer_version = template.current_version;
  var var_name = current.variables.var_name;
  var assignment_group;
  if (var_name == 'Yes') {
    assignment_group = workflow.scratchpad.chginfoecGrp;
  } else {
    assignment_group = template.assignment_group;
  }
  chg.assignment_group = assignment_group;
}

 

Please, don't forget to mark my answer as correct if it solves your issue or mark it as helpful if it is relevant for you!

Regards,
Tushar

Hi Tushar,

I have tried the code you given. It is not working.. again it is applying template value only..

Thanks,

Saranya