1

In my dev org, I could do if('{!$Permission.Manage_Advanced_Org_Settings}'){}, however, I tried to package and install in another org and got 'Manage_Advanced_Org_Setting does not exist. Check Spelling' error. I tried adding the namespace to it as well, but got the same error.

I am accessing it through JavaScript, not in an VF apex components, which may be the issue. Is there a way to do this in JavaScript and not VF?

4
  • Did you add you try $Permission.Manage_Advanced_Org_Settings__c? Jul 12 '17 at 20:41
  • I think you need to include the namespace. Maybe $Permission.ns__MySetting.
    – Adrian Larson
    Jul 12 '17 at 20:57
  • Ugh, Salesforce.... so after trying to figure out what on Earth was wrong with this, because I did have the namespace in it... Finally found out it was another piece of code that had the $Permission.Manage_Advancedblah blah without the namespace. Even though it was commented out, Salesforce was trying to read it and throwing a fit because it couldn't recognize the field with the namespace. Jul 12 '17 at 21:18
  • Seems worth posting as an answer.
    – Adrian Larson
    Jul 13 '17 at 4:06
1

It turns out that adding the namespace did indeed fix the issue. so $Permission.ns__MySetting (or whatever ones namespace and custom setting name is) is correct, while $Permission.MySetting caused the error when installed into other orgs that use a namespace.

My issue was, that a commented out $Permission.MySetting was still trying to be interpreted by SalesForce despite being commented out. And, since it didn't have a namespace, it caused the error.

I had this issue with remote method calls from my javascript to my apex controller as well. It seems any accessor of apex/salesforce that starts with '{!$' will be counted even if commented out and throw errors if any exist, which seems like a potential bug on their part that SalesForce doesn't seem to interpret comments correctly when those are in there and apparently doesn't count them as being commented out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.