Service Portal Submit, reuse form inputs, then make small changes and submit again
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2024 12:55 PM
I'm looking for a simple way for someone to fill out and submit a Service Portal Request, then return to the same form again with their form inputs still populated, change something small and then submit again.
Currently, when hitting back after submission of a Service Portal Request, all the fields are blanked out.
I'm wondering if the Submit button on the Service Portal Request for a given request type can be set to act like a "Submit and Stay" so that the form submits and creates the request, but it just returns the form again with the inputs populated, so something can change something small and submit again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2024 02:21 AM
To achieve this, you can use client-side scripting to store the form values in the browser's local storage before the form is submitted. After the form is submitted and the user is redirected back to the form, you can use another client-side script to populate the form fields with the values stored in the local storage. Here are the steps:
1. Create a new UI Script with the following code:
javascript
function storeFormValues() {
var form = g_form.getFormElement();
var inputs = form.elements;
for (var i = 0; i < inputs.length; i++) {
var input = inputs[i];
if (input.type === "text" || input.type === "textarea" || input.type === "select-one") {
localStorage.setItem(input.name, input.value);
}
}
}
function populateFormValues() {
var form = g_form.getFormElement();
var inputs = form.elements;
for (var i = 0; i < inputs.length; i++) {
var input = inputs[i];
if (input.type === "text" || input.type === "textarea" || input.type === "select-one") {
var value = localStorage.getItem(input.name);
if (value) {
input.value = value;
}
}
}
}
2. Create a new UI Action with the following code:
javascript
function onSubmit() {
storeFormValues();
return true;
}
function onLoad() {
populateFormValues();
}
3. Add the UI Action to the form.
4. Test the form by filling out the fields, submitting the form, and then returning to the form.
Please note that this solution only works if the user is using the same browser and has not cleared their local storage. Also, sensitive data should not be stored in the local storage for security reasons.
For ServiceNow Live Classes, Books, Sample Resumes, Interview Questions, CSA Quizzes.
And getting better services's on ServiceNow you can visits our website.
Please visit : https://nowkb.com/home
Our Website :https://nowkb.com/home
nowKB.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2024 08:09 AM
I was afraid that's what you guys were going to say. A nice feature for the future might be...
Two submit buttons. One that says "Submit" and one that says "Submit and bring me back to this page to submit another like it" I'm surprised this isn't a common feature in IT helpdesk apps. I wrote one and it was one of the first things my user community asked for.
Doing this for 26 catalog items is going to be a bridge too far. I was hoping for something out of the box that does this dynamically for any form.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2024 08:11 AM
I'm reluctant to accept as a solution because I'm hoping this influences a change to the app. I would hope others wouldn't be happy that this is the only way to do this. Helpdesk systems do a ton of auditing of work people do to provide metrics to management and sometimes entering those metrics is very painful when you can't do things like this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2024 08:14 AM
Hi @Brian Whyte
You can submit an idea to SN and let see when it covered or build.
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]
****************************************************************************************************************