i am trying to attach a file into the Communicatio...
# suitescript
v
i am trying to attach a file into the Communications tab-->Files. How is it possible? I tried record.attach , record.setSublistValue, both didnt worked out. could anyone please help
m
record.attach, but I've had to do this in 2.0
seems to not work in 2.1
v
no it doesnt work. var id = record.attach({ record : { type : record.Type.FILE, id : toNumber }, to: { type : record.Type.PURCHASE_ORDER, id : recordID } }); This is my code
b
v
i did the same
no error but it didnt attach in the Communications-->Files
in PO
b
convince me you read the documentation
v
i did sir, still i dont get any clue what is wrong?
b
you are doing something the documentation tells you not to do
which means you either didnt read the documentation
or did not pay close enough attention when you did so
either way, you need to reread it closely
c
In addition to @battk's point, are you referencing the correct internal ID variables? If so, the names are confusing - you're referencing a variable called
toNumber
in the "record" object and
recordID
in the "to" object
v
var id = record.attach({ record : { type : record.Type.FILE, id : purchaseRequisitionFileID }, to: { type : record.Type.PURCHASE_ORDER, id : purchaseOrderID } });
this is what i am doing, i need to attach purchase requisition file to the purchase order record.
c
Please review the docs again per @battk’s suggestion - you're getting something wrong there that's spelled out in the help docs
v
yes got it. it should be file as the record type not as record.Type.FILE
1