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.

How to put info message on UI Action instead of redirecting to a URL in HR case 'Create Knowledge' b

HARI KISHAN GVS
Mega Sage

Hi Team, 

I created a Ui Action called 'Create Knowledge' on HR Case Table . after clicking the button it redirects to the article URL.

But my customer wants it to stay on the HR case page and display a info message like

"This Knowledge Article:KB00100XX has been saved as a draft and attached to the parent record: HRC000XXX
"Knowledge Article created: KB0010048 based on closure of HR Case: HRC000XXX"
How can i Put those info messages in my UI Action script block on both platform and workspace sides.
HARIKISHANGVS_0-1681215534623.png

so, how to put those info messages instead of redirect URL.

can anyone please sent the code snippet for it.

Thanks in advance.

Hari Kishan.

3 REPLIES 3

AnveshKumar M
Tera Sage
Tera Sage

Hi @HARI KISHAN GVS ,

In your UI Action script just use the following statement in place of your if block for redirecting.

 

gs.addInfoMessage('KB Created');

action.setRedirectURL(current);

 

Thanks,

Anvesh

Thanks,
Anvesh

Hi Anvesh,

Thanks for the input.

But if i don't have redirect url i can't able to save the knowledge record.

so, How can we add some kind of current.insert(); or Update(); to insert the created/opened/redirected article in the system.

and i need the created article number also in the info message.

Thank you,

Hari Kishan.

@HARI KISHAN GVS 

I'm thinking of a Script Include and a function in it to handle the creation of KB Article and return the number/sys_id of the article created.

 

So that we can call it in the UI Action script and use the returned number in displaying info message.

 

Thanks,

Anvesh

Thanks,
Anvesh