Create Request UI Action in Incident does not set parent incident when redirected to Service Portal

servicenowExp
Tera Contributor

Hi All,

I have a requirement where, from an Incident form, I need to redirect users to the Service Portal catalogs page using  Create Request UI Action. The goal is to have the resulting Service Request record capture the Incident as its parent.

I’ve modified the UI Action so that it redirects to the Service Catalogs in the Service Portal. However, when the request is submitted from the portal, the parent Incident is not getting set. This seems to work when using the native UI, but not when redirected to the portal.

How can I ensure the parent Incident relationship is retained when redirecting to the Service Portal? Is there a supported way to pass and capture this context?
@Ankur Bawiskar 

Appreciate any help or guidance.
Thanks!

13 REPLIES 13

@Ankur Bawiskar 

The BR is able to read the session data only if the portal opens through the UI action's server side script. That is: 

var session = gs.getSession();
session.putClientData("incidentSysId", current.sys_id);
action.setRedirectURL("sp"); //open service portal home page

But the moment I use client side onClick function to open service portal (as shared in my earlier UI action script), then BR is not able to read session attribute.

Is this the normal behavior? Or, am I missing something?


Please mark this post as a solution and also as helpful, if this resolves your issue or query.

Thanks,
Subhadeep Ghosh.

@servicenowExp and @Ankur Bawiskar 

With the last posted UI action code, everything is working perfectly along with the sc_request 'Before Insert' BR.

The only issue is on clicking "Create Request" - I'm seeing 2 headers, which is quite obvious because server-side UI action is redirecting to portal home page and the window/frame remains the same (screenshot given below).

 

So, if we can solve this piece of the puzzle, we will get the perfect solution.

Basically we need portal home page to open in a separate window or tab, that's it.

I'll try to research more on this, and get back to this thread.

 

subhadeep1618_0-1749716313736.png

 


Please mark this post as a solution and also as helpful, if this resolves your issue or query.

Thanks,
Subhadeep Ghosh.

@subhadeep1618 

you can use onclick and open in same tab and just before redirection use GlideAjax to set the session variable in server side code

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

@subhadeep1618 

what's your final UI action script as you are using gs object and also window object both?

Onclick means the code should be client side and gs object won't work in client side as it's a server side object.

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