3

Is there any common URL to navigate to serviceNow portal with number (INC/REQ/CHG)?

I have an common URL (INC/REQ/CHG) which can be navigated to ServiceNow portal by sys_id:

https://XXXXdev.service-now.com/nav_to.do?uri=task.do?sys_id=XXXXXXXXXXXXXXXXXXXXX

I have tried below URLs for incident but it is creating a new record

XXXXdev.service-now.com/nav_to.do?uri=incident.do?sysparm_order=INC0XXX

OR

XXXXdev.service-now.com/nav_to.do?uri=incident.do?number=INC00XXXX

No problem if there are different URLs for INC, REQ or CHG, I want a URL to see record by giving a number but not with sys_id.

Gibolt
  • 42,564
  • 15
  • 187
  • 127
Rahul Davis
  • 31
  • 1
  • 1
  • 4
  • I have got for INC XXXdev.service-now.com/nav_to.do?uri=incident.do?sysparm_query=number=INC001XX – Rahul Davis Jul 11 '17 at 07:46
  • 2
    Answers : Incident :https://iXXX.service-now.com/incident.do?sys_id=INC0010910 request item : https://XXX.service-now.com/sc_req_item.do?sys_id=RITM0010372 change : https://XXX.service-now.com/change_request.do?sys_id=CHG0030673 – Rahul Davis Jul 12 '17 at 11:40
  • also request item : XXX.service-now.com/task.do?sys_id=RITM0010372 – Dragos Durlut Feb 12 '19 at 08:45

4 Answers4

6

From what you have described I believe you want:

https://[instance].service-now.com/incident.do?sysparm_query=number=INC1234567
https://[instance].service-now.com/sc_request.do?sysparm_query=number=REQ1234567
https://[instance].service-now.com/change_request.do?sysparm_query=number=CHG1234567

Or the catch all

https://[instance].service-now.com/task.do?sysparm_query=number=INC1234567
https://[instance].service-now.com/task.do?sysparm_query=number=REQ1234567
https://[instance].service-now.com/task.do?sysparm_query=number=CHG1234567

(see https://docs.servicenow.com/bundle/helsinki-servicenow-platform/page/use/navigation/concept/c_NavigatingByURL.html)

If you want to keep the outer frames of SN then use the nav_to.do?uri= version e.g.

https://[instance].service-now.com/nav_to.do?uri=sc_request.do?sysparm_query=number=REQ1234567

which is what @kirk has described.

northern-bradley
  • 907
  • 8
  • 11
0

You have a couple of options depending on what you're trying to do exactly.

Email

If you're trying to send this link in an email notification, you can use ${URI_REF} for the table that the notification is generated on.

This will automatically generate a link to the record.

You can also dot walk to another table, for example

  • Catalog Task up to the Requested Item ${request_item.URI_REF}
  • Current task up top the parent record ${parent.URI_REF}

Calculated

If you are looking to generate this based on some calculated method you can do this with the table name and the record number.

https://instance.service-now.com/nav_to.do?uri=/table_name.do?sysparm_que‌​ry=number=RECORD_NUMBER

For instance for a Change record with record number CHG0000123

https://instance.service-now.com/nav_to.do?uri=/change.do?sysparm_que‌​ry=number=CHG0000123

You may also reference a record by using a parent table, though this is more for an interesting note rather than a good practice. INC, REQ, and CHG all inherit from the Task table so you could do this.

https://instance.service-now.com/nav_to.do?uri=/task.do?sysparm_que‌​ry=number=CHG0000123

The drawback to using the parent table is that it won't have all fields and won't have the proper form layout. Mostly just an interesting exercise.

You may also leverage the text search and the system will pull up a record that matches the record number.

https://instance.service-now.com/nav_to.do?uri=/textsearch.do?sysparm_que‌​ry=number=CHG0000123

Note that this works out of the box and you could have configured search to not behave that way.

Business Rule

Another method inside of a Business Rule is to use the current.getLink() method. This will return a URL to the record. If you would like to add to a journal entry, you could use this

var currentLink = "[code]<a href='" + current.getLink() + "'>" + current.number + "</a>[/code]";
var journal = gs.getMessage("The new record is {0}", [currentLink]);
gr.work_notes = journalEntry;
Kirk
  • 16,182
  • 20
  • 80
  • 112
0

Your initial URI will actually work with a NUMBER (like INC000001), assuming that number is actually the display field for the table (as it is by default):

https://XXXX.service-now.com/incident.do?sys_id=NUMBER

When you do a sys_id= lookup, we first lookup by the sys_id column. If it's not found there, we try a lookup on the display value (number), which will load the form exactly as you expect.

Joey
  • 2,901
  • 21
  • 22
  • Thanks for the logic with incident with that i have just tried this Incident XXX.service-now.com/incident.do?sys_id=INC0010910 request item :XXX.service-now.com/sc_req_item.do?sys_id=RITM0010372 change : XXX.service-now.com/change_request.do?sys_id=CHG0030673 – Rahul Davis Jul 12 '17 at 11:38
  • you can't use `incident.do?sys_id=INCxxxxxxx` as sys_id expects a 512 bit unique id of the form 0123456789abcdef0123456789abcdef. hence you need to use `sysparm_query=number=INCxxxxxxx` – northern-bradley Dec 17 '17 at 15:28
  • 1
    @northern-bradley Have you actually tested that it *doesn't* work? See my description as to why it works. If number is the display field, a sys_id=number search *will* retrieve the record. – Joey Dec 18 '17 at 20:08
  • Try the same thing with a GlideRecord.get, that works, too: ```var gr = new GlideRecord("incident"); if (gr.get("INC0010910")) ...``` – Joey Dec 18 '17 at 20:15
  • 1
    I have tested this and it did work. So no reason for the downvotes. The link looks something like this: https://{ENVIRONMENT}.service-now.com/{snowPart}.do?sys_id={SnowRequestId} and {snowPart} can be 'task.do' for example – Dragos Durlut Feb 12 '19 at 08:41
0

{yourinstance}.service-now.com/nav_to.do?uri=incident.do?sys_id={incidentNumber}

Replace incidentNumber with your incident number .

Thiago Romano
  • 577
  • 5
  • 14
Ved Prakash
  • 487
  • 5
  • 9
  • 1
    you can't use `incident.do?sys_id=INCxxxxxxx` as sys_id expects a 512 bit unique id of the form 0123456789abcdef0123456789abcdef. hence you need to use `sysparm_query=number=INCxxxxxxx` – northern-bradley Dec 17 '17 at 15:28
  • 1
    Yes you can use `incident.do?sys_id=INCxxxxxxx`. Try it. Yes, sys_id expects a 32 character GUID, but it falls back to querying by display field if what you give it isn't a 32 character GUID. – Joey Dec 18 '17 at 20:11
  • 1
    @joey, so it does! i never knew that – northern-bradley Jan 17 '18 at 19:20