- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2024 08:39 PM
hi can anyone help me with the scenario and code for
A related CTASK due date cannot be modified to a date later than the Planned End Date of the related change request record.If attempted, a message should pop up stating, "The CTASK due date is later than the Planned End Date of this change. Please request an update to the CCRF prior to updating the CTASK.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2024 08:57 PM
@raj765_32 Please check if this helps.
(function executeRule(current, previous /*null when async*/) {
// Check if the due date has changed
if (current.due_date.changes()) {
// Get the parent change request
var changeRequest = current.change_request.getRefRecord();
// Compare the due date of the change task with the planned end date of the parent change request
if (current.due_date > changeRequest.planned_end_date) {
current.setAbortAction(true);
gs.addErrorMessage('The CTASK due date is later than the Planned End Date of this change. Please request an update to the CCRF prior to updating the CTASK');
}
}
})(current, previous);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2024 08:47 PM
@raj765_32 You need to create an onBefore Update business rule on the Change Task table with conditions Due date changes. Compare the due date field of the change task with the planned end date field of the parent change request in the script and use current.setAbortAction(true); and gs.addErrorMessage('The CTASK due date is later than the Planned End Date of this change. Please request an update to the CCRF prior to updating the CTASK'); to show the error message.
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2024 08:52 PM
Could you please help me with the script which will be so much helpful

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2024 08:57 PM
@raj765_32 Please check if this helps.
(function executeRule(current, previous /*null when async*/) {
// Check if the due date has changed
if (current.due_date.changes()) {
// Get the parent change request
var changeRequest = current.change_request.getRefRecord();
// Compare the due date of the change task with the planned end date of the parent change request
if (current.due_date > changeRequest.planned_end_date) {
current.setAbortAction(true);
gs.addErrorMessage('The CTASK due date is later than the Planned End Date of this change. Please request an update to the CCRF prior to updating the CTASK');
}
}
})(current, previous);