Affected CIs on Change

stevenm
Kilo Guru

Version Helsinki.

I have a request from my users to enable them to enter as many affected CIs at the beginning of data entry for a Change.   As it is now they enter one CI when initially entering a Change.   They then have to go back into that change to enter multiple Affected CIs in the Related Links section, where the tabs display. Doing all the affected CI entry at the beginning would save some time.  

So I went into the Form Layout of the Change and moved Affected CIs from the left column to the right column to move it onto the Change entry form.  

While this allows them to do what they want here comes the trick.   It allows them to add Affected CIs at any stage of the Change.   How do I turn off the Add function after a specified stage?   It works now such that after New the Edit button is turned off but I can't find where that functionality is nor do I understand if it works for one scenario why it doesn't work for the other.   I can include screen prints if it might help.   Will keep looking.

1 ACCEPTED SOLUTION

The "insert a new row" is based on the user's permissions on that table via ACL's.   So you can modify the create ACL for the task_ci table to accomplish this.   I ran a quick test and it worked based on changing the state:


find_real_file.png



Here is the example script I used:


var answer = true;


if (!gs.nil(current.task)) {


      if (current.task.sys_class_name == "change_request" && current.task.state != 1) {


              answer = false;


      }


}


answer;



Make sure you pay attention if there are multiple create ACL's on this table as you may need to update several ACL's to get this to work.



Please mark this or any post helpful or the correct answer to your question.


View solution in original post

7 REPLIES 7

Michael Ritchie
ServiceNow Employee
ServiceNow Employee

You should be able to configure this via List Control:


http://wiki.servicenow.com/index.php?title=Configuring_Lists#Creating_Advanced_Controls_with_Scripts



You will need to expose the Omit New Condition script field on the form to enter a script, but you can look at the parent record's state to allow new or not.   Same with Edit by exposing the Omit Edit Condition.


LaurentChicoine
Tera Guru

Hi Steve,



Not sure if I fully understand your request. What I understand is that you don't want your users to use the embedded list past a certain stage in your workflow. I see 2 ways of doing it:



  1. Put the Affected CIs embedded list in a section so you can have a client script using conditions to hide the section (using g_form.setSectionDisplay('sectionname', false))
  2. Create two different form layouts (one with the affected CIs in the form, the other without it) and set a view rule to chose to display the affectedCIs in the form or not (however this makes you have to maintain 2 different form layouts)

stevenm
Kilo Guru

I'll attach a screen print.   I think one of the two responses is close.  



The insert a new row is what my users want to disappear when a Change is no longer New.   It looks like Michael's reply would work if I didn't have this thing embedded right in the middle of the form but I'll keep reading.



Affected CIs.jpg


The "insert a new row" is based on the user's permissions on that table via ACL's.   So you can modify the create ACL for the task_ci table to accomplish this.   I ran a quick test and it worked based on changing the state:


find_real_file.png



Here is the example script I used:


var answer = true;


if (!gs.nil(current.task)) {


      if (current.task.sys_class_name == "change_request" && current.task.state != 1) {


              answer = false;


      }


}


answer;



Make sure you pay attention if there are multiple create ACL's on this table as you may need to update several ACL's to get this to work.



Please mark this or any post helpful or the correct answer to your question.