Help trying to get to do action URL

arobertson
Tera Guru

Hi.

 

For a few weeks now we have been stumped technically with a requirement.

 

We are using universal requests to serve up a catalog item on the portal. The problem is that we want to get hold of the record number in order to use it in an onLoad catalog client script.

 

As the URL never changes "https://instancename.service-now.com/sp?id=hrm_todos_page" we are unable to pass/read any parameters for use in our onLoad catalog client script.

 

When I inspect the page, I can see the URL in the console. Is there anyway to get this?

 

I did try the following but it only gave me the cat name sys_id and not the universal task sys_id.

 

var incSysid = g_form.getUniqueValue();
    alert(incSysid);
1 ACCEPTED SOLUTION

arobertson
Tera Guru

Just an update as ServiceNow provided a few recommendations:

 

Here are some recommendations that we can suggest:

Recommendation 1. Retrieving the UNT number from the DOM, since the widget does not change, you can use the widget's sys_id as class name by prefixing v and get the innerText of the DOM element, and parse the text to get the UNT number

Recommendation 2. You can also customize the widget to get the data object from the parent widget and fill the form

Recommendation 3. In this, you can submit the catalog item beforehand when the UNT gets created, and assign a task to the requested user to accept the assets. In this, a task is assigned to the user, and you can create custom actions like "I accept assets" with all variables shown, which can be shown on the task from the RITM for the Todo page.

Docs:

https://www.servicenow.com/docs/bundle/yokohama-employee-service-management/page/product/employee-ce...

 

 

View solution in original post

12 REPLIES 12

@arobertson 

I haven't worked on Universal request.

what type of form is that? Is that a catalog item form?

Did you write onLoad catalog client script and use this to see what came in URL?

var url = top.location.href;
alert(url);

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

Forgetting the universal request and catalog part, I think the issue is the "hrm_todos_page" as even out of the box the URL never changes.

 

Yes, it just prints outs: https://instancename.service-now.com/sp?id=hrm_todos_page

 

I would expect you would get the same as well on the screenshot you posted.

@arobertson 

that's correct, the page URL won't change so you won't get anything in the url in script.

I doubt this will work with the OOTB config.

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

@arobertson , that form loaded on the right side looks like an embedded widget. Try to identify that widget and check the input parameters(most likely sys_id) used to render the form. 

 

Then you can assign the value of that parameter to 

$scope.page.g_scratchpad.<name you desire> in the client controller. You can then try to access this scratchpad variable in your catalog client script.
 
Not sure if this will work but you can try.

Kirby R
Kilo Sage

@arobertson ,

 

Im not sure if i understand correctly, but your requirement is that when you clicked any item from that list it should open the catalog item for that record?