first commit Riabu

This commit is contained in:
2025-11-26 15:57:11 +05:30
parent dd002222ad
commit a5dea75cc3
51 changed files with 14671 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
trigger AccountTrigger on Account (after insert, after update) {
AccountTriggerHandler.createCustomer(Trigger.New);
}

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexTrigger xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>65.0</apiVersion>
<status>Active</status>
</ApexTrigger>

View File

@@ -0,0 +1,12 @@
trigger ContactTrigger on Contact (after insert, after update) {
if (Trigger.isAfter) {
if (Trigger.isInsert || Trigger.isUpdate) {
// Only run trigger logic if allowed
if (ContactTriggerHandler.becamePrimary) {
System.debug('Trigger executed - becamePrimary is TRUE');
// your logic here if needed
}
}
}
}

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexTrigger xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>65.0</apiVersion>
<status>Active</status>
</ApexTrigger>

View File

@@ -0,0 +1,29 @@
trigger OpportunityAfterTrigger on Opportunity(after update, after insert){
map<Id, List<Decimal>> accIdOppAmtMap = new map<Id, List<Decimal>>();
List<Account> accListToUpdate = new List<Account>();
for(Opportunity opp : Trigger.new){
accIdOppAmtMap.put(opp.accountId, new List<Decimal>());
}
if(accIdOppAmtMap.size() > 0){
List<Opportunity> oppList = [Select AccountId, Amount From Opportunity Where AccountId IN : accIdOppAmtMap.keySet() Order By Amount DESC] ;
for(Opportunity opp : oppList){
if(accIdOppAmtMap.ContainsKey(opp.AccountId)){
accIdOppAmtMap.get(opp.AccountId).add(opp.Amount);
}
}
}
for(Id accId : accIdOppAmtMap.KeySet()){
Account acc = new Account(Id = accId);
if(accIdOppAmtMap.get(accId).size() > 1){
acc.AnnualRevenue = accIdOppAmtMap.get(accId).get(1);
} else{
acc.AnnualRevenue = accIdOppAmtMap.get(accId).get(0);
}
accListToUpdate.add(acc);
}
update accListToUpdate;
}

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexTrigger xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>63.0</apiVersion>
<status>Active</status>
</ApexTrigger>

View File

@@ -0,0 +1,26 @@
trigger linkCOACustomerToLMALicense on CHANNEL_ORDERS__Customer__c (after insert, after update) {
// map to capture license id + customer id
map<string,id> allCustomersWithOrgID = new map<string,id>();
// retrieve all customer org id in the trigger
string customerOrgId = '';
for (CHANNEL_ORDERS__Customer__c c : trigger.new)
{
customerOrgId=c.CHANNEL_ORDERS__Customer_Org_ID__c;
allCustomersWithOrgID.put(customerOrgId.left(15), c.id);
}
list<sfLma__License__c> licenseToUpdate = new list<sfLma__License__c>();
// retrieve all licenses
list<sfLma__License__c> allLicensesWithCustomer = [select id, sfLma__Account__c, COA_Customer__c, sfLma__Subscriber_Org_ID__c
from sfLma__License__c
where sfLma__Subscriber_Org_ID__c in :allCustomersWithOrgID.keyset()];
for (sfLma__License__c mylicense : allLicensesWithCustomer)
{
// assigne the right customer to the right license via orgid
mylicense.COA_Customer__c = allCustomersWithOrgID.get(mylicense.sfLma__Subscriber_Org_ID__c);
licenseToUpdate.add(mylicense);
}
update licenseToUpdate;
}

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexTrigger xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>61.0</apiVersion>
<packageVersions>
<majorNumber>3</majorNumber>
<minorNumber>71</minorNumber>
<namespace>CHANNEL_ORDERS</namespace>
</packageVersions>
<packageVersions>
<majorNumber>1</majorNumber>
<minorNumber>21</minorNumber>
<namespace>sfLma</namespace>
</packageVersions>
<status>Active</status>
</ApexTrigger>