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

@servicenowExp 

in the UI action you can put the incident sysId in session variable

var session = gs.getSession();
session.putClientData('incidentSysId', current.sys_id);

GlideSession 

Then you can use onLoad client script on your catalog item to get that session variable and put in hidden variable and then set the parent field on REQ.

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

Is it possible to implement it when redirecting to the Service Catalogs page (instead of a specific catalog item)?

@servicenowExp 

for that you might have to add widget on OOT catalog page and handle some logic there.

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

Hi @Ankur Bawiskar 

In my case, it is not possible to write onLoad client scripts in each catalog.

So, will it be possible to set the Parent field of the Request through a Business Rule?

I am actually trying this below BR, but the Parent field is remaining empty.

subhadeep1618_0-1749709106599.png

(function executeRule(current, previous /*null when async*/) {
  // Get the session variable
  var session = gs.getSession();
  var parent_incident = session.getClientData("request_parent_incident");

  //Set the parent
  current.parent = parent_incident;
  //
})(current, previous);

 The following is my UI Action script, it is perfectly redirecting to the Service Portal home page.

But after submission of request, the Parent field is not getting updated.

var session = gs.getSession();
session.putClientData("request_parent_incident", current.sys_id);

function goToServicePortal() {
  var url = "sp";
  window.open(url);
  return false;
}

 It would be great if you can guide me regarding this.

Thanks.


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 business rule to set the parent field

but did you get that session variable value in business rule?

Also I believe the business rule won't be a right place considering there could be requests which might be created directly and not via the UI action.

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