Is two-way synchronization between two catalog variables technically supported inside Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Is two-way synchronization between two catalog variables technically supported inside Service Portal.
I have two catalog variables inside a variable set:
euid (text)
associate_name_common (reference to sys_user)
Both fields need to stay synchronized:
When the user enters an EUID, the script should populate associate_name_common.
When the user selects associate_name_common, the script should populate EUID. This is not works correctly in Maintain Item view and Service Portal (Try It)
Important details:
Both variables are on a variable set, used on 25 items
Using onChange Catalog Client Scripts
Using GlideAjax + Script Include
Even with flags like:
g_form.setParameter('sysparm_skip_euid_update')
window._lock
g_scratchpad
isLoading
→ the loop continues in Service Portal and Maintain Item view(platform ui) view.
I want solution to this problem. Please, anyone help me out from this problem
Below I am attaching my Catalog Client Scripts and Script Include.
I have tried by creating all the server side script include code in one script include itself it doesn't work
And both script include code are Client callable.
var UserLookupAjax = Class.create();
UserLookupAjax.prototype = Object.extendsObject(AbstractAjaxProcessor,
getUserByEUID: function() {
var euid = this.getParameter('sysparm_euid');
if (!euid) {
return '';
}
var user = new GlideRecord('sys_user');
user.addQuery('u_euid', euid);
user.query();
if (user.next()) {
return user.sys_id;
}
return '';
},
type: 'UserLookupAjax'
});
var UserLookupEUID = Class.create();
UserLookupEUID.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getEUIDByUserSysId: function() {
var sysId = this.getParameter('sysparm_user_sysid');
if(!sysId) {
return '';
}
var user = new GlideRecord('sys_user');
if(user.get(sysId)) {
return user.u_euid.toString();
}
return '';
},
type: 'UserLookupEUID'
});
function onChange (control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
// Type appropriate comment here, and begin script below
var ga = new GlideAjax('UserLookupEUID');
ga.addParam('sysparm_name', 'getEUIDByUserSysId');
ga.addParam('sysparm_user_sysid', newValue);
ga.getXMLAnswer (function(response) {
if (response) {
g_form.setValue('euid', response);
} else {
g_form.setValue('euid', '');
}
});
}
function onChange (control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var ga = new GlideAjax ('UserLookupAjax');
ga.addParam('sysparm_name', 'getUserByEUID');
ga.addParam('sysparm_euid', newValue);
ga.getXMLAnswer (function(response) {
if (response) {
g_form.setValue('associate_name_common', response);
} else {
g_form.setValue('associate_name_common', '');
}
});
}