auto populate manager details based on user selected in requested for field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2024 05:07 AM
Hi Community,
I have a requirement, in catalog form there is variable set in that there is 2 fields called
- Labels:
-
Request Management
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2024 05:29 AM
Hi @suuriya
change your script include.
var Autopopulatemanager = Class.create();
Autopopulatemanager.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getDetails: function() {
var details = [];
var business= this.getParameter('sysparm_business');
var userGR = new GlideRecord('sys_user');
userGR.addQuery('common_vars_requested_for', business); // set query
userGR.query();
while (userGR.next()) {
var users = {};
users.business= userGR.getUniqueValue();
details.push(users);
}
return JSON.stringify(details);
},
type: 'Autopopulatemanager'
});
Thanks
dgarad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2024 06:47 AM
HI @dgarad ,
Thanks for the reply
I tried your script include but it didnt worked...in client script the way im setting is wrong?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2024 10:03 PM
try the below code.
var Autopopulatemanager = Class.create();
Autopopulatemanager.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getDetails: function() {
var details = [];
var manager= '';
var business= this.getParameter('sysparm_business');
var userGR = new GlideRecord('sys_user');
userGR.addQuery('common_vars_requested_for', business); // set query
userGR.query();
while (userGR.next()) {
manager= userGR.getUniqueValue();
}
return manager;
},
type: 'Autopopulatemanager'
});
Thanks
dgarad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2024 09:08 AM
HI @dgarad ,
Can you help me with how we can achieve this when the form loads.....when user opens the item in portal then user name will be displayed in common_vars_requested_for field now this user manager needs to be populate in common_vars_also_notify.
As it is needs to be displayed only for one particular cat item can you let me know how we can achieve this using onload script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2024 04:17 AM
Hi @suuriya ,
You can do this through Auto populate feature available in variables in catalog item no need to do scripting,
select Dependent Question as Requested For and Dot walk Path as Manager,
Result:
User Table,
Portal View:
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang