Provide context parameter to Conditional Rendering snippet returns true

  • 6
  • Idea
  • Updated 3 months ago
  • Under Consideration
  • (Edited)
Love the fact that Skuid has added the ability to call a snippet in conditional rendering!

Unfortunately, the current design does not provide any context to the snippet that is called.  While there are some use cases that just need to globally evaluate something, more often than not what needs to be evaluated in a free-form snippet pertains specifically to the data in context (e.g. table row action, etc.)

The "context" information is present in the code path that calls the snippet so would like to see this passed through to the snippet so it can be used duration evaluation.  Without this information, many of the use cases for this feature are unattainable.

Thank you!
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb

Posted 3 years ago

  • 6
Photo of Ben Hubbard

Ben Hubbard, Employee

  • 12,490 Points 10k badge 2x thumb
We're definitely not done on this one in terms of adding features. Context should be passed into the snippet. We also plan on letting you specify when the snippet should be re-evaluated.
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Happy to hear there's more coming on this feature.  Waited a long time for this one, it's going to make so many things so much easier.  Thanks Ben!
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Voting for this and especially "We also plan on letting you specify when the snippet should be re-evaluated."
Photo of Craig Rosenbaum

Craig Rosenbaum

  • 4,776 Points 4k badge 2x thumb
I noticed rendering the element via skuid.$C('elementName').render() doesn't re-evaluate the snippet. Has anyone found a workaround for this?
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Yes. Just discovered the lack of arguments on the rendering snippet. Looking forward to the update!
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Yup. Just discovered this as well. :(
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Still waiting on this no-brainer. Another client needs this now.
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Please do this soon, skuid!
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Any update on this, Skuid?
Photo of John Dahlberg

John Dahlberg, Champion

  • 2,442 Points 2k badge 2x thumb
I'm curious as well.
Photo of John Dahlberg

John Dahlberg, Champion

  • 2,442 Points 2k badge 2x thumb
Here's a use case where this capability would be very handy.  We have a bunch of Skuid pages that are setup to mimic the related lists that you find on Salesforce record detail pages.  These are leveraged throughout our Skuid application in a similar fashion to native Salesforce.  On each of these list pages, there is a "New" button, which will open a popup that loads another page in a page include to create a new record.  It would be handy to hide that button if the user doesn't have access to create a record in order to prevent errors from occurring.  Here's the current code required to do this (which requires many snippets) and how this might look with a parameter capability:

(Many Snippets)

if(skuid.utils.getAPIDescribeSObject('Account') !== null)
    { 
        if( skuid.utils.getAPIDescribeSObject('Account').createable == 'true' ) 
        {
            return true;
        }
    }
else{
    return false;
}


Here's how it might look with a parameter approach where the pagebuilder could pass in the arguments:

(One Snippet) 

var sObject = arguments[0];
var permission = arguments[1];
var condition = arguments[2];
//other possible scenarios
var field = arguments[3];
var operation = arguments[4];

if(skuid.utils.getAPIDescribeSObject(sObject) !== null)
    { 
        if( skuid.utils.getAPIDescribeSObject(sObject).permission == condition ) 
        {
            return true;
        }
    }
else{
    return false;
}
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
BUMP!!!