Update dropdown with values from the same column using Bridge
We have a sheet to track new employees, their roles, locations, etc. When new roles are created and added to the roles column, I want to run a bridge workflow to update the dropdown with the new role to ensure the dropdown list contains all existing roles. I have a bridge workflow setup to test this, but I have only been able to update a different column in the sheet. Is there a way to update the Roles dropdown using the values from the Roles column?
Thanks!
Best Answer
-
The JS array looks perfectly fine. But your reference for the column ID looks like it's missing the id in the reference that you posted.
Instead of {{states.startstate.smartsheet.get_sheet.sheet.columns.5}} it should be {{states.startstate.smartsheet.get_sheet.sheet.columns.5.id}}
Answers
-
Sure. Smartsheet API doesn’t care where you get the array from. So, if you have it working already to read the list of choices in the column and update a different column, just update the Role column instead of the other column.
-
@Brian_Richardson, are you saying to use an API call to update the column after I've sorted and filtered the list? When I try and load the new array into the original column I get the following error message:
workflow execution failed: Plugin Error INVALID_DATA : failed to execute extension module : Column titles must be unique.
The error is from the last step in the below.
-
In the update column step don’t put a name unless you’re trying to rename the column. Make sure you have the right column ID for the Role column. You can get that from a quick Get Sheet in a temporary workflow or by making the call in Postman.
I was speaking generally about the APi call. Update column should work great.
If you google for it, there’s actually instructions on this exact workflow posted in Smartsheets docs as an example.
-
now I'm getting this error after updating the column id to the target column and removing a name in the column name on the update column step.
-
Hi @Dylan T,
It looks like the error is in the second module (the “Sort Object Array” module). Since the message in the error states “attempt to index a nil value”, I’d recommend double checking that the array in the run that errored had data.
This help article contains step-by-step instructions, including how to set up the last module: Update your dropdown columns with Bridge workflows.
If you’re still running into issues, could you provide more screenshots showing each module of the workflow clicked on, so that we can see the setup for each module showing in the right panel?
Thanks,
Georgie
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
-
Hi @Georgie,
I was getting a weird error so I rebuilt the workflow. I haven't set up the trigger yet so I could test faster. Here are the screenshots and the new error message I'm receiving.
{{states.startstate.smartsheet.get_sheet.sheet.columns.5}}
Any insight would be much appreciated.
Thanks!
-
What does the output of your script look like? Generally you don’t need JavaScript to do a column dropdown list update unless you’re doing something fancy like duplicate removal.
-
Here is my JS. I'm sorting and removing duplicates. The JS worked fine when loading to a different column.
Script name: Sort Array and Remove Duplicates
function getUniqueValues(inputArray) {
// Remove duplicates by converting the array to a Set
const uniqueValues = Array.from(new Set(inputArray));
// Sort the array alphabetically using localeCompare
uniqueValues.sort(function(a, b) {
return a.localeCompare(b);
});
return uniqueValues;
}
// Example usage:
const originalArray = yourArray;
const uniqueArray = getUniqueValues(originalArray);
return uniqueArray; -
So from your run log in the workflow that threw that last error, click the menu next to the results array from the Javascript step and pick "Copy JSON Source" then paste the result into this chat pls.
Also do the same with the output from the Extract Field step that's feeding your Javascript.
There's a problem somewhere in the format of either the array that you're feeding the Jscript, or in the output of the Jscript itself, that's causing the update to fail because it cannot read it.
-
output from JS array: ["Assistant Community Manager","Cleaning Professional","Community Manager","Facilities Director","Floating Leasing Specialist","Groundskeeper","Leasing Professional","Marketing and Events Coordinator","Senior Regional Management Specialist"]
output from extract step array: ["Leasing Professional","Cleaning Professional","Marketing and Events Coordinator","Community Manager","Leasing Professional","Assistant Community Manager","Community Manager","Floating Leasing Specialist","Assistant Community Manager","Community Manager","Leasing Professional","Groundskeeper","Leasing Professional","Facilities Director","Leasing Professional","Floating Leasing Specialist","Senior Regional Management Specialist"]
-
The JS array looks perfectly fine. But your reference for the column ID looks like it's missing the id in the reference that you posted.
Instead of {{states.startstate.smartsheet.get_sheet.sheet.columns.5}} it should be {{states.startstate.smartsheet.get_sheet.sheet.columns.5.id}}
-
That did the trick. I appreciate your help on this one!
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.9K Get Help
- 441 Global Discussions
- 139 Industry Talk
- 472 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 68 Community Job Board
- 496 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives