Update a Folder

You can update a folder in the Catalyst File Store and rename it. You can do it by calling the update() method. Updating the folder name will not alter the files inside the folder. You will not be able to update the Folder ID or any other value.

Create a JSON Configuration

You must first create a JSON object containing the updated folder name, as shown below.

Copied//Create a config object with the new name for the folder
    let config = {
        folder_name: 'Billing'
    };

Update Folder

You must then pass the JSON object to the update() method. You must use the folder reference or the filestore instance to refer to the folder which needs to be updated.

The promise is returned here, which in turn resolves to the updated folder meta details. You can convert the resultant meta to a String or a JSON output using the .toString() or .toJSON() method.

Copied//Pass the JSON config to update the folder
let filestore = app.filestore();
let folder = filestore.folder(1510000000109545);
let updatePromise = folder.update(config);
updatePromise.then((folder) => {
            console.log(folder);
        });

A sample response that you will receive for each version is shown below:

Node.js

Copied{
  folder_name: "Billing",
  created_time: "Aug 16, 2021 05:04 PM",
  created_by: {
    zuid: 66466723,
    is_confirmed: false,
    email_id: "emma@zylker.com",
    first_name: "Amelia",
    last_name: "Burrows",
    user_type: "Admin",
    user_id: 2136000000006003
  },
  modified_time: "Aug 16, 2021 05:04 PM",
  modified_by: {
    zuid: 66466723,
    is_confirmed: false,
    email_id: "emma@zylker.com",
    first_name: "Amelia",
    last_name: "Burrows",
    user_type: "Admin",
    user_id: 2136000000006003
  },
  project_details: { project_name: "ShipmentTracking", id: 2136000000007733 },
  file_details: [],
  id: 2136000000013014
}
Copied{
  folder_name: "Billing",
  created_time: "Aug 16, 2021 05:04 PM",
  created_by: {
    zuid: "66466723",
    is_confirmed: false,
    email_id: "emma@zylker.com",
    first_name: "Amelia",
    last_name: "Burrows",
    user_type: "Admin",
    user_id: "2136000000006003"
  },
  modified_time: "Aug 16, 2021 05:04 PM",
  modified_by: {
    zuid: "66466723",
    is_confirmed: false,
    email_id: "emma@zylker.com",
    first_name: "Amelia",
    last_name: "Burrows",
    user_type: "Admin",
    user_id: "2136000000006003"
  },
  project_details: { project_name: "ShipmentTracking", id: "2136000000007733" },
  file_details: [],
  id: "2136000000013014"
}