Background Script Prompts?

vstefano
Giga Contributor

Is there a way that you can prompt for input on background scripts?

I've been making a few maintenance scripts for when a few issues come up and I'd like to save them for future admins to run so that they can be run from the background script screen but they require data values to be changed. For example if, there is an off chance that there are 1000+ children incidents we have business rules that run on them when the parent is updated but it needs the incident number. If the script is saved with a static value, it becomes pretty useless...

1 ACCEPTED SOLUTION

Michael Ritchie
ServiceNow Employee
ServiceNow Employee

Unfortunately this is not possible for a background script, but Record Producers are an option for you.



You can create a record producer with a variable to prompt for the incident number and then the record producer script can take that variable input and run the script.



Please mark this post helpful or correct if applicable.


View solution in original post

5 REPLIES 5

Michael Ritchie
ServiceNow Employee
ServiceNow Employee

Unfortunately this is not possible for a background script, but Record Producers are an option for you.



You can create a record producer with a variable to prompt for the incident number and then the record producer script can take that variable input and run the script.



Please mark this post helpful or correct if applicable.


Thanks Michael. Good to know that there is a way around it. At the moment, not going to dive too deep into that solution but certainly helpful to know.



Cheers!


Record producers are really one of the only options I can think of to easily meet your requirement, especially one that is user friendly.   Remember you can restrict access to record producers via User Criteria to only those individuals who need to run it.



The only other idea is to have a Fix Script or background script that has a variable declaration at the top that your user needs to fill in that is referenced in the script below it.   But if they save the script with that variable set to an incident number and they forget to edit it then they will rerun it for that old incident.   The record producer solution prevents this from happening.



What are your concerns with the record producer solution?


No huge concern other than time at the moment. Currently don't have the time to delve into it to actually solution it out. Our team/myself hasn't worked all too much with record producers yet to see how we would do this. Will likely circle back around and try this at a later date when time allows.