Is there a way to access salesforce isAccessible() method in SKUID?
I have a button that needs to be displayed only for particular set of users who could have access given by a permission set or a profile.
Thanks in-advance.
Yes the “accessible” property on Model Field metadata will tell you this. You can get access to Field metadata from JavaScript via the “getField” Model API method as long as the field is in your Skuid Model. So for instance if the Contact Birthdate field is in a Skuid Model on your page called “Contact” you can do this:
var birthdateFieldIsAccessible = skuid.$M(‘Contact’).getField(‘Birthdate’).accessible;
Thanks, That helps Zach, I got another question, Is it possible to render a Global Action of a Table component with javascript? (I want to display the action button on the table based on the permissions of a custom object)
Hasantha, what I would do is this: setup a “dummy” Model, e.g. a Model on the Account object, with “Create default row if Model has none” set to true, and “Load Model data on page load” turned OFF. Add a Ui-Only field on this Model called something like “HasPermissionToUseGlobalAction”, that’s a Checkbox / Boolean field. Then you can Conditionally Render the Global Action based on the value of this field. THEN, use JavaScript to populate the value of this Ui-Only field on your dummy Model on initial page load, or whenever you’re able to determine whether to display it or not.
Thanks Zach, your solution worked!
Hello Zach, I’m trying your solution… just a question: when you said “THEN, use JavaScript to populate the value of this Ui-Only field on your dummy Model on initial page load” how can I do it? I tried adding the following to the function " $(document.body).one(‘pageload’,function() "
skuid.$M(‘Permission’).getField(‘HasPermissionToPromoteScenario’).Value = true;
where “Permission” is my dummy model.
but it doesnt work… If I remove the JS line and I load the page, when I inspect the attribute of “skuid.$M(‘Permission’).getField(‘HasPermissionToPromoteScenario’)” there is not a “Value” attribute.
I figured it out!
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.