Apex Trigger (Prevent Multiple Primary Contact Creation)

  Рет қаралды 7,239

Salesforce Techbook

Salesforce Techbook

Күн бұрын

It explains about how to write a trigger for the following scenario.
An shouldn't have more than 1 primary contact.
It should handle on both insert and update on contact.
References:
developer.sale...
developer.sale...
trailhead.sale...

Пікірлер: 10
@krishnaCasukhela
@krishnaCasukhela Жыл бұрын
Hello , I tried this code in my local org. The update functionality is not working as expected..
@poornarao6554
@poornarao6554 4 жыл бұрын
Nice video.. Can you please make the video on Maps by giving more examples
@COLI-UK
@COLI-UK 3 ай бұрын
This is amazing, just what I was looking for. But can you implement this without code? Using flows would be ideal for me. Thanks🙏
@salesforcetechbook
@salesforcetechbook 2 ай бұрын
Mostly yes. Check this one please help.salesforce.com/s/articleView?id=release-notes.rn_automate_flow_builder_create_custom_error_messages_in_record_triggered_flows.htm&release=246&type=5
@sherba-ig
@sherba-ig 2 жыл бұрын
How to create a test class for this same scenario?
@vishnuvardhana2683
@vishnuvardhana2683 3 жыл бұрын
Hi sir - instead of using accountIdSet which stores all accounts' ids with isprimary__c = true and accountid != null can we just use following condition in SOQL which would also satisfy this condition (above) and put values into accountIdContactMap?: for(Contact contObj : [Select id, IsPrimary__c,AccountId from Contact where IsPrimary__c = true and AccountId null]){ accountIdContactMap.put(contObj.AccountId,contObj); } Please advise
@payeldebku
@payeldebku 4 жыл бұрын
very good video
@Patrickens_Tw
@Patrickens_Tw 4 жыл бұрын
Please also share the code file for reference.
@salesforcetechbook
@salesforcetechbook 4 жыл бұрын
Hi Pratik, You can get all examples source in Salesforce Techbook GitHub github.com/salesforcetechbook/ExampleCodesofSessions You can figure out this in the first slide of video
Apex Trigger (Rollup Summary with Apex Trigger)
16:15
Salesforce Techbook
Рет қаралды 10 М.
Deployment_using_Change_Sets
41:25
Salesforce Techbook
Рет қаралды 20 М.
Tuna 🍣 ​⁠@patrickzeinali ​⁠@ChefRush
00:48
albert_cancook
Рет қаралды 148 МЛН
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 62 МЛН
Salesforce Triggers Part-1
1:04:15
Mahesh M
Рет қаралды 55 М.
Deep Dive into Test Classes (Salesforce.com)
33:28
Salesforce Techbook
Рет қаралды 33 М.
Lightning Web Component-15 (Add or Remove dynamic rows )
40:09
Salesforce Techbook
Рет қаралды 15 М.
Visualforce Page Development-1(Basics & Different Controllers)
50:43
Salesforce Techbook
Рет қаралды 36 М.
Real time Scenario: Custom Rollup Summaries using TRIGGERS
1:04:55
Salesforce Exclusive
Рет қаралды 42 М.
How to Test Salesforce Flow Declaratively
29:54
Salesforce Apex Hours
Рет қаралды 8 М.
Salesforce Leads, Accounts, Contacts & Opportunities
5:23
Emelar Consulting Group
Рет қаралды 12 М.
Tuna 🍣 ​⁠@patrickzeinali ​⁠@ChefRush
00:48
albert_cancook
Рет қаралды 148 МЛН