cancel
Showing results for 
Search instead for 
Did you mean: 

Document. Attach blob Operation

Wafa_SELLEMI
Champ on-the-rise
Champ on-the-rise

Hi, I want to get a file from an existing document (Type: New-Workspace) and to attach it to another document (Type: Project) using an automation chain ( Please see attached document) when I create a new project I receive an error message (Please See attachment : console ) Could you please help me to find possible causes Thankyou

1 REPLY 1

Gregory_Carlin
Elite Collaborator
Elite Collaborator

Hello,

Your error is server side, so the browser logs don't help a lot. I really not recommend using automation chain for this use case, it makes things complex. You'd better go with automation scripting. It should be something like this:

function run(input, params) {
  var parent_doc = Document.GetParent(
    input, {
      'type': "New-Workspace"
    }
  );
  var file = Document.GetBlob(
    input, {
      /*required:false - type: string*/
      'xpath': "file:content"
    }
  );
  Blob.AttachOnDocument(
    file, {
      /*required:true - type: document*/
      'document': input,
      /*required:false - type: boolean*/
      'save': true,
      /*required:false - type: string*/
      'xpath': "project:logo"
    }
  );
  return input;
}

It feels strange to get a blob from a doctype called "New-Workspace" BTW