- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2024 07:10 AM
Hello,
On a catalog item, how do I get the cost center field to automatically populate when the Requested For field populates and/or when Location field is populated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2024 07:14 AM
Hi @DeIvory Gordon ,
You can try the autopopulate feature in the catalog item where u just need to specify based upon which field selection on the form it is suppose to autopopulate for eg in ur case Requested For, then select the table as user as the value will be fetching from der & the dotwalk field as cost centre.
Here without script u will be able to achieve ur request,
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2024 07:14 AM
Hi @DeIvory Gordon ,
You can try the autopopulate feature in the catalog item where u just need to specify based upon which field selection on the form it is suppose to autopopulate for eg in ur case Requested For, then select the table as user as the value will be fetching from der & the dotwalk field as cost centre.
Here without script u will be able to achieve ur request,
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2024 07:24 AM
Thank you so much it worked, and you made the steps simple to follow!!!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2024 07:25 AM
@DeIvory Gordon Happy to Help 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2024 07:15 AM
Hi @DeIvory Gordon ,
javascript: var costCenter = ''; var gr = new GlideRecord('sys_user'); gr.get(gs.getUserID()); costCenter = gr.getValue('cost_center'); costCenter;
Please verify the name of the company field you're using on the cost center table and also please note the correct method used for the GlideSystem API to get the company ID of the user.
Another method:
Then use onChange client script on Requested For
function onChange(control, oldValue, newValue, isLoading) { if(isLoading) return; if(newValue == ''){ g_form.clearValue('cost_center'); // cost center variable name here } var ref = g_form.getReference('requested_for', callBackMethod); // requestedFor variable name } function callBackMethod(ref){ if(ref.cost_center) g_form.setValue('cost_center', ref.cost_center); // cost center variable name here }
If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!
Thanks & Regards,
Sumanth Meda