How to create a user input pop up window?

omsa1
Kilo Guru

Hi All,

I have a requirement when a HRcase reopened,   user have to enter reason for reopening the case. When user click on "Reopen case" UI action it should pop up a window for user to enter reason for reopening (should have an "ok" or "cancel" button in that window) and when user click ok it should check if the input box is empty and add that comment into Comment field , change the case state to work in progress and save. if user click cancel then it should return to current page. Comment shouldn't be empty.

21 REPLIES 21

nayanawadhiya1
Kilo Sage

Hi Nayan,



I tried this, and the pop up box is too small until i couldn't enter anything in the input field and when i click "ok" nothing happen. Is there any way to make thye pop up box bigger?



find_real_file.png


Hi Sarasaamani,



you could use prompt box given by javascript itself as suggested by me in earlier comment which contains long input text field.



screenshot below



promptbox.JPG



Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur


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

Hi Ankur,



its showing the pop up box but its not changing the state or updating reason in the description field after i click ok.



Is there anything wrong with my script?



find_real_file.png



function commentsDialog() {


   


  var reason = prompt("Please enter reason for reopening this case");



if (reason != null){


new StateFlow().processFlow(current, 'c77bfec04f682200143327201310c7d7', 'manual');


current.state = '18';


g_form.setValue("decription", reason);


current.update();


action.setRedirectURL(current);



  }



  return false;


   


  }


Hi Sarasaamani,



You are using prompt box which is client side and the below code is server side so it won't work.


You get the value from prompt box, send the reason and record sys id to script include and update the record in that script.


when you get the response from GlideAjax stay on the form. no need to use redirect etc.


Try using below or else follow above approach


g_form.setValue('reason',reason);


g_form.save()




Regards


Ankur


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