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
0answers
24 views

How can I take the values from multi select picklist into another field?

I have a multi select picklist which I need you take the values and put into a child object. The picklist has 100 values. Can't use cross object formula because of char limits. Is there any way to do ...
1
vote
2answers
29 views

How to avoid too many queries in Flows

I have a complex requirement that iterates over 277 records. I have achieved it using scheduled flows. For each of the 277 records, I need to automatically create related records, which I have done ...
0
votes
1answer
27 views

In JS of LWC, line after forEach statement does not execute

I have below Javascript function in lwc apexJobInfoData; @track isBatch; getData({ error, data }) { if (error) { // TODO: handle error } else if (data) { this.jobId = ...
0
votes
0answers
25 views

How to update all actual records when 1 of them is updated?

I have code. But it's a bad practice with query in the for-loop. How to make it better? The point is that I need to update comments in all actual tools when the comment field is changed in one of ...
0
votes
1answer
23 views

How to loop trough subquery and fill fields in array Json object

I have created a custom object to create a json string. I kan loop trough the list to fill in the first level/parent fields. How do I loop trough the subquery and fill the arrays in the json object. ...
3
votes
2answers
1k views

For loop only loops 5 times

I have a vf page that creates 10 dummy Attachments so it can display on the page. When I go to save the attachments I"m looping through the list and removing the bad ones. The problem is it's only ...
1
vote
2answers
56 views

How to loop trough map and get record by field value

I have a map<Id,String> subMap this is the id of a record where the string is a name of a Future_record__c yet to be made after a callout. How do I loop through the subMap and get the ...
0
votes
2answers
40 views

How can I take my SOQL out of the loop?

I have an Id in the String format. I'm trying to convert this string into lookup field if it's the Gear__c Id. How can I take my SOQL out of the loop? trigger SMSTrigger on Message__c (before insert) ...
1
vote
1answer
45 views

How to query multiple object records without using soql within a for loop

I have a Map<String, String> objectNameWithQueryString; objectNameWithQueryString consists of 'ObjectAPIName' as the key and a 'soql query string as the value'. My requirement is to perform ...
0
votes
2answers
99 views

lwc looping till a certain number in html

In lwc for looping through data we have <template for:each={contacts} for:item="val"> </template> If i have a variable where in a number is stored, say for example 4. How do i run the ...
0
votes
2answers
23 views

Removing a key element from a map that exists in Salesforce

I am iterating over the values from a JSON response in an hourly job and putting those values into a map. From there I'd like to compare each map elements key to the Customer__c JobId field. If the ...
3
votes
2answers
668 views

Expressions in for:each index value in LWC? [duplicate]

Currently, I am facing an issue is that I want index starting from value "1" I am using for:each in my code. <template> <lightning-card title="HelloForEach" icon-name="custom:custom14"&...
0
votes
1answer
53 views

How to loop over child objects of master object in batch object

I have a batch process to update Accounts with address info from the Cust_Address__c object. I use a Junc_Account_Address__c object as a junction. How do I loop through the accounts to update the ...
0
votes
0answers
24 views

Need a flow to output number of unique values on a related list

I have a custom object called "Issue" with a related list to another custom object called "Impacted Contacts." There's a join record called "Issue Impacted Contacts." I need to make a flow that will ...
1
vote
1answer
24 views

Inserting dependent objects without using a loop

I have this issue. I have a list of Contracts and I need to create Cases and custom objects called 'Budget' that the Case needs to lookup. The code can be summarized to something like this for(...
0
votes
0answers
33 views

Flow Using more than Object

Trying to build a flow that used GET RECORD to pull a filtered list of Opportunities, and use the AccountIds from these Opportunities to update a list of Accounts. The only way I have achieved that ...
0
votes
1answer
37 views

Values in map overwritten by new ones

I have a Map where I put a String and a Decimal. Both of these fields are updated based on the day of the week. The String field can be converted into a date field since it's populated by the day, ...
1
vote
0answers
58 views

How To Optimize Looping?

I've written a utility class that enables a Custom Metadata Type mapping for Object to Object data cloning. I'd like our Admin team to be able to add/create/adjust the Fields on either object without ...
1
vote
1answer
96 views

Converting list into Integer

I have 2 string fields in database one is a name and the other is semicolon-separated values, I want to put the name and its summed up values in a map to use it later in the code. I can split the ...
0
votes
1answer
131 views

Access index of sObject collection using flow builder loop

I'm using process builder to auto launch a flow. I pass an id to the flow and use the getRecords element to query for a collection of records that returns the records in descending order based on a ...
0
votes
1answer
41 views

Iterating Through a Map<Id, List<Contact>>

This is a concept I am having a bit of trouble understanding. In this particular case I have debugged each piece within it and I can get the values I expect, But I am not able to iterate through them ...
0
votes
4answers
129 views

Is there any way to retrieve sum of grandchild field values on parent object

I am trying to iterate from parent to grandchild. Is there any way to do this as I want to show the sum of grandchild field value on parent object. please suggest me the best solution to do this other ...
1
vote
2answers
77 views

How to restrict duplicate emails entering into loop?

Could anyone help on this issue. In the below apex class I have method called getWrapAccounts().In this method for loop allows duplicate values.I have a Login__c field,It is emailID based on thid id ...
2
votes
2answers
630 views

Visual Flow - How to Loop Over Two Record Collections and Use Field Values From Both

I have a record collection for Object A, which I loop over and for each record in that collection I create a new record for object B. These records are assigned to a second record collection. At the ...
2
votes
1answer
122 views

Concat Loop Results to determine if contains value

I have the following code to retrieve the series of a product that has been purchased. We are using a loop because a contact might purchase multiple products. %%[IF NOT EMPTY(@PersonAccountId) ...
1
vote
2answers
159 views

Ampscript FOR Loops results to retrieve product using a second Loop

I have 3 salesforce objects: - PersonAccount - MyWatches (Fields:PersonAccountId, ProductId, Status = Owner) - contains the list of watches bought by the PersonAccount - Product2 (Fields: Series) - ...
0
votes
1answer
30 views

Flow Challenge: Trying to loop a single records fields values to do different actions

I'm working on a project to send emails to customers based on whether or not a user checks a certain box(es); I have 4 boxes in total they could check. Problem: Have user be able to trigger flow ...
1
vote
1answer
160 views

LookupRows loop on Entry Data extension and Lookup Data extension

I have two data extensions. Entry Data extension | CONTACT_ID | +------------+ | 1 | | 2 | | 3 | +------------+ Lookup data extension +------------+-----------+ | ...
0
votes
0answers
37 views

'For' loop: using AMPscript block instead of inline

Our case is inserting multiple orders related to single Customer_Id. The ask here is that we would like to use a complete AMPscript block, if possible, instead of combining inline and block-style in ...
1
vote
2answers
75 views

Incrementing a SET Variable

I understand For loops, but I'm struggling trying to set n SET variables. Basically, what I'm trying to do is for each @i in a rowset, I'm trying to: SET @SegLocator (and concatenate @i to the end) ...
0
votes
1answer
65 views

How to nest maps and display them in visualforce page

I need to display a a 4 level deep relation on a visualforce page from the parent showing the child relations. Account>property__c>Booking__c>Order>OrderItem. Since we can only go 1 level deep with ...
0
votes
1answer
114 views

How do I dynamically iterate through a subquery [duplicate]

This is the server-side code for a lightning component. Normally I would return the last line, but its commented out here to test using anon execution I think I am calling the parent Id in the loop ...
0
votes
2answers
137 views

How can I count number of “ !=null ” fields on a record?

My question is about challenge when Opportunity is created specific fields must be populated. How can I count the fields which are not null from specific fields? integer counter; integer oppValue; ...
-4
votes
1answer
78 views

Trigger not creating a new record [closed]

If case status got change for certain record type, new support record should get created. I configured status and record type combination in custom setting I am trying to avoid nested loop in my ...
0
votes
2answers
144 views

Flow loop with formula returning null value

I have a Flow which loops through a collection of custom Objects. In each iteration it gets an exchange rate from custom metadata. I then need to multiply a number in each custom object with the ...
-1
votes
1answer
79 views

How to avoid nested loop in the trigger [closed]

We have a trigger if case status got change new support record should get created. but in my case it is creating more than one record, I am thinking it might be because of a nested loop can someone ...
0
votes
1answer
88 views

email templates loop

I have some strings variables: test1 test2 test3 ... Each of them with some text inside I have in my html email template : test1 test2 test3 .. I would like to know how to iterate with : body = ...
0
votes
1answer
36 views

combine variable loop apex

I have a simple question: I have a loop that iterate on an integer i. each loop iteration i becomes i+1 I have another set of variables : x1, x2, x3, x4 etc I would like at each iteration of the ...
0
votes
1answer
71 views

Lead and Account custom duplication check

In the following method: public List<Id> getLeadIds(Lead[] listOfLeads) { List<Id> leadIds = new List<Id>(); for (Lead lead : listOfLeads) { if (lead.Company != null ...
0
votes
1answer
194 views

Concatenate related contact names in a flow

I have a junction called MeetingContactRelation to link attendees to a meeting: Meeting - MeetingContactRelation - Contact I have a hidden rich text field on Meeting and want to store the ...
0
votes
1answer
80 views

AmpScript lookup function: Display data from multiple columns in a data extension?

I'm creating an email to display subscriber's order details. All the data is stored in one spreadsheet/data extension. The columns include OrderID1, OrderType1, OrderID2, OrderType2, OrderID3, ...
0
votes
1answer
223 views

AMPScript For Loop Dynamic Variable

I am trying to get a dynamic variable set inside a script block with AMPScript. Here is what I got: FOR @i = 1 to 5 DO TreatAsContent( Concat( "SET @Test", @i, " = ", 'some value' ) ) NEXT @id ...
0
votes
0answers
23 views

Processing CampaignMember object without hitting governor limits

Campaign is used to create parent campaign which is assigned to each term. Each parent gets set of child campaigns with parentId=null (that's how we distinguish between parent and child campaigns) ...
1
vote
2answers
80 views

How can I create 1500 contacts for my units tests without hitting CPU limit?

I am creating a script that gets run every quarter that checks for any paid status in campaignMember objects that has contactId attached, and update the status to unpaid and create a campaignMember ...
1
vote
0answers
276 views

SSJS - Read a Data Extension after an Rows.Update

i'm now in my firsts baby steps in JavaScript on Salesforce Marketing Cloud. In my script i read one Data Extension with an DataExtension.Init("DE") and a DE.Rows.Retrieve(filter). After this, some ...
2
votes
1answer
359 views

Waiting for results from APEX call in a for loop

I need to load a number of records more than the 2000 default limit for an SOQL query, but I need to wait until all of them are loaded before moving on. To do this, I make a request to get the total ...
-1
votes
2answers
102 views

How to remove list elements without an additional for loop?

I need to remove from the following revenueList list all elements where newRevenueDate is NULL without any additional for loops. List<Revenue__c> revenueWithNoDateList = new List<Revenue__c&...
1
vote
2answers
140 views

How can I efficiently loop through opportunities on a list of accounts?

Currently we have a few nested for loops in our codebase that are doing what is mentioned in the question, but if we data load a large amount of records we run into CPU time errors. I am wanting to ...
0
votes
1answer
47 views

How to Loop through a map that contains multiple object IDs?

Must be really simple but I am struggling with how to loop through this map. Gone through some examples but was unable to figure it out. Question is, how to loop through user IDs from TargetActorMap ...
0
votes
2answers
69 views

Lightning Event in Looping [closed]

I know it's a strange question to ask without context but what would be the implications if I have a lightning component firing an 'COMPONENT' type event every 1 second? I imagine it would be quite ...

1
2 3 4 5