Populating a ticket based on a url

bpACH
Giga Contributor

Hello,

We would like users to be able to create incidents using a QR code.

The following page looks like it describes how to create a new ticket with values from a url: http://wiki.servicenow.com/index.php?title=Navigating_by_URL#Open_a_Form_with_Preset_Values&gsc.tab=...

However, when I try the following, it just creates a new ticket without the short description or category filled:

https://<instance>/facilities.do?sysparm_stack=facilities_list.do&sys_id=-1&sysparm_query=caller_id=...Restroom Cleaning

The end game would be to put up QR codes in the various rooms so that users could use those to file tickets when there is a problem.

Alexander Harris

4 REPLIES 4

bernyalvarado
Mega Sage

Hi Alexander,



I believe that on the parameters you just need something like the following:



https://instancename.service-now.com/incident.do?sys_id=-1&sysparm_query=active=true^cmdb_ci=46ce1c8...



Note: Every reference field must be associated with it's sys_id



Disclaimer: Edited post after Thijs input. Thanks Thijs Daemen



Thanks,


Berny


Hi Berny,



From the wiki page (Navigating by URL - ServiceNow Wiki😞



    You can also use JavaScript to access GlideSystem methods. The following creates the same type of incident as above, and also populates the caller ID with the current user ID:


https://<instance name>.service-now.com/nav_to.do?uri=incident.do?sys_id=-1%26sysparm_query=priority=1^incident_state=3^caller_id=javascript:gs.getUserID()




Thijs Daemen
Mega Guru

Hi Alexander,



In your URL, you have the following phrase 'facilities.do', does this refer to a ui page or a CMS page? I'm not sure it is an out of the box page. In which table would you like the records to appear?



Also, for this to work the user would always need to be authenticated with ServiceNow and must submit the record before it is entered into ServiceNow. The URL doesn't automatically create a record, it prefills one with information.




A way to automate it would be to redirect the user to a ui page that fetches the relevant parameters (RP.getParameter) and automatically create a record. It would be anonymous (probably), which might be a drawback. The ui page would need to be public in order to prevent authentication, or not, in which case you can retrieve the logged in user.


Hello,



The facilities application is a copy of the out of box incident application modified for use by that group.



The short description is a text field, and the category is a choice list (not a reference field).