Can someone please let me know where to configure the URL structure to pass in portal?

klavan32
Tera Contributor

Hi All, 

 

we have a widget in portal where it shows all closed tickets raised by us, if we click on one of the record , it gets opened and shows the record history.

Here, we are passing the URL dynamically with sys_id, table name and id.

Can someone please let me know where to configure the URL structure that picks up the required parameters from server script and pass the URL dynamically? 

2 REPLIES 2

Daniel Sosa
Tera Contributor

Hi @klavan32  i share you common implementations

Option 1: Directly in the Widget HTML Template

<a ng-href="/ticket/{{::item.sys_id}}">{{::item.number}}</a>
 

Option 2: In the Widget Client Controller

$scope.openTicket = function(sys_id) {
  window.location.href = '/ticket?id=' + sys_id;
};

Option 3: Using URL Properties in Server Script

 
data.tickets.forEach(function(ticket) {
  ticket.url = '/incident?id=' + ticket.sys_id;
});

Recommendations

  1. Check these locations in your widget:

    • Client script (Controller)

    • HTML template

    • Server script

    • Link function (if present)

  2. For dynamic URL construction, you'll typically see code like:

 
var url = '/nav_to.do?uri=' + table + '.do?sys_id=' + sys_id;
  1. If using the ServiceNow URL structure, it's often:

 
/now/nav/ui/classic/params/target/incident.do%3Fsys_id%3Dabc123

Shree_G
Mega Sage

Hello @klavan32 ,

 

These options are configured when you create a list widget. To know the options follow below steps:

 

1. Open the Portal

2. Ctrl+Right click on the list header.

3. Choose "Instance options"

ShirishGhule1_0-1743065851617.png

 

4. Here you will find the required details configured such as Table, Filter etc.

ShirishGhule1_1-1743065967589.png

 

Hope this resolves your query. Please mark helpful or correct to assist others in finding the solution to similar concerns.