Data policy

mounika7675
Tera Contributor

Hello family,

 

We have a Data policy written on sysapproval_approver table 

This data policy is for when the approval rejected it will make comments mandatory 

I wanted to exclude this data policy to not to apply for any Requested items(RITMs) that are been created. How can I exclude only Requested items (RITMs) exception for this data policy.IMG_20240625_115434.jpg

4 REPLIES 4

Yashsvi
Kilo Sage

Hi @mounika7675,

please check below link:

https://www.servicenow.com/community/developer-forum/how-can-we-exclude-any-catalog-item-from-recomm...

Thank you, please make helpful if you accept the solution.

Hello @Yashsvi ,

 

I need the data policy to not to work for RITMs only .. how can we only relax this policy for RITMs 

Hi @mounika7675,

To exclude Requested Items (RITMs) from a data policy in ServiceNow, you can modify the conditions of the data policy to ensure it does not apply to records of the type "Requested Item" (sc_req_item). Here are the steps to do this:
your current condition looks something like this:

State is Rejected
Modify it to:

State is Rejected AND Table is not Requested Item [sc_req_item]


By adding this condition, the data policy will not apply to the "Requested Item" table records when their state is "Rejected".

Advanced: Scripted Conditions:
Write the Script:


- Write a script to exclude RITMs

 

 

// Check if the table is 'sc_req_item'
if (current.getTableName() == 'sc_req_item') {
answer = false; // Exclude RITMs
} else {
// Original conditions
answer = current.state == 'rejected';
}

 

 


Save the Data Policy:
- Click "Update" or "Save" to apply the script.
Thank you, please make helpful if you accept the solution.

Jitendra Diwak1
Kilo Sage

Hi @mounika7675,

 

Instead of data policy, can you use existing UI Policy and if it does not exist on your instance then please create this UI Policy below as peer the screenshot:

JitendraDiwak1_0-1719298635625.png

 

Please accept my solution if it works for you and thumps up.

 

Thanks

Jitendra

Please accept my solution if it works for and thumps up.