Business rule is not generating the error message but is aborting the action as expected
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2024 12:57 PM
Hello,
I need help with a business rule I created to validate if a person attempt to create a timesheet with the date 30 days in future to abort action from mobile agent. The br is aborting the action as expected but none of the error messages are being displayed. The message I am getting is "no results found".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2024 01:26 PM
Hi @Rhonda9
the logic I have in my business rule for the 'time_sheet' follows:
// Add your code here
var wsoDate = current.week_starts_on;
var curDate = new GlideDate();
curDate.addDays(30);
gs.addInfoMessage('wso date: ' + wsoDate + ' and date limit = ' +curDate);
if (wsoDate > curDate) {
gs.addErrorMessage('You cannot create a time card for a date more than 30 days in the future.');
current.setAbortAction(true); // Abort the insert/update action
}
I hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2024 01:33 PM
Thank you, I am getting the message "the operation couldn't be completed (Agent.NowAPIError error 4"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2024 07:59 AM - edited 11-23-2024 08:00 AM
What I posted works in my PDI, seems your may be in the wrong Application scope. Mine is in Global, the same app scope as 'time_sheet' table. mY BR has a filter contion: 'Week starts on' 'Changes'.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2024 08:15 AM
Yes, I am in the global scope and the same condition. I believe it's something simple that I'm missing.