Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

delete attachment from data source 10 minutes after creating records

Nitin26
Tera Contributor

Hi all,

 

I want to delete the the attachment on data source after 10 minutes when records get created. How can we achieve it?

I am creating some records in a custom table using import set. I am attaching a CSV file on the data source.

I am trying to delete the same using post import script available on scheduled data import attached to our data source but it's not working; maybe because sys_attachment is in global and my data source is in the custom application. Please suggest what can be done.

Thanks in Advance

1 ACCEPTED SOLUTION

Also to note if still you are not able to delete those attachment, then would suggest to check if you are working in a Scoped Application or not?

If it is a Scoped Application then you need to enable the Can delete behavior at the Table level as shown below and allow it to delete it from other scopes as well:

Navigate to tables module and search for "Attachment" table and then go to Application Access tab as shown below and make the changes as highlighted:

find_real_file.png

find_real_file.png

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

View solution in original post

6 REPLIES 6

Deepak89
Tera Expert

Hello @shloke04 ,

Is it necessary to enable the Can delete behavior at the Table level (For Scoped App)

Can't we achieved it by using flow designer , i tried it but its giving me error related to function not sure if that is because of that permission (Can delete) .

 

Manan Jaiswal1
Tera Contributor

Hi Nitin, 
How did you add 10 min delay time in your post import script? Can you show me an example of that as well?
thanks