- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2015 06:32 AM
Hello,
First attempt at scripting:
I am trying to write a client script within a Variable Set that returns the current logged in user Floor, managed to get Location, Department etc working as these have pre-built methods:
Floor is a custom field that has been added so wont work,
Here is the script I have so far which is currently not working:
______________________________________________________________
function onChange(control, oldValue, newValue, isLoading) {
var userLocID = g_form.getReference('u_locationid', Display);
}
function Display(userLocID) {
if (userLocID != ' ')
g_form.setValue('Floor', userLocID);
}
Comments:
u_locationid is the Column Name on the User Table where the Floor is added as part of the import
Floor is the name of the field on the New User Request Form
Any help would be appreciated
Ashley
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-30-2015 12:41 AM
Hi Tanaji,
Thank you for your reply
I should have updated this ticket a bit sooner,
I worked with one of the developers in the office to get this working and here is the code we used:
function onLoad() {
var userLocID = g_user.userID;
var FloorQ = new GlideRecord('sys_user');
FloorQ.addQuery('sys_id', userLocID);
FloorQ.query();
if (FloorQ.next()) {
g_form.setValue('u_floor', FloorQ.u_locationid); }
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2015 07:14 AM
Hi Ashley,
In addition you can refer the example below and adjust your solution accordingly. This script populates the location as soon as the caller field is changed on the incident table.
I hope this helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2015 12:41 AM
Hi Peadeep,
Thank you for the reply but I can't get the page to open, getting a "This webpage is not available" error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2015 01:38 PM
Make sure to replace "yourinstancename" with the name of your instance in the URL. Should load up fine then.