
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2019 12:25 AM
Hi guys,
I need an help for configuring the Advanced Reference Qualifier in the right way.
In the Time Worker table, I've created a Reference custom field "Account_ref" to the customer_account table.
I would like to fill this field automatically with the account of the selected task, I tried dding with the following Advanced Reference Qualifier...no luck.
javascript:'account='+current.task;
Thanks for your help!!!
Solved! Go to Solution.
- Labels:
-
Best Practices
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2019 12:27 AM
Hi Alberto,
I replicated your config and figured out the issue, real rookie error for which i accept full responsibility 🙂
The function call in the getXMLAnswer() line is in quotes, it shouldn't be! use this:
//client script
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var ga = new GlideAjax('TestScriptInclude');
ga.addParam('sysparm_name', 'testFunction');
ga.addParam('sysparm_task', g_form.getValue('task'));
ga.getXMLAnswer(getAjaxData);
function getAjaxData(response){
g_form.setValue('u_account_ref', response);
}
}
EDIT: Just noticed Harsh has already picked this up!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2019 05:24 AM
You're right, sorry my bad. It's still not working, I was not able to read in the Case table (see error message below)...I've created a new Application Cross-Scope Access privilege into the Time Recording for Customer Service application...now I don't get any error but still do not populate the Account_ref field, it's doing nothing 😞
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2019 05:30 AM
If you go to the table and change it to allow access to all application scopes that should open it up.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2019 05:46 AM
I think this client script is doing nothing, I don't see any error or information in the logs but still the account_ref field is not getting populated even if I try to change the Task...

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2019 05:51 AM
is it possible if you can share the complete code which you have written ?
are you in scoped application ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2019 05:57 AM
I've changed everything to Global application (Script Include and Client Script), these are the actual code:
CLIENT SCRIPT (Table: Time Worked [task_time_worked], Type: onChange, Field name: Task, Application: Global):
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Type appropriate comment here, and begin script below
var ga = new GlideAjax('test');
ga.addParam('sysparm_name', 'test_function');
ga.addParam('sysparm_task', g_form.getValue('task'));
ga.getXMLAnswer('getAjaxData');
function getAjaxData(response){
g_form.setValue('u_account_ref', response);
}
}
SCRIPT INCLUDE (Name: test, Application: Global, Client callable: checked):
var test = Class.create();
test.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
test_function: function(){
var tsk = this.getParameter('sysparm_task');
var gr = new GlideRecord('sn_customerservice_case');
if(gr.get(tsk)){
return gr.getDisplayValue('account');
}
},
type: 'test'
});