ACL condition script examples

Show a control only when the phase equals Concept

Use the script below to apply an ACL only when the object is in the Concept phase:

if (!g_serviceguid) return false;

var service = JSON.parse(
    ServiceCatalogInterface.getServiceOverview(g_serviceguid)
);

return service && service.phase && service.phase.name === "Concept";

Show a control starting from a minimum phase

If a control should become available from a specific phase onward, use a greater-than-or-equal check.

Example: only from phase Final approval (order = 5):

if (!g_serviceguid) return false;

var service = JSON.parse(
    ServiceCatalogInterface.getServiceOverview(g_serviceguid)
);

return service && service.phase && service.phase.order >= 5;

Show a control when the phase is X OR Y

Example: show the control when the phase is Concept OR Waiting OR when a specific field is set to Yes.


Exclude specific document categories

You can deny access to documents with certain category values.

Example:

  • Document part: Doc_Category

  • Categories to exclude: CatA, CatB, CatC, CatD, CatE

  • Applied to Persona: External

Result: Personas with this ACL will not see documents that belong to these categories.

⚠️ Note You must explicitly grant access to other Personas via a separate ACL.


Include only specific document categories

To grant access only to certain document categories:

Example: allow access only to categories CatA and CatB

⚠️ Important You typically need a second ACL that excludes these categories for Everyone.


Apply ACL only when a template part has a specific value

Example: apply the ACL only when the part with internal name INTERNAL_NAME equals CheckValue.


Apply ACL when a part has a value AND phase equals Concept


Apply ACL when a part is different from a value AND phase equals X

Example:

  • Phase must be Active

  • Field Object_Specification must not equal Consulting


Final notes

  • Always return a boolean

  • Always guard against missing g_serviceguid

  • Prefer clear, readable conditions over compact code

  • Test ACL scripts thoroughly before releasing to production

Last updated

Was this helpful?