Skip to main content

We have a serious need for the ability to conditionally render fields based on a “business rule.”  Unfortunately, the business rule true/false cannot easily be materialized in a model field value in order to leverage the stock conditional rendering features.  That said, being able to leverage the stock conditional rendering is fairly critical to the overall solution.

Ask: Add the ability to call a function (snippet) in a conditional rendering rule.  For example, add a new “Source Type” of snippet with a property value of “snippet name”.  If chosen, skuid would call the snippet and expect a true/false result.  

This has been discussed in various threads that led to the enhanced conditional rendering features that were added to skuid recently (model field value, model property, row property).  Unfortunately, this one didn’t make the cut.  

Wondering if this is possible to add?

Here is our specific use base:
We have fairly complex business rules and apply security through a custom approach that complements SFDC Roles/Profiles.  A user might have read/write access to the Account object but for some records be restricted to Read while others records have full read/write.  We need to be able to show/hide fields and editability based on a number of factors. If we were able to call a snippet, we could evaluate the rule and show/hide the field appropriately.  For example, we could have a field in the editor twice - one for Read-only and one for read-write and show/hide the appropriate one based on security.  This applies to other page components like buttons, tabs, etc.  Unfortunately, trying to leverage record types alone does not meet the requirement.  Having the ability to evaluate true/false in a snippet while being able to declaritively define the rules would be a tremendous alternative to having to programmatically create conditions on page load or the other crazy ideas that I’ve come up with so far 🙂

As always, appreciate the consderation.

Thank you!

I’ve used formula rules to evaluate business rules and then used the results to conditionally hide/show and control editabilty in a custom application. Have you consider using formula fields for some of your use cases?


Hi Irvin -

Thanks for the input.  We use formulas for certain things and that has gotten us by thus far.  Unfortunately, the next level of what we need can’t be handled in formulas as the logic involves analysis that formulas can’t natively handle.  Now, if Formulas could call Apex methods… 🙂

Appreciate your willingness to help!


I have marked this as an idea under consideration, there are certainly use cases where running a snippet would be ideal or required.

Barry, for your use cases, would these Snippets need to be able to perform AJAX requests, e.g. run Apex logic? That would complicate things quite a bit, as Conditional Rendering logic ordinarily executes synchronously. 


Thanks Zach.

In our particular case, we would not need to do anything async.  As you imply, doing things async on UI centric operations would not be a good thing.

From a design perspective, I could see you offering deferred’s and leave it to the implementer to understand the consequences.  At least that would give them the option if it was ever required.

That said, for this type of feature, I think restricting it to synchronous calls is likely the best path and minimizes the risk from the Skuid side.  If someone chooses to make a remote call from within the synchronous path, they still could do so - I just wouldn’t want to be the user on the other side of that page 🙂

Thanks!


This reply was created from a merged topic originally titled Render table row actions with custom javascript renderer. It would be nice to be able to choose to use a custom javascript renderer for row actions.

I want to render a row action based on whether a value on the table’s row matches the value of  any row in another model. I can’t find a way to do that with regular rendering conditions.

The ability to render row actions with javascript without writing a whole custom table view would make tables and row actions much more flexible.