UI-Only field to add CSS properties

UPDATE: to quickly summarize, 1st clause (based on profile name) works. 2nd clause (based on UI-only field) does not work.

I have an In-line Javascript code to add CSS properties.

It works fine for the first clause of the if statement (a user whose profile starts with “RO_”).

I have a UI-field, in the model ‘Office’, that I would like to do the same with.

I confirmed in the developer console that “UIinput” equals RegionalOffice, once it is selected in the picklist. (Which would make the else if clause true)

I suspect it has something to do with function being run on page load, but was hoping someone could confirm that for me. I am still a JavaScript newbie.

Thanks in advance for any help.

(function(skuid){ var $ = skuid.$;

var profile = skuid.utils.userInfo.profileName;
        var profilePrefix = profile.substring(0, 3);
        var UIfield = skuid.model.getModel(‘Office’);
        var UIinput = UIfield.data[0].OfficeType;

if (profilePrefix === “RO_”) {
            $(function() {
                $(‘.corp-exclusive’).css(“display”, “none”);
        } else if (UIinput === “RegionalOffice”) {
            $(function() {
                $(‘.corp-exclusive’).css(“display”, “none”);
        } else {


Is the UI-only field populated before page load or do you select a value after the page is loaded (you mentioned once it’s selected but I’m not sure when you’re selecting the value)?

If you select the value after page load then your snippet isn’t working because OfficeType doesn’t have data on page load. Instead you could add an action to the Office model to run a snippet when the OfficeType UI field is updated. That snippet would be an in-line snippet javascript resource and you could check the value of the UI field and then update your css accordingly. It would be similar to your snippet above only you wouldn’t have to check for pageload.


Thanks Amy! Sorry for the belated thank you. That worked perfectly!