location field in sc_task table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2024 01:52 AM
Hello,
Can someone shed some light on how the Location field in the sc_task table gets populated? Where should I set the value for the Location field so that it populates correctly in the sc_task table?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2024 01:57 AM
Hi @bondita1
You need to create a new filed ( If not available OOTB) and reference to cmn_location table. and then you can use that in your work.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2024 02:00 AM
Hello @bondita1 ,
Usually, the location field is referenced to the cmn_location table. Based on the records available on the location table you can select the location. Let me know if any further help is needed on this.
Please like and accept the solution if that helps.
Thanks & Regards,
Pradeep
Regards,
Pradeep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2024 09:02 AM
Hello,
Thats correct, The Location field in sc_task table refer to cmn_location table. I have populated Location column in sys_user table. But while creating a catalog item, Location field inserted as empty in sc_task table. So I just want to know, how to populate the value for this filed? Is this OOTB or do I need to write some script for this?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2024 09:20 AM
Hello @bondita1 ,
By OOB location field will not populate on the task created, to make it happen either you have to write a Business Rule or Catalog client script.
Here is the sample Business rule:
// Fetch location from the 'sys_user' table
var user = new GlideRecord('sys_user');
user.get(current.requested_for); // Assuming requested_for field holds the user
if (user.location) {
current.location = user.location; // Set location from the user profile
}
Please like and accept the solution if that helps.
Thanks & Regards,
Pradeep
Regards,
Pradeep