The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Make checkbox true based on another form's field value

Savvy
Tera Contributor

Hi. I want to make a checkbox "check" true on the incident task form if the category of the incident is "Env" on the incident form.
If someone could help me how can I set a checkbox true based on another form's value.

5 REPLIES 5

Anil Lande
Kilo Patron

Hello,

If you don't mind, can you please share below information?

What have you tried? What is working? What isn't working? Have you tried putting log statements to see where it is reaching ?

Unfortunately, at this point, you may have got requirements and that you've now given to us. Providing solution will resolve your issue but it will not help you to learn.

Thanks,

Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

Community Alums
Not applicable

Hello,

You can write Business Rule on "After" and check "Insert" and "Update" on Incident table.

Condition - Category changes to Env

Script -

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

// Add your code here
var inc = new GlideRecord('incident_task');
inc.addQuery('incident', current.sys_id);
inc.query();
while (inc.next()) {
inc.u_check_box=true; //checkbox name
inc.update();
}


})(current, previous);

 

Thanks
Akshay Kangankar
Please Mark ✅ Correct/helpful, if applicable,

 

Community Alums
Not applicable

Hello,

Did you get chance to look into solution provided by me. Please let me know if you need any help.

If my answer resolved your issue feel free to mark correct as well helpful, so it will be helpful for others looking for similar query.

 

Thanks
Akshay Kangankar

palanikumar
Giga Sage

Hi,

You can create onChange client script on field Category with below code:

function onChange(control, oldValue, newValue, isLoading) {
      if (isLoading || newValue == '') {
              return;
      }
      if (newValue == 'env') { // Replace env with actual value stored in category field
              g_form.setValue('check_box_field', 'true'); // Replace check_box_field with actual field name of Check box
      }
      else { // You can remove else block if you dont want to uncheck if the value is not env
              g_form.setValue('check_box_field', 'false'); // Replace check_box_field with actual field name of Check box
      }
 }
Thank you,
Palani