I’m having issues trying to conditionally render a button based on a new row being inserted into a table.
I want a button to render based on a value selected in a pick-list field. I have my model set to ‘Create new default Row if model has none,’ so that there is already a row in the table/model when the user first navigates to the page. The render condition seems to be working fine when selecting a value for this first row in the model (without having to save), but it isn’t working when clicking ‘+’ to add a new record to the table and then selecting a value for the new record in the table. I want my render condition to listen to all rows in the model and render the button if one or more of the records in the table have a certain value.
I greatly appreciate any help on this!
Where is the button rendering you want to render? Is it on the rows on the tables?
Or is it more of a header record, with detail records below?
What I understand you want is:
- A button on a header/master record of the page to appear when detail records in a table at the bottom of the page (so to speak) have one field set to a specific value.
- In the detail records, you have a field which is a picklist. When they pick ‘Option C’, you want a button in the master portion of the page to be rendered.
Does this sound about right?
This is the way I’d approach it.
I think you’ll need a snippet action in a ‘row updated in model’ on that picklist field.
The snippet would have to look at the value the picklist value then update another field in the ‘header’ model which triggers the button render.
I’ve read here about using a ‘dummy’ field to trigger this sort of render. I’ve never done that myself though (yet…)
This post talks about using the id field for a dummy field, but not sure it would work for this since you need to update it temporarily.
I’ve also frequently thought of making a salesforce object with many different field types just to use for dummy fields. That object would never actually be saved, just use them for a string field the user can enter/edit to have a snippet work on elsewhere. There would never be any actual rows in the SF object. It’s definitely a hack.