How can I use formula to insert a file already in Documents?
$documentId = '66276bba76b9d6749'; // define the ID of the document that will be entered in the File field $documentFileId = record\attribute('Document', $documentId, 'fileId'); fileId = record\create('Attachment', 'name', record\attribute('Attachment', $documentFileId, 'name'), 'type', record\attribute('Attachment', $documentFileId, 'type'), 'size', record\attribute('Attachment', $documentFileId, 'size'), 'field', record\attribute('Attachment', $documentFileId, 'field'), 'role', record\attribute('Attachment', $documentFileId, 'role'), 'storage', record\attribute('Attachment', $documentFileId, 'storage'), 'global', record\attribute('Attachment', $documentFileId, 'global'), 'relatedId', id, 'relatedName', name, 'relatedType', 'CTest', // insert your entity name (where the File field is presented) 'sourceId', $documentFileId );
Comment