QR Code for generating an incident with asset info

Eric148
Tera Guru

Hello all,

 

Goal:  User scans QR code on their PC/printer.  Incident creation form opens on their mobile device (after signing in) with the PC/printer asset info filled in already.

Restrictions:  Mobile app cannot be used.  Users have no roles.  Asset is not necessarily assigned to user.

 

In testing, I have been able to create a UI Action on an hardware asset page that opens the incident creation form where that asset's name is already populated when the form opens.  However, I need this to direct end users to the Service Portal in instance Self-Service -> Service Catalog -> Can We Help You? -> Create Incident possibly.

 

Any thoughts?

 

Thank you,

1 ACCEPTED SOLUTION

jMarshal
Mega Sage
Mega Sage

The "create incident" in the service catalog is actually a record producer...so you'll need the url of your record producer....and then append with arguments to pre-populate values in the URL.

This is described in pretty good detail here: 3 Ways to Populate Values in ServiceNow via the UR... - ServiceNow Community

You'll be looking at "option 2" as it's a record producer you want, not the incident table form.


Just hardcode the values for each QR code into the URL you are generating...and keep in mind that this is hardcoded...so any changes on "either side of the equation" will need manual updates/fixes (printing a new QR code).

For instance, if you change the variable name of where you're sticking the "Hardware Type" (assuming that's one thing you're looking for in the record producer) or if the value of that changes from "HP" to "Hewlett-Packard"...you'll need to update the QR code in either case....or if the hardware in question is replaced, it will need a new QR code (assuming you're tracking unique assets).

 

View solution in original post

9 REPLIES 9

jMarshal
Mega Sage
Mega Sage

The "create incident" in the service catalog is actually a record producer...so you'll need the url of your record producer....and then append with arguments to pre-populate values in the URL.

This is described in pretty good detail here: 3 Ways to Populate Values in ServiceNow via the UR... - ServiceNow Community

You'll be looking at "option 2" as it's a record producer you want, not the incident table form.


Just hardcode the values for each QR code into the URL you are generating...and keep in mind that this is hardcoded...so any changes on "either side of the equation" will need manual updates/fixes (printing a new QR code).

For instance, if you change the variable name of where you're sticking the "Hardware Type" (assuming that's one thing you're looking for in the record producer) or if the value of that changes from "HP" to "Hewlett-Packard"...you'll need to update the QR code in either case....or if the hardware in question is replaced, it will need a new QR code (assuming you're tracking unique assets).

 

Excellent, thank you.  This is just what I needed.  The only remaining issue I am having is in the QR code generation from within ServiceNow.  The UI Action's script that is building the QR Code is converting & into & which is killing the link.  I'm still looking for a solution to this - any thoughts?

Hmmm...maybe try setting the field type as URL specifically, for the field that you're generating the URL from, rather than string...?

The URL field type is *usually* for user-facing activities (so that it can produce click-able links)...but perhaps this will benefit you "in the background" for your UI Action, also.

If you are building the URL dynamically in the script (not pulling from a field), consider creating a non-visible URL field on the form, which is set/updated by the UI Action (or configure it as a calculated value outside of the UI Action)...and then the UI Action itself just references/grabs that value during the QR code generation.

If this is already a URL field type...perhaps you'll want to try the same method as above, but force as a string instead?

You seem to be "on the right track" and I think this is very innovative design tbh...having a UI Action on the Asset table to generate a qr code for the asset record, which would easily allow an end-user the ability to report an incident with that exact asset? Genius! 👏👏👏 - I hope it works as well as it sounds!

Thanks!  I'm hopeful it will work out well for us once I can get it up and running. 

 

With this QR generator I'm using, it appears to be rendered via the UI Page.  I'm wondering if the Jelly there is what is rendering & into &, but I'm not sure how to counter it.  I made an attempt at using decodeURIComponent in the UI Action where the URL is being generated, but no luck.