Тёмный

Salesforce in Telugu ( Process Builder - Part - 06 | Apex Class ) || salesforce videos in telugu 

Salesforce By Venkat Yadav
Подписаться 13 тыс.
Просмотров 2,5 тыс.
50% 1

For Salesforce Online Training Contact Us ( Call & WhatsApp ) : +91-7097777111 & 222
Instagram 🔗 sfdcindia?...
Telegram 🔗 t.me/sfdcindiatraining
Example : Apex Class Methad [When Account Status = 'Closed' then Automatically Contacts Status Should be Closed]
=========
On Account obj -- Create Picklist field Status=[Open/Closed]
On Contat obj -- Create Picklist field status=[Open/Closed]
1 . Process Name : Apex Class Methad When Account Stutas ='Closed' Auto Contact Status ='closed'
The process starts when : A Record changes
2 . Add the Object : Account [ when a record is created or edited ] click on Save
3 . Add the Criteria : Stutas = Closed. [Criteria Name also Same ]
Select : All of the conditions are met (AND)
4 . Add the Action : Action Type -- Apex.
Action Name -- When Account Stutas ='Closed' Auto Contact Status ='closed'.
Apex Class -- RelatedConatctHandler.
Set Apex Variables - accountidList- Field Reference -- Account ID.
5 . Save.
6 . Activate the Process builder.
Apex Class :
===========
public class RelatedConatctHandler {
@invocableMethod
public Static void closeContactForAccounts(List id accountidList){
List Contact contactList=[select id,status__c from contact where status__c!='Closed' AND Account.Status__c='Closed' AND Accountid in :accountidList];
for(contact c:contactList) {
c.status__c='Closed';
}
update contactList;
}
}
NOTE :
******
1 . in order to invoke Apex class From Process Builder, you need to make sure the class has a method declared with "@invocableMethod" annotation
2 . an Apex class can only have one invocableMethod.
3 . an invocableMethod must be defind as static and either public or global.
4 . Other annotations cannot be combined with the invocableMethod annotation.
5 . invocableMethod cannot be used in Apex Triggers
=========================================================
Process Builders cannot handle :
================================
1 . Process Builders cannot handle before DML It executes after a record has been created or updated.
Whereas Apex triggers can handle both before and after DML operations.
2 . Process Builder cannot handle delete and undelete DML. Whereas Apex triggers can handle all DML operations.
3 . Whenever a particular use case is not possible using Process Builder, consider using Apex triggers.

Опубликовано:

 

21 дек 2018

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии    
Далее