-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathsharing-rules.ts
More file actions
63 lines (59 loc) · 1.9 KB
/
Copy pathsharing-rules.ts
File metadata and controls
63 lines (59 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
import type { SharingRuleInput } from '@objectstack/spec/security';
/**
* Criteria-based sharing: share high-value opportunities (amount > 100000)
* with the Sales Manager role so managers always have read access to big deals.
*/
export const HighValueOpportunitySharingRule: SharingRuleInput = {
type: 'criteria',
name: 'share_high_value_opps_with_managers',
label: 'High-Value Deals → Sales Managers',
description: 'Automatically share opportunities over $100,000 with all Sales Managers.',
object: 'crm_opportunity',
condition: 'record.amount > 100000',
accessLevel: 'edit',
sharedWith: {
type: 'role',
value: 'sales_manager',
},
active: true,
};
/**
* Owner-based sharing: leads owned by a Sales Rep are shared read-only
* with their manager so managers can coach on individual pipelines.
*/
export const RepLeadSharingRule: SharingRuleInput = {
type: 'owner',
name: 'share_rep_leads_with_manager',
label: "Rep's Leads → Manager (read-only)",
description: "Share each rep's leads with the Sales Manager role for coaching visibility.",
object: 'crm_lead',
ownedBy: {
type: 'role',
value: 'sales_rep',
},
accessLevel: 'read',
sharedWith: {
type: 'role',
value: 'sales_manager',
},
active: true,
};
/**
* Criteria-based: share activities linked to won deals with the whole
* Sales team so everyone can learn from successful engagement patterns.
*/
export const WonDealActivitySharingRule: SharingRuleInput = {
type: 'criteria',
name: 'share_won_deal_activities',
label: 'Won-Deal Activities → All Sales',
description: 'Share activities attached to closed-won opportunities across the sales team.',
object: 'crm_activity',
condition: "record.status == 'completed'",
accessLevel: 'read',
sharedWith: {
type: 'role',
value: 'sales_rep',
},
active: true,
};