Business Rule not working with gs.getProperty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2024 02:30 PM
I created a (2) system properties that have a comma separated list of sysIds
I have (2) Business Rules to check if the current risk statement sysId is in the system properties
If it is in the system property set the value of the Risk Domain field to either Compliance or Operational
My info message does return the sysID and the sysId returned is in the correct systemProperty
However, the current.u_risk_domain value is not getting set.
Any ideas what I am missing?
var riskStatement = current.statement.sys_id;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2024 02:41 PM - edited ‎02-23-2024 02:57 PM
Hi @triciav ,
Is the variable statement reference to other table record? If not, then use just current.sys_id.
For checking riskStatement sys_id in the given list, use indexOf() method.
The given If condition is not valid.
Use the below code and test, considering that statement variable has sys_id.
var riskStatement = current.statement.sys_id;
gs.addInfoMessage("Risk Statement "+ riskStatement);
// get compliance sys_id
var compList =gs.getProperty('glide.risk.setdomain.compliance');
// split the sys_id in arrayLisy
var comListArray = compList.split(',');
if (comListArray.indexOf(riskStatement) >-1) {
gs.addErrorMessage("Compliance "+ riskStatement);
current.u_risk_domain = 'Compliance';
}
-Thanks,
AshishKM
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2024 08:49 AM
@triciav , did you get change to review the updated code, let me know if its working for you.
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution