Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [optimisation]

The tag has no usage guidance.

1
vote
1answer
34 views

How do I optimize searching 3,000 records for an email that matches one on a lead?

Scenario A New Lead is inserted, if it matches criteria, the lead ownerid is Updated based on an email field on the lead. Problem Write code that takes the email address and queries all Users for ...
1
vote
1answer
32 views

Optimize code by reducing many If-else Conditions?

If-else code which I have written. I want to optimize it. (Using maybe Collection). Can someone show me how to do it? if(form.first_name.value == '' && form.last_name.value == '' &&...
0
votes
2answers
40 views

Need solution on query optimaisation

i have below code where i am doing 2 queries and updating the account record. list<account> parentAccount=new list<account>(); list<account> ChildAccount=new list<account>(); ...
0
votes
0answers
46 views

How to make hierarchy more dynamic

Currently when creating my custom object data i have to go through a hierarchy of my account custom account team(PFI_Team__c) to bring the team data dynamically. Below is the hierarchy check pfi ...
1
vote
2answers
306 views

Optimize to avoid too many soql

is there a way to optimize this more? for(Program_Standard__c comp: comps) { List<CertificateComplianceAssociation__c> tempAsocs = [ SELECT Id, Certificate_Type__c, ...
0
votes
1answer
45 views

Optimise Double For Loops in Batch Apex

global Database.QueryLocator start(Database.BatchableContext BC) { return Database.getQueryLocator([SELECT id, (SELECT id, Status, Description, ...
1
vote
1answer
23 views

How to optimize performance for dynamically add row & delete row functionality in VF Page

It is general scenario to create functionality of add and delete row dynamically. You can refer following link for better understanding of scenario: http://www.infallibletechie.com/2012/06/...
1
vote
1answer
231 views

Reduce servertime loading dynamic piclist on community page

How do I reduce servercall load/time from a community. I build a dynamic picklist component which loads on the page as checkboxes. I use this component 5 times on the page. It takes about (3000ms) ...
0
votes
1answer
27 views

Advice for optimizing my search for available times for user(s) given list of their events. (Currently using for loop inside while loop) [closed]

I am finding the next 5 available time slots for a user or group of users based on events they have on their calendar. Currently, I have a while loop that will start at the selected time, then loop ...
5
votes
2answers
136 views

How to query for records that have specific values on multiple fields

Let's say that I have to query Contact records with: FirstName as A, LastName as B, Company as C, or FirstName as K, LastName as L, Company as M, or FirstName as X, LastName as Y, Company ...
2
votes
2answers
393 views

What is more effecient , using SOQL AVG() or to query all records and calculate their average

Is it efficient to calculate AVG using aggregate function, using a group by clause. Like: (Select Designation__c,AVG(Salary) from Employee__c GROUP BY Designation__c) Or is it efficient to fetch all ...
2
votes
1answer
35 views

Is there a Salesforce equivalent of Unica Optimize?

I am somewhat familiar with Unica's Optimize engine. This compares different campaigns customers are eligible for to determine which one they should be placed into in order to get the optimal business ...
1
vote
0answers
30 views

Optimize user experience in Salesforce Service Console [closed]

today I have a bit odd question (since it will not be code related) ;) did any of you happend to know good tool to optimize user experience in Salesforce Service Console? I mean something like ...
3
votes
1answer
73 views

Compiled length of validation rule functions

I have a validation rule that is around 3000 characters in length. It uses a the following functions (most of them quite a number of times): IF, NOT, OR, AND, LEN, BEGINS, SUBSTITUTE, VALUE and MOD. ...
0
votes
1answer
337 views

Batch Apex - Optimise Nested Loops

I have the following code: global class ProcessLinkBetweenWorlds implements Database.Batchable<sObject>, Database.Stateful { global Integer recordsProcessed = 0; global List<...
0
votes
0answers
24 views

How to optimize joined query to find obsolete data

We have a query to find and remove the obsolete data which looks like this: select Id,Name from Matter__c where Id NOT IN (select Matter_Number_Lookup__c from Matter_Sitting__c) So if a matter ...
1
vote
1answer
782 views

Bulkify the code?

I want to clone the Opportunity record if some conditions satisfied in Opportunity car set which is in related list. Opportunity (Master)--->Opportunity car set(Child) My below code is working fine....
3
votes
1answer
213 views

Trigger Best Practices

How would you rewrite the following trigger to follow best practices re: bulkification, etc? trigger Order_PopulateGallery on RH_Order__c (before insert, before update){ List<Account> accs = ...
1
vote
1answer
233 views

Apex Loop Optimize

Here is my code // dynamic fields, the same with queried fields of Database.query(sqlStr) String fieldList = 'Id, Name, Number, Text__c..........'.split(','); for(SObject sob : Database.query(...
0
votes
1answer
47 views

On Trigger: System.LimitException: Too many SOQL queries: 101

I have issue with the below code when executing gives the error "System.LimitException: Too many SOQL queries: 101". Is there a way to optimize the below code? As per the error log, it happens when ...
4
votes
1answer
515 views

QueryException: Non-selective query against large object type (SOSL)

The following SOSL is in an Account trigger in a managed package: /* Trigger is on API 27.0 */ String acctsNamesOrd = 'PARKER/VANGUARD MGT'; Map<Integer, String> acctsNames = new Map<...
1
vote
1answer
116 views

Custom soql return too many rows

What is my best option to return the results of a query where the soql query by default returns too many rows (>50k)? From my understanding, SELECT COUNT() still cannot return a result >50k, but my ...
0
votes
2answers
32 views

Can I reduce the number of containers and (seemingly) redundant loops when querying parents and grandparents?

tl;dr - I'm retrieving fields on an object, the object's parent, and the parent's parent in a trigger - is there any way to make my code use less than 5 containers and remain bulkified? I have an ...
19
votes
0answers
397 views

Premature optimization is the…cure of all CPU timeouts? [closed]

According to Donald Knuth actually "is the root of all evil". But this doesn't seem to hold true on the Force.com platform and its CPU time Limit. After watching Paul Battisson's Faster Loops ...
2
votes
2answers
91 views

Need help optimizing a SOQL query

I am writing a simple trigger to tag lead duplicates based on two different fields, Email and our internal Lead ID (which we keep consisted between our own server DB and salesforce via integration). ...
3
votes
3answers
1k views

Retrieving more than 100.000 records using select statement

I have a custom object called equipment___c with more than 100.000 records, and also related to product object. To get product codes that are in equipment object, i used the following query: select ...
3
votes
1answer
1k views

Optimize Comparison of Records of same object with different record types

I have one object XYZ__c having two record types say A and B. I need to create junction Object JUNC__c(Fields: A__c(Lookup-XYZ__z),B__c(Lookup-XYZ__c)) record if XYZ__c record fields are same. I ...
7
votes
1answer
174 views

Measure (SOAP) API call performances

Is there a way to measure SF server processing time for specific (SOAP) API method call? Example: I am invoking update of 200 objects in one request. I would like to see SF processing time on their ...
11
votes
1answer
2k views

Are formula fields so inefficient?

I'm working with some colleagues on a project which the clients would like optimized, as they feels some things are too slow. One of my colleagues has suggested that we should cut down on the use of ...
2
votes
3answers
10k views

Nested SOQL query?

so, the following query is pretty self explanatory: SELECT p.Accountid, p.Name, (select name FROM Account where id = p.Accountid) FROM Contact p order by accountid' is there any way to do this in a ...
1
vote
3answers
236 views

Optimized way to update parent object

What is the most optimized way to update every parent object inside a list? For example: List<Asset> aList = [ SELECT Account.Name FROM Asset WHERE ...
4
votes
1answer
779 views

Bi-directional Map in Apex or best alternative approach

I am using Apex Map structures for fast one-way mapping of data. This works very well, but I ideally want to map backwards using the same map declaration. The obvious way is to iterate the map, but ...
6
votes
2answers
817 views

Better performance between if-else-else-… vs hardcoded maps

We're doing an integration project where we receive a lot of code values from a webservice.These codes need to be mapped to a user-friendly, translateable text in a visualforce page. We've set up a ...
11
votes
3answers
10k views

String concat vs string format in Apex?

I believe there is a performance benefit for using string format in languages like .NET and Java over concatenating strings. Is this also the case for Apex and force.com ? string s = 'this'+'is'+'a'+...
12
votes
1answer
1k views

Has anyone had issues with initial page load times when injecting a second VF page via AJAX?

I have a few visualforce pages that, together, make up a custom dashboard. The first page or "shell" page is just a HTML form that lets you select a client services rep and an optional client type ...