Is it possible to export the table records daily through schedule job?

Sathwik1
Tera Expert

I need to run a job daily, which needs to export the data(in incident table) as an XML and needs to trigger an email to x,y persons with that attachment..

is it possible>?

@Ankur Bawiskar 

 

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you need to use custom solution for this

1) schedule job daily at particular time

2) create the xml file using script by forming the xml tags via script and attach it to some record without which you cannot include that in email

3) if report is for incident then attach it to some incident and include the recipients etc using eventQueue() function

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Can you please explain me bit more clearly..

 

Daily I need to export all incidents into an XML and need to mail for x, y persons.. this is my requirement.

not an easy one to accomplish.

I already mentioned the approach above.

But the code would be tedious and difficult to maintain.

If they want XML then you can use export set capability with XML type.

When export set generates the file to be pushed to mid server, it adds an entry into table "ecc_agent_attachment"

You can create notification on this table and use the Include Attachment checkbox

Add the users email in notification as recipient.

I hope you got the approach and can take it forward from here.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

In "ECC_Agent_attachment" there is no unique field to find out from which export set we are getting the file...

So I tried of using "sys_attachment" table... mail is triggering as expected.. but attachment is not getting added to the mail.. how can I do that? please help @Ankur Bawiskar