SCTASK Variables editable by only 1 group OR only while Task is open

Megan C
Kilo Expert

We have a catalog item where the first SCTASK assigned needs to have 3 fields editable (the rest of ours default to read only).  When the task is closed (Or for anyone not in the 1st SCTASK assignment group) those fields should no longer be editable.  I have the UI policy setup to make these 3 fields editable on the task, but can't figure out how to make the fields read only again when the task is closed.

1 ACCEPTED SOLUTION

Megan C
Kilo Expert

Unfortunately the answers above didn't work for us, but we were able to make it work by doing this:

  1. Add a Yes/No variable on the catalog item
  2. Create a Catalog UI Policy on the catalog item to Hide the Yes/No variable
    1. Applies on a Catalog Item view
    2. Applies on Requested Items
    3. On Load
    4. Reverse if false
    5. UNCHECK Applies on Catalog Tasks
    6. Add Yes/No variable to the Actions
      1. Mandatory - Leave alone
      2. Visible - False
      3. Read Only - Leave Alone
  3. Create another Catalog UI Policy to Show the variables that need to be edited during the task
    1. Applies on Catalog Tasks
    2. On Load
    3. Reverse if False
    4. UNCHECK Applies on a Catalog Item view and
    5. UNCHECK Applies on Requested Items
    6. Add the Policy Actions needed for any variables marking the Read Only field False
  4. Create a Catalog Client Script to make the variables editable only by specific group
    1. Assignment group is the sys id for the group
    2. ops variable indicator is the name of the Yes/No field we created


    3. function onLoad() {

      // Business Office Physical Services
      if(g_form.getValue('assignment_group') == 'a4789e8c1b04a01043770ed7cc4bcb8e') {
      /*g_form.setReadOnly('transfer_date', false);
      g_form.setReadOnly('old_workstation_number', false);
      g_form.setReadOnly('new_workstation_number', false);*/

      g_form.setValue('ops_variable_indicator', 'Yes');
      g_form.setDisplay('ops_variable_indicator', false);

      } else {
      g_form.setValue('ops_variable_indicator', 'No');
      g_form.setDisplay('ops_variable_indicator', false);
      }


      }

View solution in original post

5 REPLIES 5

Ashley Snyder1
Giga Guru

Sounds like you need to create a Catalog Client Script to trigger off some key identifier of the task, i.e. short description, etc. and get the state of the task to make the variables read only or not.  You may be able to do this with the script functionality within Catalog UI Policies.  OOTB Catalog Client Scripts and OOTB UI Policies cannot look for specific tasks within the conditions (I wish they could!). 

SanjivMeher
Kilo Patron
Kilo Patron

It is going to be difficult. Because you need to identify if the first task is closed or not. 

You may try using an onLoad Client script on Catalog Task table and make a call to GlideAjax to identify if the first task is closed and make it read only.

 


Please mark this response as correct or helpful if it assisted you with your question.

Shivani Singh1
Tera Guru

Hi Megan,

An ACL for this requirement might suffice keeping an assumption that "Short description" field of the first task is not same with other tasks of catalog item.

ACL on sc_task.<fieldname>.write

if(current.request_item.cat_item == "<catalog item name>" && current.short_description =="<unique short description of 1st task>"){

if(gs.getUser().isMemberOf('<group name>') && current.state != "closed")

answer = true

else

answer = false;

}

In case, there is an issue with uniqueness of task short description then create a checkbox on sc_task saying "First Task" and make it true in defining true in workflow for 1st task

ACL changes as

if(current.request_item.cat_item == "<catalog item name>" && current.u_first_task== "true"){

if(gs.getUser().isMemberOf('<group name>') && current.state != "closed")

answer = true

else

answer = false;

}

Please mark helpful if it solves the purpose

Hi Megan,

Did provided solution resolve the issue?