Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Attachment only in Catalog Task

AbhirupD
Tera Contributor

I have created a flow which is getting triggered when Catalog Item has been submitted. In that flow I am creating a Catalog Task after approval is done. I want to attach a file only to that Catalog Task. I am created a new Action for that and using below script in Script Step:

 

(function execute(inputs, outputs) {
    var attach = new GlideSysAttachment();
    var rec = new GlideRecord(inputs.task_table);
    rec.get(inputs.taskSysID);
    var fileName = inputs.fileName;
    var contentType = "application/json";
    var content = inputs.jsonContent;
    var agr = attach.write(rec, fileName, contentType, content);
    outputs.attachment_sys_id = agr;
})(inputs, outputs);
 
But, file has been attached to both Catalog Task & Catalog Item. Please help.
1 ACCEPTED SOLUTION

Uncle Rob
Kilo Patron

Take a normal sc_task and attach something to it manually.
Does the RITM get it too?
Then you've got some other code running counter to your solution

View solution in original post

6 REPLIES 6

Uncle Rob
Kilo Patron

Take a normal sc_task and attach something to it manually.
Does the RITM get it too?
Then you've got some other code running counter to your solution

Thanks Rob, I got thats correct.