Business rule for clearing a value is not working

Cupcake
Mega Guru
 

I created a catalog item that has a variable called New Information Needed (this variable is a type = Yes/No). That variable is a Yes/No variable type and is REQUIRED. That variable is only visible on Task # 2 in my workflow which has a Rollback activity. So when the wf starts, Task 1 generates. I close complete the task, then Task # 2 generate and the New Information Needed variable is required. When you answer "yes" to that question and then mark the task Closed Complete - the rollback activity kicks in - which will cause Task # 2 to change from a state of Closed Complete to a State = Pending.

What I am looking to do is when that state changes to pending I want to clear the value of "Yes" in that task to "blank". I don't want any value in that field.

Here is my business rule which does not seem to be working:

find_real_file.png

 

find_real_file.png

22 REPLIES 22

Karen,

 

    I was reading through this post and it is something very similar to something I am trying to accomplish.  Can you share what the client script was you used to get this to work?

 

Thank you,

Russell

Hi Russell,

     Here is the client script that I used to get mine working.

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
     if (isLoading || newValue == '') {
          return;
     }

     var item = g_form.getReference('request_item', doItem);
                //var count = mct_counter;

}

     function doItem(item) {
          if (item.cat_item == '476590f76f359300512f5e354b3ee471') { // Sysid of Catalog Item                                                 Name
          if (g_form.getValue('state') == 2 ) {
          if (g_form.getValue('mct_new_info') == 'Yes'){
          g_form.clearValue('variable_name', ''); // This is my Yes / No variable
          g_form.setValue('counter',parseInt(g_form.getValue('mct_counter')) + 1); // This is my                                                    single line text field
          //g_form.setMandatory('trgt_release_date', true);
          //g_form.setMandatory('assign_to', true);
     }
          //else {
          // g_form.setMandatory('type_of_effort', false);
          // g_form.setMandatory('assigned_priority', false);
          // g_form.setMandatory('trgt_release_date', false);
          // g_form.setMandatory('assign_to', false);
     }
     }
}

nilshaug
Tera Contributor

It worked in a Before BR with

 

gr.field = '';

 

I had an issue before, that it didnt reach the statement, so the value was not cleared.