Creating outage record: Begin and End dates get cleared as I move cursor out of the duration fields
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2025 07:29 PM
Hi Team ,
can anyone please help me with the below issue .
Creating outage record: Begin and End dates get cleared as I move cursor out of the duration fields. This heavily affects productivity.
Are the duration fields supposed to be entered/calculated manually?
Why are begin & end date values being cleared automatically as you move cursor OUT of any of the duration fields? Is this as designed, and any rationale behind this?
can anyone please provide me the fix for this ,
why this error comes please help me here .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2025 07:49 PM
check this
Setting the Outage Duration field clears the Begin and End dates
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-15-2025 09:01 PM
Thank you for marking my response as helpful.
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-28-2025 12:52 AM
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
01-15-2025 08:39 PM
hi @nameisnani
As per the KB Knowledge document -- this is a Baseline Clinet Script which cause this so you need to modify it (My suggestion first copy it and then do the modifications on your test instance)
Go to System Definition > Client Scripts in your ServiceNow instance.
In the "Table" column, filter for cmdb_ci_outage.
In the "Field name" column, filter for or browse to find entries related to duration or look at scripts with onChange type.
Conditional Logic: Modify the script to include conditional logic (if statements) so that the clearing of begin and end only happens when it's actually required.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
// Only clear begin and end if a certain condition is NOT met
if (!someConditionWhereBeginAndEndShouldBeKept) { // Replace with your actual condition
g_form.clearValue('begin');
g_form.clearValue('end');
}
// ... rest of your script ...
}
where we need to add logic for someConditionWhereBeginAndEndShouldBeKept. The logic will check whether begin and end date should be cleared or not. 
Example: If the fields should only be cleared when the outage type is "Planned," you could add a condition like: if (g_form.getValue('type') != 'Planned') { ... }