You need to sign in to do that
Don't have an account?
I need help with a trigger
the trigger should be on account to check the assets and if ALL Assets where product family = "bla bla " and their status was "Canceled" the trigger should update bla bla Account stage (API Name = Account_Status__c ) to "Cancel".
Apex Code Development
trigger AccountUpdateFromAssetProduct on Asset (after insert, after update) { List<Asset> assetList = Trigger.new; List<Id> idAccountList = new List<Id>(); for(Asset asset : assetList) { if(Trigger.isUpdate && asset.Product2.Family == Trigger.oldMap.get(asset.Id).Product2.Family && asset.Status == Trigger.oldMap.get(asset.Id).Status) continue; if(asset.AccountId == null) continue; idAccountList.add(asset.AccountId); } if(idAccountList.isEmpty()) return; List<Account> acctList = [SELECT Id, (SELECT Id FROM Assets WHERE Product2.Family = 'bla bla' AND Status = 'Canceled') FROM Account LIMIT 50]; for(Account acct : acctList) { if(acct.Assets.isEmpty()) continue; acct.Account_Status__c = 'Cancel'; } update acctList; }All Answers
trigger AccountUpdateFromAssetProduct on Asset (after insert, after update) { List<Asset> assetList = Trigger.new; List<Id> idAccountList = new List<Id>(); for(Asset asset : assetList) { if(Trigger.isUpdate && asset.Product2.Family == Trigger.oldMap.get(asset.Id).Product2.Family && asset.Status == Trigger.oldMap.get(asset.Id).Status) continue; if(asset.AccountId == null) continue; idAccountList.add(asset.AccountId); } if(idAccountList.isEmpty()) return; List<Account> acctList = [SELECT Id, (SELECT Id FROM Assets WHERE Product2.Family = 'bla bla' AND Status = 'Canceled') FROM Account LIMIT 50]; for(Account acct : acctList) { if(acct.Assets.isEmpty()) continue; acct.Account_Status__c = 'Cancel'; } update acctList; }what does this line of code do ?
List<Asset> assetList = Trigger.new;
and can I have your email for more questions?
if(Trigger.isUpdate && asset.Product2.Family == Trigger.oldMap.get(asset.Id).Product2.Family && asset.Status == Trigger.oldMap.get(asset.Id).Status) continue;
Thank you in advance.
Developer at https://beetvapp.com/
Plague inc download
Well, You have helped me buy posting this question and I want to thank you for this!
Plague inc download (https://love4apk.com/plague-inc-apk/)
Advanced pens with 3d technology (https://techypes.com/best-3d-pens/" target="_blank) helps in achieving best creativity
tubi tv activate (https://www.techbmc.com/tubi-tv-activate-free-shows-movies/)
https://www.assamsakori.org
https://apkgameapps.com/action/gta-5-for-android