I’d like to find a way to make a few fields read only based on a users role. I’ve created a model that contains this information via the User object but I’m unsure how to access this information through javascript.
Access model data via the skuid api:
http://help.skuidify.com/m/11720/l/205447-skuid-model-model
Can you limit editing rights based on the Field Level Security for that role? Standard SFDC functionality vs javascript?
Thanks, guys. I was able to do so via bastardized code below. I created a model called ‘Running User’ and pulled in role. After creating this snippet I modified the ‘Field Renderer’ field property to
‘Custom run a Snippet’ and input the snippet name.
var m = skuid.model.getModel(‘RunningUser’);
var row = m.getFirstRow();
var fieldToCheck = row.UserRole.Name;
var field = arguments 0],
$ = skuid.$,
value = arguments>1];
// Set the value to be read only if the role is ‘Child’
if (fieldToCheck == ‘Child’) {
field.mode = ‘readonly’;
var renderers = skuid.ui.fieldRenderers;
var dt = field.metadata.displaytype;
var r = renderersddt];
if (!r) r = renderers.PICKLIST;
r.readonly(field,value);
} else {
skuid.ui.fieldRendererslfield.metadata.displaytype] field.mode](field, value);
}
Glad you got it working.
Unless I’m mistaken, skuid respects your SFDC field level security.
You’re right, Matt.
The only issue with FLS in this scenario is it’s based on profiles or users (via permission sets) not roles.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.