Need to populate custom table field with RITM number
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-26-2024 11:27 PM
Hi friends, iam working on a task in which i attach an excel sheet containing records in a catalog item , when i sumbit that catalog item ,records from excel gets populated in custom table. This is done by copying attachement from sc_req_item to datasource followed by transform map its working fine. Now the issue is the custom table contains one field called Ritm number, the field should be populated with the ritm number of reqseted item when ever records is created using the catalog item. How can i achieve this. help me
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-27-2024 03:01 AM
Hi @Sharath807 ,
If you have the requested item field on the sheet, then you can populate the RITM number in your custom field in the target table by, using this below logic in the before transform script.
var item = new GlideRecord('sc_req_item');
item.addQuery('sys_id',source.u_req_item); // add the correct name of your req item field here
item.query();
var number = 'NOTHING';
if(item.next()){
number = item.number;
}
target.u_ritm_number = number; // add correct name of RITM number field here
Thanks,
Hope this helps.
If my response proves helpful please mark it helpful and accept it as solution to close this thread.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-27-2024 03:27 AM
Hi @HrishabhKumar every time a catalog item is submitted new request item will be generated .. so will it works ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-27-2024 03:57 AM
Yes, it will.
Thanks,
Hope this helps.
If my response proves helpful please mark it helpful and accept it as solution to close this thread.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-27-2024 07:42 AM - edited ā06-27-2024 07:45 AM
Hi @HrishabhKumar I tried importing data with ''on before transform script. it displaying empty with 'No preview available''. RITM field in custom table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-27-2024 02:04 AM - edited ā06-27-2024 02:04 AM
How do you copy the attachment to the data source? What kind of script are you using for that?
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/