Attachment in Service Portal

Ashish Kumar Ag
Kilo Guru

When we attach in service portal before submitting request, its create a entry in attachment table with table name sp_portal and a sys_id for table_sys_id. But i couldn't trace the sys_id.

Any idea which sys_id its referring to?

Also suppose in a catalog request in SP you attach a file and then changes your mind to submit the request. So if i am not submitting the request how to delete that entry. Apart from user removes by clicking cross icon. pradeepksharma

10 REPLIES 10

Ashish Kumar Ag
Kilo Guru

subhajit any idea.


I've same request.


Anyone can we help?


ChrisBurks
Mega Sage

The sys_id is a randomly generated sys_id. It doesn't belong to anything except for helping to trace so that if the user wanted to change their mind and delete the attachment.



If you look in the SC Catalog Item (widget-sc-cat-item) on line 51 of the Client Controller you'll see the attachment handler set the values:


ah.setParams('sp_portal', $scope.data._attachmentGUID, 1024 * 1024 * 24);



Notice: $scope.data._attachmentGUID



If you look in the Server Script line 45, you'll see data._attachmentGUID being set with the gs.generateGUID() method. That method generates a valid but generic sys_id.



If the user changes their mind but doesn't remove the attachment, I suppose you could write a scheduled job to run at a time where you know no one at the company would be using the system that contains a script to search for all attachments that have the sp_portal as the table and then look for any records on that table the match the table sys_id. If none match then delete that attachment.


Or better, look at the day the attachment was created and if the date is the day before then more than likely it's good to delete. Once the catalog item is submitted the sys_id is swapped out with the RITM's sys_id along with the sp_portal table being switched out with the corresponding table.