How to show Popup on change record in 'Service operations workspace'

Mounika Tungala
Mega Guru

I have a custom UI action (button) called 'Create bulk changes' on the change form. So my requirement is to show the popup to mention how many change requests should be created (number) when the user clicks on the 'Create bulk changes' button. I am facing difficulty since I need to implement this in the workspace.

Can someone help me to implement this scenario?

2 ACCEPTED SOLUTIONS

Hi Hemanth,

How can I restrict the user to enter only numeric values in popup? below is my script which is working fine except this numeric value restriction.


UI action:

function commentsDialog() {
    var reason = prompt("Please Enter how many Change Requests should be created");
    if (reason > 5) {
        var msg = 'Maximum limit to create Bulk Change Requests is 5';
        alert(msg);
        return false;
    }
    if (reason != " " && reason <= 5) {
        g_form.setValue('u_create_bulk_changes', reason);  //adding user input to the custom field which is used to create bulk CRs
        gsftSubmit(null,g_form.getFormElement(), 'u_sow_bulk_cr');   
    } else {
        return false;
    }
}
if (typeof window == 'undefined')
    createchangeReq(); 
function createchangeReq() {
   current.update();
var change = new BulkChangeRequestCreation().bulkcr(current);    //calling script include to create CRs
     action.setRedirectURL(current);

View solution in original post

Hi @Mounika Tungala ,

 

You can use regex

after you get the prompt

var onlyNumeric = /^[0-9]*$/; //allow only numeric
    if (!onlyNumeric.test(reason)) {
        alert("Enter only numeric");
    }

 

Accept and hit Helpful if this resolves.

 

Thank you,

Hemanth


Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

View solution in original post

8 REPLIES 8

Hi @Mounika Tungala ,

 

If you just need to ask for how many change records to create and having logic in the UI action to create changes based on the user input, no need of UI pages.

 

Thank you,

Hemanth

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

Hi Hemanth,

How can I restrict the user to enter only numeric values in popup? below is my script which is working fine except this numeric value restriction.


UI action:

function commentsDialog() {
    var reason = prompt("Please Enter how many Change Requests should be created");
    if (reason > 5) {
        var msg = 'Maximum limit to create Bulk Change Requests is 5';
        alert(msg);
        return false;
    }
    if (reason != " " && reason <= 5) {
        g_form.setValue('u_create_bulk_changes', reason);  //adding user input to the custom field which is used to create bulk CRs
        gsftSubmit(null,g_form.getFormElement(), 'u_sow_bulk_cr');   
    } else {
        return false;
    }
}
if (typeof window == 'undefined')
    createchangeReq(); 
function createchangeReq() {
   current.update();
var change = new BulkChangeRequestCreation().bulkcr(current);    //calling script include to create CRs
     action.setRedirectURL(current);

Hi @Mounika Tungala ,

 

You can use regex

after you get the prompt

var onlyNumeric = /^[0-9]*$/; //allow only numeric
    if (!onlyNumeric.test(reason)) {
        alert("Enter only numeric");
    }

 

Accept and hit Helpful if this resolves.

 

Thank you,

Hemanth


Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

Mounika Tungala
Mega Guru

Thank you so much @Hemanth M1 ..Its working now