- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2021 02:18 PM
Hi,
Some one plese help me on below issue.
How to make Planned StartDate / Planned EndDate fields Mandatory when we click on "Request Approval " Button
OR
when we try to approve Change request Operation must be Abort and give warning message like fill Planned StartDate/Enddate don't empty.
OR
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2021 02:03 PM
try now
var gr = new GlideRecord('change_request');
gr.get('sys_id', current.sysapproval);
gs.log('planned start '+ gr.start_date +' == '+ gr.end_date);
if(gr.start_date =='' && gr.end_date==''){
gs.addErrorMessage("Please fill Planned Start Date/ End Date");
current.setAbortAction(true);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2021 01:19 PM
yes Harsha, Correct

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2021 01:23 PM
so In which case , its failing ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2021 01:41 PM
it is failing at Change approval records approve.
if planned start date and End date empty then Approval records should NOT be approve.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2021 01:44 PM
I am assuming you have used business rule for this, if yes please paste your update business rule script here
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2021 01:56 PM
Hi Harsha,
is my script has any issue ?
var gr = new GlideRecord('change_request');
gr.addQuery('sys_id', current.sysapproval);
gr.addQuery('state',-3)
gr.query();
while(gr.next()) {
gr.addEncodedQuery('active=true^type=normal^start_dateISNOTEMPTY^end_dateISNOTEMPTY');
gr.query();
if(gr.next()){
gs.log('Dates updated');
} else {
gs.addErrorMessage("Please fill Planned Start Date/ End Date");
current.setAbortAction(true);
}
}