- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-31-2024 01:51 PM
When a Change task are created in the change, planned start date and planned end date should be copied from the change and are to be read only.
How can i achieve it through business rules.
Thanks in Advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-01-2025 07:21 PM
This doesn't sound like a valid business requirement as 1 Change can have multiple change tasks
If this requirement is just for your learning purpose then check the details below
you can use before insert BR on change_task table and copy the fields from CHG to Change task
something like this in BR
(function executeRule(current, previous /*null when async*/) {
current.planned_start_date = current.change_request.start_date;
current.planned_end_date = current.change_request.end_date;
})(current, previous);
Also use onLoad client script to make fields as readonly
function onLoad() {
g_form.setReadOnly('planned_start_date', true);
g_form.setReadOnly('planned_end_date', true);
}
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
01-01-2025 01:07 PM
Hi @purnendu
Practically, this is not a valid use case. The reason is that in a change, multiple tasks are created, and it is unrealistic for every task to have the same start and end time as the change itself. The change time represents the total duration for all activities, and assigning identical times to all tasks does not align with process logic.
Additionally, whether tasks are created via a flow (OOTB) or manually is also significant. If they are created through an OOTB flow, you would need to modify the flow to include this condition and make the fields read-only via a UI policy.
However, as a process consultant, I recommend revisiting this requirement, mate, to ensure it aligns with best practices and business needs.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-01-2025 07:21 PM
This doesn't sound like a valid business requirement as 1 Change can have multiple change tasks
If this requirement is just for your learning purpose then check the details below
you can use before insert BR on change_task table and copy the fields from CHG to Change task
something like this in BR
(function executeRule(current, previous /*null when async*/) {
current.planned_start_date = current.change_request.start_date;
current.planned_end_date = current.change_request.end_date;
})(current, previous);
Also use onLoad client script to make fields as readonly
function onLoad() {
g_form.setReadOnly('planned_start_date', true);
g_form.setReadOnly('planned_end_date', true);
}
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
01-02-2025 09:00 PM
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