Is there a way to send more than one parameter to a reusable element?
Context: A page has a group called school, which displays data based on which school is selected in a dropdown at the top of the page. Within this group is a task list so that admins can keep track of tasks related to that school. There is a reusable pop-up element for viewing and editing individual tasks that can be accessed both from this page and from a separate page for different staff. The popup also has a schools dropdown, as admins may want to add tasks for other schools once they’ve opened it.
I have this set up to Display Data in a Group/Popup, and automatically populate whatever task was clicked. Great, if I’m editing an existing task. But if I want to create a new task, I’d like the schools dropdown’s Default Value to be whatever school is active on the underlying admin page. But to do this, I’d have to change the data type of the whole popup to School rather than Task, thus breaking the functionality when the popup is opened on clicking an existing task.
Is there any way to do this? Or am I best off just creating two reusable elements?
Ok, this is promising! I added a parameter for School. What workflow would I use to set that value? I can’t access it from Display Data in a Group/Popup.
You can get the value from a custom state / URL / elements that have the data you want or do a search for it, properties can’t be changed with a display data action.
If you need to change it with workflows, you might as well just use a custom state, but what you can do is, you keep the data source in a hidden group with the type of content you want, and when you want to change it, you can do it with a condition, or a display data.
While I’m still curious about how the custom properties function works, I figured out I can just do this with a custom state on the reusable and set the state with a workflow on click. Dunno why that didn’t occur to me. Thursday brain.
I like to use properties as a picker for things I want to change dynamically in reusables across the app, or to pass data from one element to another without using actions.
For example, you can build a custom toggle and set one property for the background color and another for the toggle color.
Then you can place that same reusable anywhere in the app, and whenever you want a different color, you just change it in the property — or drive it with a condition.
Yeah, custom state was the right answer. The source doesn’t even need to be hidden as it’s just pulling whatever school is being displayed on the main page.
What I would do for your use case is make a parameter on the reusable element, set to school type of data and make it OPTIONAL, then on your page where the school is already selected by something, set on the reusable element property value the selected school from dropdown on page by just putting dynamic expression of dropdown value.
This way if there is no school, the property value is empty and if a school is selected the property value is not empty and matches the pages selected school.
This way there is no extra steps to set and clear the custom state. Although setting the custom state as you found does work, in your use case of the main data type of task being empty you can reference custom state of school, but since the school is already selected on page via dropdown, I personally prefer the parameter value being set to optional and just reference the dropdown on page value…it’s less work overall, and properties are easier to see on a reusable than a custom state.