- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2024 11:19 PM
Hello,
I am trying to auto-populate a form field (appraisal_due_date), based on the selected USER on a form that I'm developing for HR.
The field that I want to grab the information from is on the HR Profile.
I can't seem to click on any of the HR Reference tables to dot-walk to that field.
Is there a way to bypass this?
Thank you
Solved! Go to Solution.
- Labels:
-
Human Resources Service Delivery
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2024 01:16 PM
I'm trying to write a Script Include but it wouldn't save
Giving me this error message: Could not save record because of a compile error: JavaScript parse error at line (6) column (4) problem = missing } after property list
var getUserHRProfileInformation = Class.create();
getUserHRProfileInformation.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
type: 'getUserHRProfileInformation'
var getUserHRProfileInformation = Class.create();
getUserHRProfileInformation.prototype = Object.extendsObject(AbstractAjaxProcessor,{
getUsrActive: function()
{
var user = this.getParameter('sysparm_user');
var userGR = new GlideRecord('sn_hr_core_profile');
userGR.addQuery('sys_id',user);
userGR.query();
if(userGR.next())
{
return userGR.active;
}
else
return '';
},
});

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2024 07:05 PM - edited 08-26-2024 09:28 AM
Here is the updated script include. Make sure to create this script include in Human Resource: Core application scope. Otherwise it will not work.
var getUserHRProfileInformation = Class.create();
getUserHRProfileInformation.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getUserHRProfileInformation: function() {
var user = this.getParameter('sysparm_user');
var gr = new GlideRecord('sn_hr_core_profile');
gr.addQuery('user', user);
gr.query();
if (gr.next()) {
return gr.getValue('u_appraisal_due_date');
}
},
type: 'getUserHRProfileInformation'
});
Here is the onChange client script for the user field.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
var abc = g_form.getValue('subject_person');
var ga = new GlideAjax('global.getUserHRProfileInformation');
ga.addParam('sysparm_name', 'getUserHRProfileInformation');
ga.addParam('sysparm_user, abc);
ga getXMLAnswer(getResponse)
function getResponse(response) {
g_form.setValue('appraisal_due_date',response);
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2024 01:06 AM
@Hola Ola In order to achieve this, you need to build a combination of an onChange client script + script include. You can pass the value of user id from the onChange client script using GlideAjax and on the server side, you can query the HR Profile of the selected user. From the HR Profile you can extract the appraisal_due_date and pass it on to the client side. This response can be populated on the due date variable on the catalog item
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2024 01:14 PM
@Sandeep Rajput Thanks for your response.
I'm however not proficient in writing codes/scripts. Any help or direction will be highly appreciated.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2024 07:05 PM - edited 08-26-2024 09:28 AM
Here is the updated script include. Make sure to create this script include in Human Resource: Core application scope. Otherwise it will not work.
var getUserHRProfileInformation = Class.create();
getUserHRProfileInformation.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getUserHRProfileInformation: function() {
var user = this.getParameter('sysparm_user');
var gr = new GlideRecord('sn_hr_core_profile');
gr.addQuery('user', user);
gr.query();
if (gr.next()) {
return gr.getValue('u_appraisal_due_date');
}
},
type: 'getUserHRProfileInformation'
});
Here is the onChange client script for the user field.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
var abc = g_form.getValue('subject_person');
var ga = new GlideAjax('global.getUserHRProfileInformation');
ga.addParam('sysparm_name', 'getUserHRProfileInformation');
ga.addParam('sysparm_user, abc);
ga getXMLAnswer(getResponse)
function getResponse(response) {
g_form.setValue('appraisal_due_date',response);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2024 01:16 PM
I'm trying to write a Script Include but it wouldn't save
Giving me this error message: Could not save record because of a compile error: JavaScript parse error at line (6) column (4) problem = missing } after property list
var getUserHRProfileInformation = Class.create();
getUserHRProfileInformation.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
type: 'getUserHRProfileInformation'
var getUserHRProfileInformation = Class.create();
getUserHRProfileInformation.prototype = Object.extendsObject(AbstractAjaxProcessor,{
getUsrActive: function()
{
var user = this.getParameter('sysparm_user');
var userGR = new GlideRecord('sn_hr_core_profile');
userGR.addQuery('sys_id',user);
userGR.query();
if(userGR.next())
{
return userGR.active;
}
else
return '';
},
});