Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Show alert on click of "approve" action in employee center approvals

mr18
Tera Guru

How can I show alert on click of "approve" action in employee center approvals under My task

13 REPLIES 13

Hello @Community Alums 

I tried the same steps but didn't worked for me. I see some changes in the widget as well. May be we are not on the same version.

Community Alums
Not applicable

Hi @mr18 ,

 

I did it on the newly created PDI in Vancouver. Then you can try debugging by putting logs between the code, for example:

 

+ In the cloned version of 'action_widget':

   - Server script: below this line

if (input.recordNumber.startsWith('RITM')) {

-> gs.info('ESC: ' + input.recordNumber). Evaluate if the approval record is Requested Item.

 

and below:

if (grRITM.cat_item == '039c516237b1300054b6a3549dbe5dfc') {

-> gs.info('ESC1:' + grRITM.cat_item). Evaluate if the catalog item is correct sys_id.

 

  - Client controller:

     + below the line 46 "if (action.clientScript)" -> input "alert('showAlert' + showAlert)". Evaluate if the showAlert is true.

 

Then access to ESC - My tasks choose the correct approval RITM with correct Catalog item, click Approve.

the alert will show first then see above logs in System Log -> All -> Filter Message field startWith 'ESC'

I've tried this and it's working

 

TarunChowdary_0-1744221702459.png

 

HI @TarunChowdary 

Could you please share the code which you modified exactly. If possible, please share the xml