New answers tagged

5

Given that you are storing a list of numbers in a delimited string field, "24; 35; 67", you have exactly two options. One is iteration (a loop); the other is recursion. You do not have the option of using aggregate queries or roll-up summary fields because you don't have actual number fields to look at. Apex does not natively support a reduce() function, a ...


0

Journey Builder does not support the use of lists created in the Salesforce Marketing Cloud Email application. As a workaround, you can create a journey specific data extension from publication list via query activity. Run a query on publication list and populate the data extension. You can use this data extension as an entry source for your journey and then ...


3

Since StartDate__c is not unique, then you have one of two choices: Use a unique key (Id, or other field) Change your map to handle many records per one key Since you seemed to suggest that doing #1 led to CPU time limits, I'd suggest changing your map to hold a list of Gear or Tool objects. Example for tool below assuming that StartDate and your EndDate ...


1

For Question #1 //I'm getting here null if it's null, or nothing, even if there is a correct value: System.debug(apUpd.Tenants__c); For the question about the System.debug issue, I can't answer that specifically as I don't know what field type it is (though I suspect it is a Number field), or what your data looks like, but the most likely scenario that I ...


0

Set in Apex doesn't rely on Id value for duplication reduction. You can add multiple records with same Id in a set if there is a difference between the values for those records. eg: Account acc1 = new Account(Id='001000000000001AAA'); Set<Account> accSet = new Set<Account>(); accSet.add(acc1); acc1 = new Account(Id='001000000000001AAA', Name='...


1

You are getting this error because you used Set<SObject> without fully understanding the mechanics of it, which is why I usually recommend against this structure entirely. Instead, you should use Map<Id, SObject>. For the former data structure, you only get deduplication if every field matches. For the latter data structure, you get deduplication ...


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 ...


0

Loop Through the Array of JSON using forEach() I used hasOwnProperty() to check the property in Object Use the condition operator to check the key present in an object(output). Below is the code I changed, Please see codepen let finalMap=[{"key":"OTC","subprocessName":"CXO","weightage":50}, {"key":"OTC","subprocessName":"Order Management","weightage":50},...


1

You can query the Cases again Where Ids IN: casesList, then Order BY CUID__c ASC/DESC. Yeah this is funny but it works. Cheers!


Top 50 recent answers are included