preventing a new child task if a field on parent not entered

patricklatella
Mega Sage

Hi all,

I've got a scoped app I've built that has a parent table (extended from Task), that has a related list to a 2nd child table (also extended from Task).

I need to have ability to create a "Task" from the related list be blocked if one of the fields on the parent record is empty.

Anyone tried this before?   thanks!

find_real_file.png

1 ACCEPTED SOLUTION

Sorry should have provided more, so


  • Right click on your related list and choose configure list control.
  • Add the omit new condition field to your form
  • Enter the appropriate condition where parent is the "parent" table.   Below is an example where I hide the new button when the parent record's status is not 1


var answer;


if (parent.state == 1 ) {


      //Do not remove the 'New' button


      answer = false;


}


else {


      //Remove the 'New' button


      answer = true;


}


answer;


View solution in original post

10 REPLIES 10

sachin_namjoshi
Kilo Patron
Kilo Patron

You can control this using create ACL on EHS task table.



Regards,


Sachin


patricklatella
Mega Sage

hi Sachin,


thanks for the reply.   So can I just add the condition to the existing default access control for "create" on the EHS Tasks table?


Michael Ritchie
ServiceNow Employee
ServiceNow Employee

Patrick, the best way to handle this is via list control conditions:


Advanced list control with scripts



Now its important to note that the "Omit New Condition" field is NOT on the list control form out of the box.   You need to configure the form layout to add it.


Sorry should have provided more, so


  • Right click on your related list and choose configure list control.
  • Add the omit new condition field to your form
  • Enter the appropriate condition where parent is the "parent" table.   Below is an example where I hide the new button when the parent record's status is not 1


var answer;


if (parent.state == 1 ) {


      //Do not remove the 'New' button


      answer = false;


}


else {


      //Remove the 'New' button


      answer = true;


}


answer;