Hot answers tagged

3

This error indicates that a DML update is being performed on some List<sObject>, and the relevant list contains the same object multiple times. Scanning through updateRelationships(), the proximate cause is this line: update updateCards; which is performing an update on a List<CaptureCard__c>. The better, and more typical, pattern is to ...


2

String externalId = myEmailBody .substringBetween('External Account Id:','-----') .normalizeSpace(); See String class


2

Your problem has nothing to do with invocable variable. You are trying to access the 0 index element immediately after creating instance Parametri in test class. You should add element in list instead. Try below: EmailPreventivoAccettato.Parametri Parametri1 = new EmailPreventivoAccettato.Parametri(); Parametri1.IDPreventivo = '0Q03E000000I5OLSA0'; ...


1

The method you're trying to test has the following signature: createCandidacy(List<String> incomingReport) Your test code is attempting to pass a List<Report> to the method instead of a List<String>. Looks like you probably wanted to do something like createCandidacy(new List<String>{reportId}); Beyond that, you should probably ...


1

You have created the list, but not an Object in it, change your code a bit: EmailPreventivoAccettato.Parametri ParametriObj = new EmailPreventivoAccettato.Parametri(); ParametriObj.IDPreventivo = '0Q03E000000I5OLSA0'; ParametriObj.Gruppo = 'TEST'; EmailPreventivoAccettato.SpedisciMail(new List<EmailPreventivoAccettato.Parametri>{ParametriObj});


1

This is a case where you will need to modify the code under test to test it. You will need a class if your trigger logic isn't already in a class: public class Triggers { @TestVisible private static DateTime nowOverride; public static DateTime now() { return nowOverride == null ? System.now() : nowOverride; } } then your trigger ...


1

The second piece of your question is an example of a (usually) non-pathological recursion guard, where you suppress recursive trigger operation only around a single DML operation. You'd usually have it like this: if (!beingupdated) { beingupdated = true; update contactRecord; beingupdated = false; } This ensures that your ...


1

Here's the flow you should do: Add a Util method getExternalIdFromEmail with return type String that returns the external id and pass the email body content as the argument Inside the method, Split the email body content with '\n' (newline character) to separate the content into each line. Identify the message line that contains 'External Account Id' Split ...


1

Your class should look more like the following: global TemplateLoader() { } // The main interface method global ID getDefaultEmailTemplateId(ID caseId) { // Select the case we're interested in, choosing any fields that are relevant to our decision Id CaseRecordTypeId = Your RecordTypeID Query Here; Case c = [SELECT ...


Only top voted, non community-wiki answers of a minimum length are eligible