Default boolean checkbox true or false with profile dependancy

  • 1
  • Question
  • Updated 7 months ago
  • Answered
Senior Jisc Management profile should have a checkbox checked on new record load

Another profile should have the record unchecked on new record load.

How can this be easily achieved, without creating a new page?

I am open to the idea of using Javascript snippet on page load action if somebody can help me with the code, my example below isn't working, and i'm not sure how to fix it! Thanks for your help

if ($User.Profile.Name == 'Senior Jisc Management') { 
 
        var model = skuid.$M('Event');
        var row = model.getFirstRow();
        var alldayevent = true;
        model.updateRow(row,{IsAllDayEvent : alldayevent});
}
Photo of Glenn Daly

Glenn Daly

  • 1,270 Points 1k badge 2x thumb

Posted 7 months ago

  • 1
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Replace $User.Profile.Name w/ skuid.utils.userInfo.profileName.
Photo of Glenn Daly

Glenn Daly

  • 1,270 Points 1k badge 2x thumb
hero! thanks very much
Photo of David Forder

David Forder

  • 2,144 Points 2k badge 2x thumb
Model actions would work also.. for those of us java challenged )
Photo of Mark DeSimone

Mark DeSimone, Official Rep

  • 11,050 Points 10k badge 2x thumb
To build on David's suggestion, you could set up a UI-only formula field that returns a checkbox. The formula could use the merge variables discussed here: https://docs.skuid.com/latest/en/skuid/merge-syntax/global-merge-variables.html#user

Namely, {{$User.profileId}} could be used with a CASE operation (see "CASE" and examples here: https://docs.skuid.com/latest/en/skuid/models/ui-only-models-fields.html#text-manipulation-and-analy...). 

The formula could look like this:
CASE({{$User.profileId}},"[add your 18-digit profile Id #1]", TRUE,"[add your 18-digit profile Id #2]", FALSE)