Hello,
I am trying to create a button that moves a record reference in a table from one field (“User”) to another field (“Archived User”). I noticed this can be done without scripting through Fibery’s no-code automations, but, there is a conditional that I need built into the button:
if (User!=""){
... }
This is the code I have so far:
const api = context.getService("fibery");
for (const entity of args.currentEntities) {
const UserIds = await api.getEntityById(entity.type, entity.id, [["User"]]);
if (UserIds != null) {
await api.updateEntity(entity.type, entity.id, { "Archived User": UserIds });
await api.updateEntity(entity.type, entity.id, { "User": "[]" });
}
}
And that code is throwing this unexpected exception…
Failed to execute action "Script": field.toLowerCase is not a function
Any help is appreciated!
Disclaimer
I am new to Fibery, and I know there may be better ways to structure my app, but please note my main purpose of posting this is to focus on learning the API/scripting portion of Fibery.
I have read these so far to construct the above code:
- [✔️ DONE] Duplicate a record - #7 by Polina_Zenevich
-
Action buttons (old) | Fibery Help Center
** i know I probably should have read this one instead but didn’t find it until recently: Automated Action Buttons (new) | Fibery Help Center - fibery-community / Action Buttons · GitLab
- close-task-and-all-subtasks/readme.md · master · fibery-community / Action Buttons · GitLab
- Fibery API
- And though only tangentially related, this is listed also as it was extremely inciteful reading, the Fibery founders thoughts on low-coding automation… https://fibery.io/blog/automations-concepts-overview-for-no-code-tools/