Popup the message according to the freeze period dates in change request
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2024 11:21 PM
Hi all, I have a requirement on the change request. There are couple of freeze period dates and if the change request is raised with the type as Normal or emergency or urgent, the planned date and end dates are given with in the freeze period then a popup message should come up like " you are attempting to implement this change in freeze period. Please provide justification in the business justification field." Can anyone please help me with this. Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2024 11:25 PM
Hi Akila,
You can achieve this using Client Script as follows:
function onSubmit() {
var plannedDate = g_form.getValue('planned_start_date');
var endDate = g_form.getValue('planned_end_date');
var changeType = g_form.getValue('change_type');
var freezeStartDate = new Date('YYYY-MM-DD'); // Start of freeze period
var freezeEndDate = new Date('YYYY-MM-DD'); // End of freeze period
var plannedStart = new Date(plannedDate);
var plannedEnd = new Date(endDate);
if (changeType === 'Normal' || changeType === 'Emergency' || changeType === 'Urgent') {
if ((plannedStart >= freezeStartDate && plannedStart <= freezeEndDate) ||
(plannedEnd >= freezeStartDate && plannedEnd <= freezeEndDate) ||
(plannedStart <= freezeStartDate && plannedEnd >= freezeEndDate)) {
alert("You are attempting to implement this change in freeze period. Please provide justification in the business justification field.");
g_form.setFocus('business_justification'); // Adjust field name as necessary
return false;
}
}
return true;
}
If my response proves useful, please mark it "Accept as Solution" and "Helpful". This action benefits both the community and me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-23-2024 03:08 AM
Hi Akash,
Thanks for your response. But it is not working. i have around 10 freeze period dates. I have used a script include and client script to acheive this. Not sure where it was wrong.
Script include :