Announcement

Collapse
No announcement yet.

WORKFLOW: Create DocumentFolder and asign it to a parent folder.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • WORKFLOW: Create DocumentFolder and asign it to a parent folder.

    Hi there, happy AdvancedPack customer here.

    I've created a workflow that creates a new folder when an account of a given type is created. Code bellow:

    $clientFolderId = record\create(
    "DocumentFolder",
    "name", targetEntity\attribute("name")
    );


    $parentFolderId = record\findOne(
    "DocumentFolder","createdAt","asc",
    "name=","Arquivo Clientes"
    );

    record\update(
    'DocumentFolder',$clientFolderId,
    'parent',$parentFolderId
    );


    Code in green is working, orange is not. What I need is to have the newly created folder inside the other one (called "Arquivo Clientes", portuguese BR).

    This is being done using formula because DocumentFolder doesn't appear in the drop down on Actions.

  • #2
    So funny when it happens... I've found the error just after posting.


    // THIS CODE HERE WAS OK
    $parentFolderId = record\findOne(
    "DocumentFolder","createdAt","asc",
    "name=","Arquivo Clientes"
    );

    // THIS WAS NOT: parentId should be used, not just parent as in the original post
    record\update(
    'DocumentFolder',$clientFolderId,
    'parentId', $parentFolderId
    );

    Comment


    • #3
      Hi!

      We’re glad your problem is solved.

      All the best, Daniel!

      Comment

      Working...
      X