New answers tagged

2

By far the best way to do this is to use an aggregate query. Doing this in before update of Account will collect the number of Contacts with the Phone field set to a value: Set<Id> ids = Trigger.newMap.keySet(); List<AggregateResult> results = [ SELECT COUNT(Id) contacts, AccountId account FROM Contact WHERE AccountId IN :ids ...


1

I guess you can do something like this // added filter in inside query for phone, using set of acc ids from Trigger map List<Account> accsWithContacts = new Map<Id, Account>([ SELECT name, id, (Select name, id, Phone from Contacts WHERE Phone != NULL) FROM Account WHERE Id = :Trigger.newMap.keyset() ]); // using map to get correct record ...


0

Internal tools show the following error for error ID: 467951362-160534 (798706858) java.lang.RuntimeException: Invalid Summary Filter Formula? Field 00N0Q000001QJCc is inaccessible. Please review all fields referenced by the formula. Context: common.config.field.FormulaFilterContext As the error message indicates you must be using invalid summary filter ...


0

Generally speaking, you could try the following code executed from the Execute Anonymous Window in the Developer Console. Replace 'Account 1', 'Account 2' with your 10 account names in single quotes, separated by commas. Set<String> accountNames = new Set<String>{'Account 1', Account 2'}; List<Account> acctsToDelete = [SELECT Id FROM ...


0

To ensure you are updating existing Accounts/Contacts on Lead Conversion leadConvert.setAccountId(acctIdToUse); leadConvert.setContactId(contactIdToUse); Now, how you determine the acctIdToUse and contactIdToUse may require querying and is application-specific Note that these three lines are superfluous as Lead.Status is set automatically by the leadConvert....


1

Your query is not specific enough. There are some types of shares you cannot manually delete, such as Owner, Team Member, Sharing Rules, etc. You can try deleting them with the allOrNone=false option to delete as many as possible, or filter the query to include only Manual shares (these are the only types you can directly delete).


1

Already solved, I figure out that my Id on the start test should be Event not Account From: Id acct = GTA.fetch(testAcc.Id); To: Id acct = GTA.fetch(testEvent.Id);


0

Public static void updateAcc (); List<Account> accounts = [Select Id from Account where External_Id__c = ‘’]; If you are in a trigger handler, presumably in a before insert or before update context, you should be working with the Trigger.new context variable. There is no need to perform a SOQL query. Note that empty strings are not stored in the ...


2

As per the error message, this is coming from an active duplicate rule, which may have been created by another admin user. The part "Use one of these records?" in the error message suggests that "Alert" option is selected on the duplicate rule. Try to look for the duplicate rule under Setup, Duplicate Rules or Matching Rules and review ...


Top 50 recent answers are included