Hi team!
My app creates a new folder when a new sale is done (an automation that creates a dummy pdf with route of the file containing /data/appsheet/newsalecode/Dummyfile
Is it possible to modiffy via API the name of the folder after?
I know its a little complicated but sometimes the sale code contains some extra info that is added during the sale and not at the beggining.
thanks as always!
Solved! Go to Solution.
So you are saying the [customer purchase id] might change at some point? And at that point you would want to rename the folder?
In this case Google Apps Script would be your friend. I would suggest adding a new bot with a data change event on updates only. The condition for execution probably should be [_THISROW_BEFORE].[customer purchase id] <> [_THISROW_AFTER].[customer purchase id]. Create a google apps script file with a function like this:
function changeFolderName(oldpurchaseid, newpurchaseid) {
let folders = DriveApp.getFoldersByName(oldpurchaseid);
if(folders.hasNext()) {
let folder = folders.next();
folder.setName(newpurchaseid);
}
}
In your process you would select 'run a task' => 'run a script'. Select the google apps script file, you may have to authorize the script first, then select function, then it will bring up two fields for your variables in your function.
For oldpurchaseid the setting would be [_THISROW_BEFORE].[customer purchase id]
For newpurchaseid the setting would be [_THISROW_AFTER].[customer purchase id]
For full disclosure, your app needs to run as the creator, or the app user needs to have full access to the parent folder of where this folder is stored in the case where you run the app as the user. Additional finagling might still be required since this is just off the top of my head and have not tested this.
User | Count |
---|---|
15 | |
9 | |
9 | |
7 | |
3 |