Compare date fields.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I have one date field on “dmn_demand” table and other on “dmn_demand_task” table.
The field “Planned Start Date” on Demand table should not be after “Due date” on Demand Task table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
@Taaha M , Have you tried implementing solution I have posted? Where are you stuck now?
If this solution helped you Please Mark this solution as accepted and helpful as it will be helpful for other users as well.
Best Regards.
Saurabh V.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hey @Taaha M , Try this below business rule for your requirement,
When to run - before insert and update
(function executeRule(current, previous /*null when async*/) {
// Only check if Planned Start Date has a value
if (gs.nil(current.planned_start_date)) {
return;
}
var taskGR = new GlideRecord("dmn_demand_task");
taskGR.addQuery("demand", current.sys_id);
taskGR.query();
while (taskGR.next()) {
if (!gs.nil(taskGR.due_date) && current.planned_start_date > taskGR.due_date) {
gs.addErrorMessage("Planned Start Date on Demand cannot be after the Due Date of associated Demand Task(s).");
current.setAbortAction(true);
break;
}
}
})(current, previous);
If this solution helped you Please Mark this solution as accepted and helpful as it will be helpful for other users as well.
Best Regards.
Saurabh V.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@Taaha M , Hope you are doing well, Did my reply answer your question? Where are you stuck now?
If this solution helped you Please Mark this solution as accepted and helpful as it will be helpful for other users as well.
Best Regards.
Saurabh V.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Taaha M , Did my answer helped you in completing your requirement?
If my answers given earlier were helpful then Please Mark this solution as accepted and helpful as it will be helpful for other users as well.
Best Regards.
Saurabh V.