attachment REMOVE

servicenow14710
Tera Expert

HELLO DEVELOPERS, 

I need to remove/delete attachment on change of a variable on service catalog on portal

 

I am using 'gel' in onchange client script

 

var id_object = gel('sysparm_item_guid');
var cart_item_sys_id = id_object.value;

 

But i am getting browser error - saying 'gel' is not defined.

 

Can someone tell me how i can get that sysID (the value that gets stored tablesys_id when attachent is added on portal)

 

 

 

Any suggestion is appreciated, Thanks!

7 REPLIES 7

ShubhamGarg
Kilo Sage

Hello @servicenow14710 ,

 

This is OOTB behaviour.

When record is new/not inserted to target table, and an attachment is added, it creates a record in the attachment table. Even if you abort an operation/meaning you do not submit the record, attachment record remains there with the table_sys_id generated on UI portal page.

 

Hope it helps.

Regards,

Shubham

Hello @ShubhamGarg : Thanks for the reply shubham, yes attachments are stored in attachment table,   i need to know which sys_id is getting stored in sys attachment table (table_sys_id).

As i need to delete the attachments from attachment table before form is submitted, i need to pass this(table_sys_id) sys_id to server side . Thanks!

Hello @servicenow14710 ,

The sys_id which gets stored is system generated ( as always & on back-end only) which is not shown on UI. Instead it shows sys_id=-1 on UI before submission. The backend sys_id gets populated on UI only after record creation.

This is OOTB framework to ensure no redundant sys_id gets shown on UI unless it is actually stored.

 

BR,

Shubham

Hello @ShubhamGarg : i am referrng to attachment table sys id (table_sys_id ) column in attachment table 

Thanks,