I have a scenario to save documents into dynamic folders using tofolder function

Hi All,

I have a scenario to save documents into dynamic folders.  Tried using tofolder() for which input parameter is a value which is of any type. when I try to pass folder id , it is working fine but not with the folder name.

In my case I need to pass the value which is a combination of static text and variable which changes dynamically.

Even I found the same case with Move document smart service.

Appreciate for the help.

  Discussion posts and replies are publicly visible

Parents
  • tofolder(): Converts a value to Folder

    tofolder() just converts the given value to folder type. If you provide existing folder id, it checks the existing folders then returns the existing folders otherwise it will converts the given numbers to folder type with no id specified.

    For example, tofolder({001,002}) 1 - [ID NOT FOUND] (Folder), 2 - [ID NOT FOUND] (Folder).

    For text input it just coverts the provided text to folder type. For example tofolder({"Test1"}).

    It converts Test1 text to folder as follows

    1 - [ID NOT FOUND] (Folder).

     

  • Thanks Dude for the reply. But I see it is returning null if I pass a text input (which is an existing folder name).

  • Hi. So, the confusion here on two levels. Firstly, yes, tofolder() DOES accept a parameter of 'Any Type' and allows for both Numbers (integers and Decimals) and Text. BUT: you need to be aware that whilst a Document's Id is unique, it's name is NOT. That is, you can have many folders with the same name in any given environment. So a function to return a handle to a folder can ONLY use the folder's unique Id (the same principle applies to documents and the todocument() function)

    So, why does the function also accept Text as an input? I'm not sure, but both of the following return a folder object handle:

    • fn!tofolder(214372)
    • fn!tofolder("Folder:214372")

    Frankly, I don't see the point of the latter - if you know the folder's Id is 214372 then the first is sufficient for your purposes.

    So, back to the ORIGINAL problem: how do you create a new folder? You either do this in a Process Model with the Create Folder Smart Service, OR you use the equivalent function, which is a!createFolder(). Both of these are described here.

  • Thanks Stewart for the reply.
    Folders are being created at an early stage and documents are getting uploaded at a later point of time into different folders based on criteria.

Reply Children
No Data