- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2023 10:45 PM - edited 11-15-2023 10:46 PM
Hi Experts,
I want to create "Outage" from change record and there is OOTB "Create Outage" UI action available and I want to populate begin date with planned start date and end date with planned end date by onclick on Create Outage.
OOTB Ci, task number and short description are populating from change request, in same way how can I populate begin and end date on outage record.
Create Outage UI action-
Below is OOTB code
createOutageM2M();
function createOutageM2M() {
var url = "cmdb_ci_outage.do?sys_id=-1&sysparm_query=";
url += encodeURIComponent("cmdb_ci=" + current.getValue("cmdb_ci") + "^task_number=" + current.getUniqueValue() + "^short_description=" + current.getValue("short_description") + "^EQ");
action.setRedirectURL(url);
Thanks in Advance,
NS
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2023 11:10 PM - edited 11-15-2023 11:25 PM
Hi @NS16 ,
createOutageM2M();
function createOutageM2M() {
var url = "cmdb_ci_outage.do?sys_id=-1&sysparm_query=";
url += encodeURIComponent("cmdb_ci=" + current.getValue("cmdb_ci") + "^task_number=" + current.getUniqueValue() + "^short_description=" + current.getValue("short_description") + "^begin=" + current.getValue("start_date") + "^end=" + current.getValue("end_date") + "^EQ");
action.setRedirectURL(url);
action.setReturnURL(current);
}
Use above script its working in my pdi
Please mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2023 11:10 PM - edited 11-15-2023 11:25 PM
Hi @NS16 ,
createOutageM2M();
function createOutageM2M() {
var url = "cmdb_ci_outage.do?sys_id=-1&sysparm_query=";
url += encodeURIComponent("cmdb_ci=" + current.getValue("cmdb_ci") + "^task_number=" + current.getUniqueValue() + "^short_description=" + current.getValue("short_description") + "^begin=" + current.getValue("start_date") + "^end=" + current.getValue("end_date") + "^EQ");
action.setRedirectURL(url);
action.setReturnURL(current);
}
Use above script its working in my pdi
Please mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2023 11:15 PM
Hi @NS16
Try this
createOutageM2M();
function createOutageM2M() {
var url = "cmdb_ci_outage.do?sys_id=-1&sysparm_query=";
url += encodeURIComponent("cmdb_ci=" + current.getValue("cmdb_ci") + "^task_number=" + current.getUniqueValue() + "^short_description=" + current.getValue("short_description") + "^begin=" + current.getValue("start_date") + "^end=" + current.getValue("end_date") + "^EQ");
action.setRedirectURL(url);
action.setReturnURL(current);
}
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 03:40 AM
Hi @NS16
I am happy you accepted the solution , but i have another thought. Don't populate the outage start / end with change start /date the reason begin,
- A change duration including pre requisite task / actual deployment/ testing task as well.
- If you populate the change time to outage , means you are marking your app down / not available for whole duration which may be a case for every change.
Instead of this, put validation on Outage start date not less that plan start and can be grater than the plan end date.
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]
****************************************************************************************************************