Allow Users to See Only Records Owned by Same Role

This restriction rule allows active users to see only the events owned by users that have the same role. You can use dot notation to traverse object and field relationships in the recordFilter field.

Where possible, we changed noninclusive terms to align with our company value of Equality. We maintained certain terms to avoid any effect on customer implementations.

Important

Available in: Lightning Experience in Enterprise, Performance, Unlimited, and Developer Editions

Tooling API

{
    "FullName":"restictionruleeventsrole",
    "Metadata": {
        "active":true,
        "description":"Allows active users to see only events owned by users of the same role.",
        "enforcementType":"Restrict",
        "masterLabel":"Events Owned by Same Role",
        "recordFilter": "Owner:User.UserRoleId = $User.UserRoleId",
        "targetEntity":"Event",
        "userCriteria":"$User.IsActive = true",
        "version":1
    }
}

Metadata API

<?xml version="1.0" encoding="UTF-8"?>
<RestrictionRule xmlns="http://soap.sforce.com/2006/04/metadata">
    <active>true</active>
    <description>Allows active users to see only events owned by users of the same role.</description>
    <enforcementType>Restrict</enforcementType>
    <masterLabel>Events Owned by Same Role</masterLabel>
    <recordFilter>Owner:User.UserRoleId = $User.UserRoleId</recordFilter>
    <targetEntity>Event</targetEntity>
    <userCriteria>$User.IsActive = true</userCriteria>
    <version>1</version>
</RestrictionRule>