hasattachments() giving false on request item

SudhirOjha
Mega Guru

creating one business rule which is giving hasattachments() = false despite of having a attachment with record from portal. any idea.

this is created on

Table = sc_task 

After insert.

(function executeRule(current, previous /*null when async*/) {

var rec = new GlideRecord('sc_req_item');
gs.log("current.request_item " + current.request_item,"test");
rec.addQuery('sys_id', current.request_item);
rec.query();
gs.log("current attachments " + rec.hasAttachments(),"test");
if(rec.next() && rec.hasAttachments()){

current.work_notes = "RITM number is this:" + rec.number;
current.update();
}
})(current, previous);

11 REPLIES 11

SudhirOjha
Mega Guru

FYI-  I am trying to create the request from the portal

Jim Coyne
Kilo Patron

It would be helpful if you explained what you are actually trying to accomplish.  Looks like you are trying to add a work note to the Catalog Task record if the RITM has an attachment.  Is that correct?  If so, what if the attachment is added after the CTASK is created?

You might want to look at this post if you want to see attachments on the RITM from the CTASK record - "Related Attachments" Related List.