Create pop up when employee relation case changes to close complete in the HR agent Workspace

Apaul
Tera Contributor

I have a requirement, when HR agent changes ER state to close complete, at that time a pop up should be populated with some dropdown and a worknote. This also consists two button, cancel and okay. if click Okay, case should be closed, if cancel, case should not be closed.

To achieve this,  Do you have any reference how to achieve this? Is ui builder needed as i think i need modals to create this.

2 ACCEPTED SOLUTIONS

ChiranjeeviR
Kilo Sage

Hi @Apaul ,

 

since you highlighted this is required in the workspace

Here is the step by step solution

 

step1: use UI Builder

you need UI builder in workspace because

1. Classic GlideModal/Client scripts don't work in workspace

2.UI Interactions must be done using Modal components + event handlers

 

step2: open UI Builder

1.select workspace experience (eg. HR Agent workspace)

2.go to the page view for employee relation case record

3.add custom modal component with:

    drop down(select component)

     worknote(TextArea component)

     Buttons "OK" and "Cancel"

 

step3: Trigger modal on state change

1. use a "Client State Handler" to detect when the stat is set to "Close Complete"

2. use "Show Modal" event to open your modal

 

Step4: add Logic to Buttons

1. Ok Button: 

          Validate inputs.

           set Value back to "state= close complete"

           set Dropdown & worknote via Data broker or script include

2. Cancel button:

          Reset state to previous state

          Close modal

 

Testing :

1. change case state to "close complete"

 go to HR Agent workspace-> open an Employee Relations (ER) case -> try changing the state field to "close complete" 

Please mark as Correct Answer/Helpful, if applicable.

ServiceNow Developer
Thanks & Regards,
Chiranjeevi
ServiceNow Developer | | ITSM | | ServiceNow Discovery | | Event Management | | Service Mapping | | CMDB

Please mark as Correct Answer/Helpful, if applicable.

View solution in original post

@Apaul 

you can use onChange client script and use g_modal and then show the input box and it has the buttons.

check how it can be done here

Using Modal Windows in ServiceNow UI Actions 

How to use UI Actions in Workspaces - ServiceNow Community

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

View solution in original post

5 REPLIES 5

ChiranjeeviR
Kilo Sage

Hi @Apaul ,

 

since you highlighted this is required in the workspace

Here is the step by step solution

 

step1: use UI Builder

you need UI builder in workspace because

1. Classic GlideModal/Client scripts don't work in workspace

2.UI Interactions must be done using Modal components + event handlers

 

step2: open UI Builder

1.select workspace experience (eg. HR Agent workspace)

2.go to the page view for employee relation case record

3.add custom modal component with:

    drop down(select component)

     worknote(TextArea component)

     Buttons "OK" and "Cancel"

 

step3: Trigger modal on state change

1. use a "Client State Handler" to detect when the stat is set to "Close Complete"

2. use "Show Modal" event to open your modal

 

Step4: add Logic to Buttons

1. Ok Button: 

          Validate inputs.

           set Value back to "state= close complete"

           set Dropdown & worknote via Data broker or script include

2. Cancel button:

          Reset state to previous state

          Close modal

 

Testing :

1. change case state to "close complete"

 go to HR Agent workspace-> open an Employee Relations (ER) case -> try changing the state field to "close complete" 

Please mark as Correct Answer/Helpful, if applicable.

ServiceNow Developer
Thanks & Regards,
Chiranjeevi
ServiceNow Developer | | ITSM | | ServiceNow Discovery | | Event Management | | Service Mapping | | CMDB

Please mark as Correct Answer/Helpful, if applicable.