Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

Clear MRVS once user deleting file in Attachment type variable

TanviP003244604
Tera Contributor

Hi

 

I have a requirement in a catalog item where:

 

There is an Attachment type variable for file upload

There is an MRVS (Multi Row Variable Set) that gets auto-populated based on the uploaded file

 

Currently, when a user uploads a file, the data is successfully parsed and populated into the MRVS.

 

However, the issue is:

When the user deletes the file using the delete button provided in the attachment variable, the data in the MRVS still remains populated.

 

Expected behavior:

If the user deletes the uploaded file, the corresponding data in the MRVS should also be cleared automatically.

 

Has anyone implemented this kind of functionality or handled this scenario before?

What would be the best approach to clear/reset MRVS data when the attachment is removed from the variable?

 

Any guidance or suggestions would be really helpful.

 

Thanks in advance!

1 REPLY 1

Tanushree Maiti
Kilo Patron

Hi @TanviP003244604 

 

Create a Before Delete Business rule on sys_attachment table (restrict to your catalog only), and write a script to delete MRVS data. 

Refer: Multi Row Variable Set: Clear/Remove all values

            KB0821313 Attachment removal not logged in the activity stream 

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin: