Need to populate custom table field with RITM number

Sharath807
Tera Contributor

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

17 REPLIES 17

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.

 

Hi @HrishabhKumar  every time a catalog item is submitted new request item will be generated  .. so will it works ?

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.

Screenshot (5).pngHi @HrishabhKumar  I tried importing data with ''on before transform script. it displaying empty with 'No preview available''. RITM field in custom table.

Slava Savitsky
Giga Sage

How do you copy the attachment to the data source? What kind of script are you using for that?