- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2020 05:59 AM
How to hide ui action via business rule
Solved! Go to Solution.
- Labels:
-
Finance Service Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2020 11:20 PM
its fine to have business rule and ui action will also evaluate your business rule script if it will not fulfill your condition.
make sure the business rule order is 100.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2020 07:01 AM
if there is no error message from br and ui action the change request should change to Approval - REQUESTED state
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2020 08:10 AM
Can you please help me to convert below BR to a script include.
/*Normal CRs need to be submitted for approval before Every monday 12:00 PM EST to be part of Tuesday's CAB review.
System should allow requestor to raise a "normal" change only if the below two conditions are met.
(i) Change creation time is before Monday 12:00 PM EST
(ii) Implementation start date is any time after Wednesday 00:00 AM EST
If any of these conditions are not met, then the system should allow them to raise an "Expedited" CR only.*/
function checkDeadline(){
var gdt = new GlideDateTime();
var dayOfWeek = gdt.getDayOfWeekLocalTime(); // Monday = 1
var nowHour = gdt.getLocalTime(); // noon = 12:00:00
var c=nowHour.getByFormat('HH:mm:ss');
//Create the html contents of the information message
var link = '<a href="change_request.do?sys_id=' + current.sys_id + '" class="breadcrumb" >' + current.number + '</a>';
//gs.print(nowHour);
//set the CAB date
var cabDate = new GlideDateTime(); //creates a GlideDateTime object with time set to now
var now = new GlideDateTime(); //creates a GlideDateTime object with time set to now
//if(dayOfWeek < '4' && nowHour <= '12:00:00')
if(dayOfWeek =='7'){ //or this
cabDate.setValue(now.getInternalMidnight(2)); //sets the cabDate to midnight on tuesday (UTC!!!)
cabDate.addSeconds(86398); //modify to 6 hours to push us past midnight local time
current.u_cab_date = cabDate.getValue();
_checkLeadTime();
}
else if (dayOfWeek == '1' && c < '12:00:00')
{
cabDate.setValue(now.getInternalMidnight(2)); //sets the cabDate to midnight on tuesday (UTC!!!)
cabDate.addSeconds(86398); //modify to 6 hours to push us past midnight local time
current.u_cab_date = cabDate.getValue();
_checkLeadTime();
}
else if (dayOfWeek == '1' && c > '12:00:00')
{
cabDate.setValue(now.getInternalMidnight(2)); //sets the cabDate to midnight on tuesday (UTC!!!)
cabDate.addWeeks(1); //of next week
cabDate.addSeconds(86398); //modify to 6 hours to push us past midnight local time
current.u_cab_date = cabDate.getValue();
_checkLeadTime();
}
else if (dayOfWeek == '2' ||'3'||'4'||'5'||'6'){
cabDate.setValue(now.getInternalMidnight(2)); //sets the cabDate to midnight on tuesday (UTC!!!)
cabDate.addWeeks(1); //of next week
cabDate.addSeconds(86398); //modify to 6 hours to push us past midnight local time 43200
current.u_cab_date = cabDate.getValue();
checkLeadTime();
}
}
function _checkLeadTime(){
var startDate = new GlideDateTime(current.start_date); //creates a GlideDateTime object for the Start Date
var cab = new GlideDateTime(current.u_cab_date); //creates a GlideDateTime object for the CAB Date
//gs.addInfoMessage(startDate);
// gs.addInfoMessage(cab);
if(startDate == ''){
current.isAbortAction(false); //if no date entered allow submit
} else if ((startDate.before(cab))&& (current.type=='Comprehensive')){ //check if start_date is before cab_date
gs.addErrorMessage('This change request cannot be submitted as the Provided Start Date is either before the CAB meeting or on the same day as CAB meeting. Please raise an "Expedited" Change"');
current.setAbortAction(true); //if start date before cab date do not allow submit
}
else if ((startDate.after(cab))&& (current.type=='expedited')){ //check if start_date is before cab_date
gs.addErrorMessage('This change request cannot be submitted as it is planned after the CAB meeting. Expedited change request type is only used for changes that are urgent in nature and cannot wait until the next CAB meeting . Please raise a "Normal" Change.');
current.setAbortAction(true); //if start date before cab date do not allow submit
}
}
checkDeadline();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2020 08:28 AM
you can directly use the code in your script include function and there you can access the current object.
make sure your script include should return some output and then validate it over the business rule while executing your script include function.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2020 08:47 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2020 11:20 PM
its fine to have business rule and ui action will also evaluate your business rule script if it will not fulfill your condition.
make sure the business rule order is 100.