Remove attachment from catalog form based on a filed onchange

charanya
Tera Contributor

Hi, 

I have an attachment added to the form based on field on change value. 

If the user chooses option A - attachment is mandatory --> I have completed this.

If the user chooses option B - attachment is not needed. if anything is already attached then we need to remove the attachment.

When i attach the doc in the form, the table is sc_cart_item. I am not able to figure what the table sys_id is referring to.

How do i idnetify the attachment and delete it?

gel('sysparm_item_guid') is not working. 

Please let me know a solution for this requirement.

1 REPLY 1

Harshal Gawali
Giga Guru

Hi Charanya,

You can use the attachment type variable instead of writing complex script. you only need to write onchange client script on attachment type variable.

check below YouTube video to get an idea about how to use attachment type variable.

Attachment Variable in ServiceNow

Regards,

Harshal.