Record Producer attachment copy to Demand

kendall_lin
Giga Contributor

Hello,

I have a record producer that allows the user to attach a document. The record producer is used to create a Demand record. The attached file is not showing up on the opened demand. I did research and found information on the GlideSysAttachment.copy script below. However, I have several questions (note I am a SN novice).

GlideSysAttachment.copy('sourcetable', 'sys_id', 'destinationtable', 'sys_id');

NOTE: I used a UI Page to allow the user to attach a file, not the paper clip icon on the record producer. this is a user requirement.

  • The record producer (in a service catalog) is based on the Demand Table. Why is the attachment from the record producer not carrying over to the demand record created from the record producer?
  • If I need to use the above script how do I get the sourcetable, sys_id, destinationtable, sys_id info for the record producer?   Are the sys_ids for the corresponding tables?

Any information provided would be helpful.

Thank you

8 REPLIES 8

Srinivas Balusu
Kilo Guru

1. Check in 'sys_attachment' table if the record is being saved in the instance.


2. GlideSysAttachment is a method to copy the files form once table record to another table record. Foe exmaple, If you have a file lets days 'Error file.txt' attached to an incident record 'INC001' and if you wanted to be copied it over to   problem table for record 'PRB001' then you use this method. Script could be some thing like below.




GlideSysAttachment.copy('incident', 'sys_id of INC0001', 'problem', 'sys_id of PRB001');


Also in your case first check if the UI pages is really successful in creating attachment in sys_attachment table. Looks like its not.


Thank you bsss.



The attachment is being created in the sys_attachment table. The table on the sys_attachment table that the attachment is related to is sc_cart_item. So would the correct use of the method be:



GlideSysAttachment.copy('sc_cart_item', sys_id of sc_cart_item, 'dmn_demand', sys_id of dmn_demand);



Do I need to create a var as a target for the method?



Thank you for the quick and helpful response.


That should work for your req.



But I am just wondering on few other things. Will post here if I find any other relevant.