How to get table_sys_id or cat_item from sys_attachment table

andreea4
Kilo Explorer

I've created an "after insert" business rule on sys_attachment table and I need to take the sys_id of the table or cat_item to check from where an attachment had been sent(from each catalog item). I've tried with current.table_sys_id but it gives me a different table_sys_id than the one displayed on the attachment table and if I try current.table_name is giving me sp_portal instead of sc_req_item. Any idea why or how can I get the actual table sys id ( the one that is displayed in "Table sys ID" field in the sys_attachment table).

1 ACCEPTED SOLUTION

SanjivMeher
Kilo Patron
Kilo Patron

You should run the business rule on when current.table_name = 'sc_req_item'. Because initially before request submission, the attachments are linked to record producer. Once you submit it, it generates the sys_id of requested item.

 

then query the sc_req_item with the table_sys_id to get the cat_item from it


Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

4 REPLIES 4

SanjivMeher
Kilo Patron
Kilo Patron

You should run the business rule on when current.table_name = 'sc_req_item'. Because initially before request submission, the attachments are linked to record producer. Once you submit it, it generates the sys_id of requested item.

 

then query the sc_req_item with the table_sys_id to get the cat_item from it


Please mark this response as correct or helpful if it assisted you with your question.

andreea4
Kilo Explorer

Hi Sanjiv, thanks for your answer. You're right, I just realized that before submission, the attachments are liked to sp_portal  table name. It makes sense now.

pavan95
Tera Contributor

Can you please let me know what does table_sys_id refers to ?

The table_sys_id refeers to field on the sys_attachment table. Is the sys_id of the target record - the record you want to add the attachments to.