Business Rule should run only when the user is logged in
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2024 11:36 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2024 11:43 PM
Please elaborate. What is your BR doing? What is the trigger? On what table is it running?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2024 12:56 AM
Hello @Mark Manders ,
we have one existing br on the cmdb_ci table, which prevents duplication of record creation.
table - cmdb_ci
before insert.
script :
(function executeRule(current, previous /*null when async*/ ) {
var nodup = new GlideRecord('cmdb_ci');
nodup.addQuery('name=' + current.name);
nodup.query();
if (nodup.next()) {
gs.addErrorMessage("This will create a duplicate record,so insertion is aborted");
current.setAbortAction(true);
}
})(current, previous);
the aks is, run this br only when logged in user creates new record and one more thing we exclude for DISCOVERY, JAMF and SCCM integration.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2024 01:06 AM - edited ‎02-08-2024 01:13 AM
@Sonu Parab , In the filter condition add created by is not with your integration profile and in the script condition add below piece
gs.getSession().isLoggedIn()&& current. isNewRecord()Regards,
shyamkumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2024 02:19 AM
Hello @Sonu Parab,
BR will run explicitly on insert of cmdb_ci record. Hence by any source, as soon as record inserts, BR will run. hence your ask is already getting fulfilled here. I don't think you need more things to do in this case.
Please mark solution correct and helpful if this reply satisfies your query.
Thank You,
Rajesh