Difference between revisions of "InRole"

From SmartWiki
Jump to: navigation, search
(Created page with '@me.inRole(Rolename)@ There are three things to use caution about this new and user-friendly syntax. 1. Case Sensitive – Watch for lower case “i” and upper case “R” 2…')
 
 
(21 intermediate revisions by 4 users not shown)
Line 1: Line 1:
@me.inRole(Rolename)@
+
This syntax can be used on [[Submit Logic]], [[Advanced Logic]], [[Visibility Condition|visibility conditions]], [[Custom Field Type: Special – Browser Script|browser scripts]] or any other role-specific [[validation]]. It will always return a value, either true or false.  
  
There are three things to use caution about this new and user-friendly syntax.
+
<pre>@object.inRole(Rolename)@</pre>
  
1. Case Sensitive – Watch for lower case “i” and upper case “R”
+
There are three things to use caution about this syntax:
2. Do not encapsulate the whole syntax – This syntax always returns a value, either true or false which mostly would not cause any problems for example in sslogic or visibility conditions. However encapsulation of the syntax would basically return a string which is useless if not equalled to another string. 
 
3. Do not encapsulate the role name –  This I believe is looping the role names in the instance and tries to match what is in the brackets. Use the exact role name without encapsulating.
 
  
Correct: @me.inRole(Organization Contact)@
+
*'''Case Sensitive''' – The syntax must be '''inRole''' exactly: lower case “i” and upper case “R”
Wrong: @me.inRole(Organization Contact)@
+
*'''Do not encapsulate the whole syntax''' – This syntax always returns a value, either true or false which mostly would not cause any problems for example in [[sslogic]] or visibility conditions. However, encapsulation of the syntax will return a string which is useless if not equaled to another string. 
Wrong:   @me.inRole(“Organization Contact”)@
+
*'''Do not encapsulate the role name''' –  Use the exact role name without quotes.
Wrong: @me.inRole(“Organization Contact”)@
+
 
Wrong:   @me.InRole(Organization Contact)@ OR @me.inrole(Organization Contact)@
+
{|
 +
|'''Correct''':
 +
|'''''@me.inRole(Organization Contact)@'''''
 +
|-
 +
|<font color="red">'''Wrong''':</font>
 +
|''"@owner.inRole(Organization Contact)@"'' - don't put quotes around the variable. It's a true/false value, not a string.
 +
|-
 +
|<font color="red">'''Wrong''':</font>
 +
|''@me.inRole("Organization Contact")@'' - don't put quotes around the role name. The role name is ''Organization Contact'', not ''quote Organization Contact unquote''.
 +
|-
 +
|<font color="red">'''Wrong''':</font>
 +
|''"@me.inRole("Organization Contact")@"'' - don't put quotes around both things...
 +
|-
 +
|<font color="red">'''Wrong''':</font>
 +
|''@me.InRole(Organization Contact)@'' OR ''@me.inrole(Organization Contact)@'' - use the correct capitalization, ''inRole''
 +
|-
 +
|<font color="red">'''Wrong''':</font>
 +
|''@me.inRole(''rolename1'' OR ''rolename2'')@'' - instead of this, use ''@me.inRole(''rolename1'')@ OR @me.inRole(''rolename2'')@''
 +
|}
 +
 
 +
The syntax for the test of when a contact is ''not'' in a role is to precede the ''inRole'' variable with an exclamation point ("!").
 +
<pre>!@object.inRole(Rolename)@</pre>
 +
 
 +
An example is that ''!@me.inRole(Administrator)@'' will return true only when the current user is not in the role of Administrator.
 +
 
 +
 
 +
==See Also==
 +
* [[Boolean Operators]]
 +
 
 +
[[Category:To Move Later]]

Latest revision as of 13:36, 20 October 2017

This syntax can be used on Submit Logic, Advanced Logic, visibility conditions, browser scripts or any other role-specific validation. It will always return a value, either true or false.

@object.inRole(Rolename)@

There are three things to use caution about this syntax:

  • Case Sensitive – The syntax must be inRole exactly: lower case “i” and upper case “R”
  • Do not encapsulate the whole syntax – This syntax always returns a value, either true or false which mostly would not cause any problems for example in sslogic or visibility conditions. However, encapsulation of the syntax will return a string which is useless if not equaled to another string.
  • Do not encapsulate the role name – Use the exact role name without quotes.
Correct: @me.inRole(Organization Contact)@
Wrong: "@owner.inRole(Organization Contact)@" - don't put quotes around the variable. It's a true/false value, not a string.
Wrong: @me.inRole("Organization Contact")@ - don't put quotes around the role name. The role name is Organization Contact, not quote Organization Contact unquote.
Wrong: "@me.inRole("Organization Contact")@" - don't put quotes around both things...
Wrong: @me.InRole(Organization Contact)@ OR @me.inrole(Organization Contact)@ - use the correct capitalization, inRole
Wrong: @me.inRole(rolename1 OR rolename2)@ - instead of this, use @me.inRole(rolename1)@ OR @me.inRole(rolename2)@

The syntax for the test of when a contact is not in a role is to precede the inRole variable with an exclamation point ("!").

!@object.inRole(Rolename)@

An example is that !@me.inRole(Administrator)@ will return true only when the current user is not in the role of Administrator.


See Also