Skip to main content

Questions tagged [loop]

A loop is a sequence of instructions that is continually repeated until a certain condition is reached.

Filter by
Sorted by
Tagged with
0 votes
1 answer
57 views

How do I access list values in flow

I am struggling a bit with accessing individual values in list that is returned by APEX code into the flow. public class DynamicField { @InvocableVariable public String key; @...
Tomáš Vebr's user avatar
0 votes
0 answers
25 views

Unable to access DynamicFields

I have create a callable class that return dynamic fields. public class DynamicField { @InvocableVariable public String key; @InvocableVariable public String value; public ...
Tomáš Vebr's user avatar
0 votes
0 answers
42 views

Ampscript UpdateSingleSalesforceObject Function in Loop

Im getting a 500 - error on my code and can't figure out whats causing it. Im trying to build a custom preference center (cloud page) that updates corresponding contact point consent records in ...
Daniel's user avatar
  • 1
0 votes
1 answer
81 views

Would it be advisable to put the Custom Metadata Type records in a Wrapper Class?

I have a code that is dependent in metadata records. Let's say if my object record matches the value in metadata record then it will do something. However, the requirement is getting bigger and we're ...
Saberzero's user avatar
0 votes
0 answers
47 views

Archive events through flows

I have a requirement where I need to delete current event records and have them archived. For this I have created a new custom object to store the event details called 'Archived Event'. The flow works ...
coder123's user avatar
  • 143
0 votes
0 answers
33 views

Concat Multi Opps ID To One String

I'm newbie in this. I have an idea like this below: Example: I have a list Opp With 20 Close Won of only one user, I set up a flow (schedule) to scan all of its ID then input to "Send Email" ...
Thang HD's user avatar
0 votes
2 answers
60 views

About Design Pattern - Avoid excessive looping

I am relatively new to the Salesforce world, working as a developer at a company that provides Salesforce consulting. Well, I usually gain experience by looking at what is done in other projects and ...
Noops's user avatar
  • 5
-1 votes
1 answer
76 views

Auto-Number Using a specific format and using an already existing field as the base (workflow loop?)

I have an opportunity field called Order # that the user enters it in this format 24-022. I'd like to use this Order # and add a -1, -2, -3 etc. to the end (example 24-022-1) and this field will be ...
Lisa Walters's user avatar
0 votes
1 answer
123 views

What's wrong with my substring function?

I'm trying to loop through a string using AMPscript only and pick out specific values. The problem is once it tries to update the string using the substring function the cloudpage errors out. Example ...
smithky3's user avatar
1 vote
1 answer
309 views

How to recursively iterate through multi nested arrays in the lwc's html file?

I have the following data and nested a way to recursively call the same logic so that regardless of how many levels are in the data, the data is always printed correctly in a nested format. Example ...
usernameabc's user avatar
-1 votes
2 answers
190 views

System NullPointerException on get from map

I have a nullpointer exception in the following code on line if(mapSoldAppStatus.containsKey(user.Id)){: Map<String,Map<String,Integer>> mapSoldAppStatus = ReportPageController....
Thomas's user avatar
  • 2,320
0 votes
1 answer
946 views

Map value to specific variable in loop within Flows?

Working on a flow in which I need to iterate over up to 12 records and sort it in descending order by date. Then take a single value from each record and store it. I will then update the parent record ...
stormy's user avatar
  • 53
-1 votes
1 answer
647 views

Salesforce LWC nested for each loops with if condition

I am trying to implement a listbox in LWC. The list box is showing values from a picklist in Account object. On click the value of the selected item is adding to an array. But on the UI it is not ...
Hasan Zubairi's user avatar
-1 votes
1 answer
1k views

How to use loop within a loop in salesforce flow?

Requirement: A note will be created for a selected account from the list view, using a custom button. This button calls a VFPage & that vfpage calls this flow. My current output creates the ...
yash jagtap's user avatar
-1 votes
2 answers
747 views

How to iterate on a custom number field on an account using flows and not trigger

Creates the number of contacts which are equal to the number which we will enter in the Number of Locations field on the Account Object. This is the trigger but i have been assigned to convert this ...
Harman Chahel's user avatar
0 votes
0 answers
113 views

Tip still showing Database access elements in loop

I have a loop in a flow where I have multiple Get elements which are clearly placed after the "After Last" path when the loop is complete. But the Flow 'Tips' is still telling me almost ...
Suzie's user avatar
  • 11
1 vote
1 answer
494 views

LWC - How To Loop Through A List With data-aura-rendered-by attribute?

is there any way we can loop through a list of object with this code snippet? It works okay when the list return 1 record. However, if the list has more than 1 record, it cannot rendered (display). ...
Pam's user avatar
  • 107
0 votes
1 answer
110 views

Looping SSJS to output Ampscript variables partially works if I don't use a word building array function. Can't figure out why

I've got a data extension which has multiple rows for each item a user has in their cart and it's tied to their email address. The main issue is I need to cut off the product name at a max character ...
Erik B's user avatar
  • 65
0 votes
1 answer
2k views

How to iterate over map with id and Sobject list

I have the following piece of code: map<id,List<Spot__c>> spotMap = new map<id,List<Spot__c>>(); List<application__c> apPList = [SELECT ID, Account__r.id,(SELECT id,...
Thomas's user avatar
  • 2,320
-1 votes
1 answer
966 views

Avoid Hitting the Limits when Updating records with a Scheduled Flow

I have to change the status of some tasks after 30 days. I have already created and tested the flow in my sandbox, the problem I'm having is that in Prod we usually have around 5000 records to expire. ...
Rocio's user avatar
  • 3
-3 votes
1 answer
278 views

How change this nested for loop to map

I took this code from another question asked in this site My code is similar to the below. Please say how to change the nested for loop used in this snippet to map. trigger OpportunityTrigger on ...
Sushil's user avatar
  • 3
0 votes
1 answer
84 views

Extract Particular value from the result list and store them in another list

Hi I have a list type of List which is returned from the invocable action. List<Invocable.Action.Result> results = action.invoke(); I am getting the data as below in the form of result. (Result&...
Shekher's user avatar
  • 23
1 vote
1 answer
126 views

Flow loop collection - can it be a decision as to which collection to run loop on?

Background: Flow as Lead Router(aka Round Robin) by Program Rules have members (users) who may be active or inactive (think out of office, not user account) If a program is matched to a rule but there ...
Suzie's user avatar
  • 11
-1 votes
1 answer
566 views

I am trying to re-start an existing loop to iterate through it again with a new comparison value

Problem- Looping through a collection of values looking for a matching value to a previously assigned variable. It is possible a match does not exist. The variable value is now changed and I need to ...
Suzie's user avatar
  • 11
1 vote
1 answer
140 views

Rusty Coder - Better way to avoid soql in loop

I haven't had to write any code in a few years now and I have to believe I am not using the best approach to avoid a SOQL query in the loop. I am doing a query outside of the loop and then iterating ...
Matt M's user avatar
  • 1,497
0 votes
2 answers
326 views

How to avoid nested for loop in this apex code?

public class TestUserData { public static HttpResponse makeApiCallout(String endpointUrl){ HttpRequest request = new HttpRequest(); App_Id__mdt appid = App_Id__mdt.getInstance('appid'); ...
sahil kakadiya's user avatar
1 vote
1 answer
3k views

LWC conditional check in for:each on field content

I have an LWC in which I need to check the value of a field in a for:each loop to determine what to display in the HTML. I've tried to find a solution but haven't had success so am hoping someone will ...
Irene's user avatar
  • 1,885
1 vote
2 answers
431 views

How to address null-pointer exception

I Have the following apex code which is throwing a nullpointer exception on the line: points = points + value; List<JMG_ExternalSearch__c> searchList = [SELECT Id,LastModifiedDate,...
Thomas's user avatar
  • 2,320
1 vote
2 answers
219 views

SOQL FOR LOOP with Selector Class

I am building a SOQL FOR LOOP and I am wondering whether or not I am getting the advantages by abstracting the SOQL Query to a separate Selector class. Should I instead be placing the SOQL Query ...
Coova's user avatar
  • 180
1 vote
0 answers
15 views

Avoid iterating over list inside loop [duplicate]

Hello guys I have two lists. One has contact records and other has ContentVersion records. What I need to do is that by every contact I have to create a documents and attach to them by using the ...
TechGuy's user avatar
  • 127
2 votes
1 answer
393 views

Transform a List<String> for use in Multi-Select Picklist where clause

I have a list of strings which I need to put together in every valid combination so that the result can be used in an includes WHERE clause of a multi-select picklist in a SOQL query. Basically, I ...
Mike's user avatar
  • 1,209
0 votes
0 answers
1k views

Screen inside Loop in Salesforce Lightning Flow

I'm trying to create a survey form using screen flow and for that I'm fetching the Question records from Question custom object and trying to show Questions as text along with their options as radio ...
kunal's user avatar
  • 75
0 votes
0 answers
1k views

Error Occurred During Flow: Apex CPU Time imit exceeded

I am receiving this 'Apex CPU time limit exceeded' error on my flow Flow: Flow start object record filtering Get Records I am collecting the Product2 records with some conditions and iterations it ...
Yogesh Sakat Aphidas's user avatar
0 votes
2 answers
75 views

Can this nested loop be done through a map?

I have the following bit of code which is a nested loop that I'd like to know if it can be replicated by using a map instead as I haven't used them before and would like to know how it would end up ...
qnt13's user avatar
  • 3
-3 votes
1 answer
226 views

How to prevent loop in batch correct way [duplicate]

I have the following Batch which currently runs. I am still wandering if the way I set my for loops are correct. Is this solution the right way? I have a Quote which is related by several amount ...
Thomas's user avatar
  • 2,320
0 votes
1 answer
98 views

Remove SOQL query inside a loop

I am coding a HttpPatch and I need help to remove the query inside the loop (line 13). Is it possible? @HttpPatch global static void EstablishmentUpdateDelete( String actionType, String cuit, ...
Gonzalo's user avatar
  • 15
0 votes
1 answer
3k views

Loop through records in a flow and append to text to send in a single email

I'm attempting to do the following in a "Scheduled-Trigger Flow": Send a list of Campaign Members that meet a certain criteria in a single email. Example: John, Jane and Jared are ...
markwilland's user avatar
0 votes
1 answer
178 views

Lightning Web Components/LWC (no aura): How do you set the maximum length of list when rendering with iterator?

How do you set the maximum length of a list with LWC? I understand in Angular you could use "ng-maxLength". <template iterator:item={records}> <!-- List up to ten records --> ...
Eric's user avatar
  • 1
2 votes
2 answers
275 views

How can I dynamically upsert data in object

I want to upsert data in SF based on the selected columns by the user. I make HTTP callout to an external service and it returns the data. Then, I want to iterate over the each returned row and create ...
Stojchesky's user avatar
0 votes
1 answer
897 views

How to retrieve JSON values from a Data Extension

I have a basic javascript for retrieving values. Like this: <script runat="server"> Platform.Load("core", "1.1"); var list = ["value1",&...
Martijn e's user avatar
  • 143
0 votes
2 answers
534 views

Is there a way to parse JSON without names?

we have a simple JSON structure. This structure has no names like this: ["value1","value2"] Is there a way to parse/use this in Marketing Cloud? We don't have to make decisions. ...
Martijn e's user avatar
  • 143
1 vote
1 answer
68 views

Only showing those that Return true from a FOR AmpScript

I am searching a data extension based on an ID and returning vairables and a link from those. I was able to get it to pull all the required data and show correctly. However when I try to add a ...
Connor Tom's user avatar
2 votes
1 answer
93 views

Reducing loop runs and code repetition in a trigger where junction records are created which match several criteria

I'm new to Apex and coding in general and trying to get the best practices down where possible. This trigger challenge came from David Liu's Apex Academy series and gives the following requirements: ...
cwrcyn's user avatar
  • 21
-1 votes
1 answer
552 views

Unable to get triggering records in Before Insert(Fast Field Updates) and loop over them [closed]

I was trying by using "Get Records" elements to get all the records of the object triggering the flow. But as the record is not being inserted yet, I can't filter it via Id. Is there any ...
Muskan Agarwal's user avatar
1 vote
3 answers
8k views

Is there a way to update a bunch of records without loop in flow

I want to do an update of a set of records on a daily basis with a flow. We are talking about 5,000 records on a batch. The issue I'm having is that when I assign the individual records to a variable ...
ErFran's user avatar
  • 81
0 votes
2 answers
93 views

Simple Apex code snippet not behaving as expected

Integer delay = 1; for(Integer i=1;i<=5;i++) { System.debug('Print '+i); Long sTime = System.now().getTime(); while ( (System.now().getTime()/1000 - sTime/1000) < delay){} } When ...
Suhasini's user avatar
  • 307
0 votes
0 answers
1k views

Help with 'Update Records' element after a flow with loop

I'm relatively new to flows and super new to loops. I've watched several flow tutorials and they all seem to follow the pattern of: a record is triggered > loop through related records > assign ...
Jenny Jo's user avatar
-1 votes
1 answer
131 views

how to merge two For Loop

if(sObjectType == 'Order') { List<order__c> list_Order = new List<order__c>(); // todo=merge both the for Loop for(SObject obj : s_object){ order__c ...
sunny roxx's user avatar
0 votes
1 answer
282 views

How do I get recordtype in a loop?

I am getting Variable does not exist: recordType exception in for loop public void getGroupCallCustomers() { leftValues = new map<string,string>(); rightValues = new map<...
narojoc807's user avatar
0 votes
1 answer
173 views

How to fetch soql value of subquery in javascript

I have the following soql @AuraEnabled(cacheable=true) public static List<AggregatedResult__c> getTarget() { Id currentUserId = UserInfo.getUserId(); String query = '...
Thomas's user avatar
  • 2,320

1
2 3 4 5
7