Hide State options on OnCell edit šŸ¤·ā€ā™‚ļø

Luis Roman1
Tera Contributor

I have a requirement to hide "Closed Skipped" and Closed Incomplete" options on an SCTASK List View (see picture below) when the "State" field is selected for update.

Is that possible using an OnCell Script? What is your suggestion to fulfill the requirement? 

Or should I prevent the state field from being update using an ACL? However, not sure that I have the knowledge to do create the ACL for that particular Catalog item that generated the SCTASK.  Therefore, your guidance and assistance will be appreciated.  I am using my PDI instance with Tokyo release.

LuisRoman1_0-1677226362433.png

 

1 ACCEPTED SOLUTION

Sai Kumar B
Mega Sage
Mega Sage

@Luis Roman1 

You can't hide using onCellEdit() but you can restrict selecting them. try the following code, Also if possible try the list_edit  ACL as well.

function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
  var saveAndClose = true;
  if (newValue == 'state_1' || newValue == 'state_2') //Pass the state values
  {
  alert('Cannot move back to Closed complete/Closed skipped state');
  saveAndClose = false;
  }
callback(saveAndClose);
}


If I could help you with my response you can mark it as helpful and correct as it benefits future viewers
Thanks,
Sai Kumar B
Community Rising Star 2023 & 2022

 

View solution in original post

4 REPLIES 4

Sai Kumar B
Mega Sage
Mega Sage

@Luis Roman1 

You can't hide using onCellEdit() but you can restrict selecting them. try the following code, Also if possible try the list_edit  ACL as well.

function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
  var saveAndClose = true;
  if (newValue == 'state_1' || newValue == 'state_2') //Pass the state values
  {
  alert('Cannot move back to Closed complete/Closed skipped state');
  saveAndClose = false;
  }
callback(saveAndClose);
}


If I could help you with my response you can mark it as helpful and correct as it benefits future viewers
Thanks,
Sai Kumar B
Community Rising Star 2023 & 2022

 

Sai, where do I go to add the onCellEdit script? Also, does this script apply to all SCTASK on the Global Scope? The requirement is to apply the script only to specific Catalog item. Is that possible? Thank you for the collaboration and assistance. Also, where should I go to see the "list_edit" ACL?

@Luis Roman1 

  1. Yes, The script applies to all SCTASKS in List view in the Global scope
  2. You can apply conditions in the script, the above script I shared is a sample one
  3. You can create list_edit acl in the Access security control module in the Application navigator, You can refer to the OOB ACLs and create one as per your requirement

Aniket Gaurikar
Tera Contributor

@Sai Kumar B If want to hide the option for a particular field like it should not be visible in list view also.

Then what steps I have to follow for ?