How to extract the attached CSV file in RITM Number.

Jyoti Malhotra
Tera Contributor

Hi Team,

 

I need help for below .

 

How I can extract the attached CSV file in RITM Number ?

 

JyotiMalhotra_0-1726655876636.png

 

 

Thanks

JM

2 REPLIES 2

Jyoti Malhotra
Tera Contributor

Hi 

 

I'm trying via Business rule.

 

 var attachmentGR = new GlideRecord('sys_attachment');
    attachmentGR.addQuery('312a741447701210f42eb87b716d4337', current.sys_id);  // sys_id of the current RITM
    attachmentGR.addQuery('cmdb_ci_outage (2) (1).csv', 'CONTAINS', '.csv');  // Check for CSV attachments
    attachmentGR.query();

    if (attachmentGR.hasNext()) {
        gs.log('CSV attachment found for RITM: ' + current.number);
    } else {
        gs.log('No CSV attachment found for RITM: ' + current.number);
    }
 
but seems not working. Please help to find solution.
 
Thanks
JM

Edoardo M
ServiceNow Employee
ServiceNow Employee

Hi @Jyoti Malhotra,

There are many ways for importing files into tables. Here you can find a good overview to take an informed decision from an architectural standpoint.

 

However, for your specific use case, I strongly suggest the low-code approach via Flow and import set, well described in these 2 articles (you just need to change the trigger from Inbound email to record create or update):

  1. Import Excel File from Inbound Email via Flow
  2. Transform Attachments with Flow Designer

BR,

Edo


Please mark it as helpful and accept it as a solution if it helps you in any way.