Jaa asiaan liittyvien tietueiden väliaikainen käyttöoikeus hyväksyjillesi määrittämällä käynnistimiä. Kun hyväksymistoiminto on suoritettu, käytä käynnistintä poistaaksesi tietueen käyttöoikeuden.
Kun lähetät tietueen hyväksyttäväksi, hyväksyjällä täytyy olla tietueeseen liittyvän objektin käyttöoikeus suorittaakseen hyväksymispyyntöön liittyviä toimintoja. Jos objektisi sisäisen organisaationlaajuinen oletusarvoinen jakoasetus on Yksityinen, voit käyttää käynnistintä luodaksesi jako-objektin, joka myöntää käyttöoikeuden hyväksyjälle. Kun tietue on hyväksytty, voit kumota tietueen käyttöoikeuden käyttämällä käynnistintä poistaaksesi tietueen.
Jos jaat mukautetun objektin käyttöoikeuksia, voit luoda Apex-jaon syyn ja lisätä sen käynnistimeen. Apex syy rajoittaa tietueen käyttöoikeuksia tiettyyn käyttötarkoitukseesi.
Voit mukauttaa esimerkkikoodinpätkää oman käyttötarkoituksesi mukaisesti.
trigger AWIUpdate on ApprovalWorkItem(after update) {
List<ApprovalWorkItem> awiList = new List<ApprovalWorkItem>();
// Get the related opportunities for the accounts in this trigger
awiList = [SELECT Id, RelatedRecordId, AssignedToId FROM ApprovalWorkItem WHERE Id IN :Trigger.new];
for (ApprovalWorkItem awi : awiList) {
// Use the related record id, to delete the share record created for the user
Id relatedRecordId = awi.RelatedRecordId;
Id assignedToId = awi.AssignedToId;
SObjectType relatedRecordType = relatedRecordId.getSObjectType();
if (relatedRecordType.getDescribe().isCustom()) {
Map<String, Schema.SObjectType> tokens = Schema.getGlobalDescribe();
String relatedRecordShareName = relatedRecordType.getDescribe().getName().removeEnd('__c') + '__Share';
if(tokens.containsKey(relatedRecordShareName)) {
// Share object exists
SObject[] customShare = Database.query('SELECT Id FROM '
+ relatedRecordShareName + ' WHERE '
+ ' RowCause = \'AdvancedApprovalTriggerShareReason__c\' '
+ ' AND ParentId = :relatedRecordId'
+ ' AND UserOrGroupId = :assignedToId');
} else {
// OWD is Public Read Write
}
}
}
}

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.