Filling INC form from URL, with caller id not from getUserID()?

frankthetank
Kilo Contributor

Just so it's said, I'm not a pro with ServiceNow, and I'm working from the "front-end" of the system, and haven't access to the "developer tools" in ServiceNow, (work-politics)

I'm working on some software for our physical helpdesk, and one of the features that is envisioned is a "quick create incident". The reason why this can't be in ServiceNow is because of the need to connect to other data-sources, to use RFID, mag-strip or barcode, (all three are diffferent values), to get the "caller id", (and some other values).

Simply: I want to have a url that opens a form and populates it with the ID of the caller and not the logged in user, but all I can find is "GetUserID()"-script that is less than useless unless I can pass it a variable, something it didn't seem to like.

ex: https://<SOMENAME>.service-now.com/incident.do?uri=incident.do?sys_id=-1%26sysparm_query=priority=5^...

I've been reading myself blind, and googling, but it seems that creating an incident on behalf of someone is unheard of

thanks for any input!

-Frank

4 REPLIES 4

michal29
Mega Guru

Hello Frank,



It may be wrong, but at first glance, the caller_id is a reference field, so passing a string text to that field will not work ex: https://community.servicenow.com/ .


What the reference field is expecting is a sys_id of a user record. ex: "219b8b310f11cac060e7e64be1050eb8"



So in order to pre-populate the field you would need to query sys_user table to find the sys_id of the user that you want to put as a caller.



Regards,


Michal


Aaaah! that explains a few things



Could I fill the form field in some other way? since I only need the information to be in the field when the form pops up, as if I just typed in the name of the caller? All I need is for the Customer ID -field in the form to have the name of the caller, and all is good, as the automatic name-validation does the rest


To make the customer ID field have a default value, you'll need some level of admin access to modify the default value or create a lookup script. It sounds like you want a dynamic default value rather than a static one.


Chuck Tomasi
Tera Patron

Michal is essentially corrrect. In order to do this via URL, you would need a sys_id of the caller (the GUID for their user table record) which means you would have to export that table regularly to another system to match the user name and it just gets nasty.



Another way would be to create a processor to accept the input/arguments on the URI and then do the lookup/translation internally. You said you don't have access to the development side (e.g. scripting) so this doesn't sound like it's plausible at this point. Just throwing it out there as a technical option.



Processors