hide values when RITM state is closed complete

sharley
Tera Contributor

Hi,

"When RITM is fully closed, change Requestor Email and Requestor Phone Number to "[PII REDACTED]""

The requestor email and requestor phone number are the variables in the catalog item.

 For this above scenario, we have created the below on_change catalog client script in a catalog item,

"if (state == 3) {
        g_form.setVisible('requestor_email', false);
        g_form.setVisible('requestor_phone_number', false);
    }"

this is not working and not showing any errors.

2 REPLIES 2

Sandeep Rajput
Tera Patron
Tera Patron

@sharley In order to hide the variables requestor_email and requestor_phone_number on the RITM record, you can choose to create a UI Policy on the Catalog Item and apply it on the target record.

 

Screenshot 2023-09-05 at 6.16.01 PM.png

 

 

SwarnadeepNandy
Mega Sage

Hello @sharley,

 

You can hide user information using Client side scripting easily, but as it is PII, client side scripting is not safe. Anyone can easily unravel the information from browser.

 

Best is to put read ACL on RITM when it is closed. Dont provide READ access when the RITM is Closed.

 

OR

 

If you really want to lose the information of the Requestor, then use Business Rule.

Change the requestor email and requestor phone number variables to “[PII REDACTED]” when the RITM is fully closed is to use a business rule on the sc_req_item table that runs on update. The business rule can check the state of the current RITM and update the variables accordingly. Here is an example of how such a business rule might look like:

// Name: Redact PII on RITM close
// Table: Requested Item [sc_req_item]
// When: After
// Update: true
// Filter conditions: State changes to Closed Complete

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

  // Get the requestor email and requestor phone number variables
  var emailVar = current.variables.requestor_email;
  var phoneVar = current.variables.requestor_phone_number;
  
  // Check if they are not empty
  if (emailVar != "" && phoneVar != "") {
    // Set them to [PII REDACTED]
    emailVar.setDisplayValue("[PII REDACTED]");
    phoneVar.setDisplayValue("[PII REDACTED]");
    // Update the current record
    current.update();
  }

})(current, previous);

Hope this helps.

 

Kind Regards,

Swarnadeep Nandy