Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3



According to the ECMAScript standard (ECMA-262, 3rd edition), "An ECMAScript program is considered syntactically incorrect if it contains a return statement that is not within a FunctionBody.". Therefore, you must first define a function and then invoke it within your script as show in the example below. Note, as the last statement in the script, the result of the function call will automatically be returned as the value of the script.

Code Block
titleExample Policy Requirement Rule using the Script Match Functionxml
<PolicyRequirementRule xsi:type="basic:Script">
            function evaluateRule(filterContext, attributeId, attributeValue) {
               if (attributeId == null) return true;
               if (attributeValue == null) return true;
               return filterContext.getAttributeRequestContext().getAttributes().get("uid").equals("jsmith");
            evaluateRule(filterContext, attributeId, attributeValue);