Default “Planned Outage” when creating Outage from Change Request

SunilkumarP1632
Tera Contributor

Hi Community,

 

We have a requirement related to Outage creation from Change Request.

 

Requirement:
When an Outage record is created from a Change Request, the Type field should default to "Planned Outage".

 

Current Behavior:
When creating an outage from a Change, the Type field is blank and users have to manually select the value.

 

Expected Behavior:
If the outage is created from a Change Request, the Type field should automatically default to "Planned Outage".


This should not affect outages created independently or from Incidents.

 

 

 

Ask:
What is the recommended and upgrade-safe way to achieve this?

 

Any guidance or best practice suggestions would be appreciated.

SunilkumarP1632_0-1768834114130.png

 

 

please provide configuration steps for this .

Thanks

2 REPLIES 2

Dr Atul G- LNG
Tera Patron

Hi @SunilkumarP1632 

You can use an onLoad client script, but I would not recommend doing that. The reason is that ServiceNow already provides the Open in new selection option, and the same module can be used by Incident as well.

Because of this, you might miss out or run into issues if the type is changed later. It’s better to think through this carefully rather than applying a simple onLoad script as a solution.

*************************************************************************************************************
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/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************

Ankur Bawiskar
Tera Patron

@SunilkumarP1632 

you can use onLoad client script on cmdb_ci_outage table and seeif the task number is CHG or INC

function onLoad() {

    var url = top.location.href;

	// check if new record and record is being created from related list

    if (g_form.isNewRecord() && url.indexOf('sysparm_collection_related_relationship') > -1) {
        var task = g_form.getDisplayBox('task_number').value.toString();
        if (task.startsWith('CHG')) {
            g_form.setValue('type', 'planned');
        }
    }
}

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader