Questions tagged [soql]

Salesforce Object Query Language (SOQL), modeled on SQL, for accessing information saved in the Salesforce database.

Filter by
Sorted by
Tagged with
2 votes
0 answers
72 views

Where is Database.query() spending (so much) CPU time?

My assumption was that only Apex Code is using CPU time. But the what I measure for code that is run by Salesforce's own Backend code speak a different language. List<SObject> result = Database....
user avatar
0 votes
0 answers
21 views

What is a reified column and how to get all value from it?

There are some objects (like FieldDefinition or AppTabMember) that when you want to uses SOSL SELECT all data from them, it fails with "a filter on a reified column is required". I have a ...
user avatar
0 votes
1 answer
7 views

duplicate alias: name error while grouping

We are using bundle products in salesforce and I am trying to display the Order products in a PDF document which I am creating using VF page. In the Order detail page the Bundle products appear ...
user avatar
0 votes
0 answers
7 views

How to display the Order products in the same Order as they are shown in Order detail page

I am trying to fetch the CPQ bundle products and show it in the PDF in SOQL. But the Order products aren't getting fetched in the same Order as they are shown in the Order detail page. They are ...
user avatar
0 votes
1 answer
29 views

Aggregate result not working in soql query

im new to visualforce and i have this problem: I have a sObject with customField1__c, customField2__c, customField3__c. In my main page (with a standard controller and an extension) i want to display ...
user avatar
0 votes
2 answers
33 views

How to query/make a report for All fields on All objects?

We have a very old org with many objects and unused fields, how can i query/make a report to find all fields for all custom objects, and order them by lastmodified date? the goal is to find which ...
user avatar
0 votes
0 answers
81 views

Omission Problem in Query Salesforce

When I execute this query List<AggregateResult> query = [ SELECT Max(Id) Id, AccountId, Max(CustomField__c) FROM Asset WHERE Status = 'X' AND (CustomField__c = 'Z' OR ...
user avatar
-1 votes
0 answers
25 views

Too many SOQL queries: 101 stack [closed]

I have a AccountTest class which run with more than 75% coverage in dev env. But when I tried same class in a another sandbox without any code change give this too many soql error. Can someone have ...
user avatar
  • 1
0 votes
1 answer
30 views

DML, SOQL and DML Sequence

Here is my scenario. Transaction 1: DML to update the Status field from Open to Closed on ABC record. Transaction 2: SOQL is performed to retrieve the ABC record before the above DML and updates the ...
user avatar
  • 5
-1 votes
1 answer
33 views

Get all records created by user today

We are about to perform Load Testing and we are performing some complex scenarios. We use a CPQ tool that has many custom object records being involved and inserted. Is there an easy way to get ...
user avatar
0 votes
1 answer
17 views

How is transaction defined and how is Governor limit applied in Salesforce SDK?

I am creating an app with iOS using Salesforce SDK. How is transaction defined, and how is governor limit applied in this context? For example, I have an a.swift file where I am throwing API requests ...
user avatar
0 votes
0 answers
17 views

Filter out parent records when they contain no child records in apex

So I have a couple aura/lightning components that are displaying a customer order header (the parent record) along with it's order lines (the child records). Here's a pic: I have two methods that ...
user avatar
0 votes
1 answer
32 views

SOQL Query for updating related records

I have two Objects: Opportunity and Bid(custom Object). A bid is having a lookup field to opportunity i.e. an opp. can have multiple bids. I need to update the comment field of Bid records, but the ...
user avatar
-3 votes
0 answers
23 views

Hi, I am having query with Salesforce Apex and Triggers send email notifications for status changes for Task object [closed]

I have query in Salesforce Apex. Send an email notifications When we assigned the new task in particular userr EX. Four users only. send an email notifications when who assigned the task they will ...
user avatar
0 votes
0 answers
19 views

SOQL LIKE operator on picklist field appears to fetch results based on matches on label not API value

SOQL LIKE operator on picklist field appears to fetch results based on matches on label not API value. For example, take this query SELECT Id, Name, RZone__Type__c FROM RZone__PSPayment__c WHERE ...
user avatar
0 votes
0 answers
25 views

414508781-117745 (-1506038047) error in SOQL in Manufacturing Cloud

In Manufacturing Cloud org, I run following SOQL in Developer Console: SELECT ID FROM AcctMgrPeriodicTargetDstr ORDER BY Period1.Id,Period2.Id Then I get following error dialog: Then I change this ...
user avatar
-5 votes
0 answers
41 views

sObject row was retrieved via soql without querying the requested field MaintenancePlan:Week_Number__c [closed]

What am I missing the below code that's causing me an error "sObject row was retrieved via soql without querying the requested field MaintenancePlan:Week_Numbers__c" public List<...
user avatar
0 votes
0 answers
56 views

Query fields based on object names

Is there a way to join FieldDefinition and Entitydefinition? I would like to run a query like below but it is not working select id, DataType, NamespacePrefix, DeveloperName, QualifiedApiName FROM ...
user avatar
  • 1
0 votes
1 answer
26 views

Fetch Accounts having more than 3 contact records in it in a single query

I want to Fetch all the accounts records(not the ids) that have 3 or more contacts present in a single query with contact records in it. I didn't find any reference of these. I had tried with some of ...
user avatar
0 votes
0 answers
38 views

SOQL for email field just returning 'PersonEmail'

i was having trouble accessing an email fields value via a flow so i tried to access it via SOQL and im just getting 'PersonEmail' instead of an actual value... select account_email__c from Account ...
user avatar
3 votes
1 answer
59 views

Retrieving license consumption stats for a Customer Community Login license

I am testing my app: at this moment I check does it properly count licenses. Everything was fine until I started checking Community licenses. I have created a user with a Customer Community Login ...
user avatar
-1 votes
0 answers
17 views

fetch record with maximum end date [closed]

I have three record on the same object. All the record have end date filed. I need to fetch out the record which has maximum end date among three.
user avatar
  • 5
-1 votes
1 answer
24 views

How to compare values in soql query when field may have a different format

I don't know if there is a way to solve this, I couldn't find it. I am importing a CSV file where I am to create an sObject for each line. The thing is, I have to do a query using a value present in ...
user avatar
0 votes
0 answers
16 views

ContentDistributionTrigger after insert ContentDownloadUrl null

I have a ContentDistributionTrigger trigger after insert & update which when fired has a null value for ContentDownloadUrl. The ContentDistribution is created in a ContentDocumentLinkTrigger as ...
user avatar
2 votes
1 answer
114 views

Lean, fast and flexible replacement for the fflib QueryFactory

I just decided to kick the fflib QueryFactory out of a customer project because of its complexity and sub-par performance. My Custom Query Building is fast but I fear I will reinvent the wheel. Which ...
user avatar
0 votes
1 answer
75 views

Order By id not support in Publisher

In my apex code, I have this SOQL: [SELECT ID FROM Publisher Order By Id], this SOQL works fine in API 49, after upgrade to API 54, Salesforce will throw error run this SOQL. After research I found ...
user avatar
2 votes
3 answers
25 views

Unable to return list filtered by current user

Pretty new to this and I am creating a Visualforce page that returns a list of contacts that belong to the logged in user. I have the following controller but when I preview the page I get the error ...
user avatar
0 votes
1 answer
34 views

How to write Apex unit test for a function that fetches meta data?

I have a function that returns the list of all custom objects that are currently present in the org, as listed below. @AuraEnabled public static List<String> getCustomObjectNames() { ...
user avatar
-1 votes
1 answer
37 views

Fetch Custom metadata values with add where condition without using soql [closed]

I have a soql query to get custom metadata value with where condition. But to avoid the SOQL query, i would like to replace SOQL with getInstance() method to get the custom metadata values but i ...
user avatar
  • 233
0 votes
1 answer
23 views

Blanking a Field that is not writeable and passing to a lightning data table

I am using Apex to call an SOQL query that returns records and a few of their associated fields, some of which are formula fields which (to my understanding) are not writeable. I am then passing this ...
user avatar
-1 votes
0 answers
39 views

What is the way to get all fields and records from salesforce through rest API in java code?

I made a successful connection with salesforce org with rest API, if I use to execute SOQL like: select id,name,email,............ from Lead then I am getting an exception as 414 bad Message URI to ...
user avatar
0 votes
0 answers
40 views

Implementing autocomplete suggestion for record ids

The LWC app that I am currently working on has a feature that lets users fetch information for a record whose record ID is entered. I am looking forward to implementing a feature that proactively ...
user avatar
-1 votes
1 answer
41 views

Can someone explain me the difference between these two queries [Select a.Name From account a] and [Select Name From account ]

Why do we need to create instance of an object in an query and what difference does it make from normal query. I tried running these query and couldn't notice a difference I was going through some old ...
user avatar
3 votes
1 answer
213 views

Is "FOR UPDATE" available in dynamic SOQL?

The SOQL doc states that FOR UPDATE is available for inline SOQL To lock a set of sObject records in Apex, embed the keywords FOR UPDATE after any inline SOQL statement. For example, the following ...
user avatar
  • 62.3k
0 votes
0 answers
16 views

Is there a Public Link Sharing list?

New to Salesforce administration, and just found out that there is an option to create a public link for files. Is there a way to see all public links created in the instance I manage just like in ...
user avatar
0 votes
0 answers
45 views

Combining multiple SOQL queries on the same object

I have a list of SOQL queries which are used to fetch the objects associated with corresponding list views. The list views are selected manually by the user, and a generous maximum for how many I'd ...
user avatar
0 votes
1 answer
25 views

Querying only the first record in a relationship where the relationship can have multiple records

Lets take the example of the standard objects CollaborationGroup(CG) and CollaborationGroupFeed(CGF). A single CG record can have multiple related CGF records. If I have 10 CG records I want to get ...
user avatar
1 vote
1 answer
39 views

How to fetch name field for a record of given record id but known object?

I am trying to obtain all related child (look up) records of a record whose record id is passed. Salesforce docs say that for every object, regardless of type, name is a standard field, just like Id. ...
user avatar
0 votes
1 answer
25 views

Database.query() question

Is it ok to use String.escapeSingleQuotes() inside of a database.query() or do you need to create a new variable using the String.escapeSingleQuotes() first and then use the new variable in the ...
user avatar
-2 votes
1 answer
30 views

second order soql injection checkmarx

String keyword= 'abc' String search = '\ '%' + String.escapeSingleQuotes(keyword) + '%\ ''; String query = 'Select Id From User Where firstName Like ' +search + 'Limit' + 10; result = new Map<Id, ...
user avatar
0 votes
1 answer
28 views

SOQL SELECT query failing with 'No search term found. The search term must be enclosed in braces.'

I have a Kotlin application that uses Fuel for making HTTP requests to the Salesforce API. One of the HTTP requests that uses a SOQL SELECT query is failing, and I'm not sure why. val ...
user avatar
-1 votes
2 answers
22 views

How do I do an upstream soql with the nested columns to the stage of the most recent opportunity for each campaign member

SELECT Id, ( Select (SELECT OpportunityId.Stagename FROM OpportunityContactRole ORDER BY createdDate DESC LIMIT 1) FROM Contact) FROM CampaignMember limit 10 This is my super ...
user avatar
0 votes
1 answer
47 views

SOQL - How to query Lead email using Task object? [duplicate]

SOQL only. I can accessed the Name of the Lead from the Task object, however when I accessed the Lead email, even though the Lead record has an existing email, the email wasn't showing up. This query ...
user avatar
0 votes
2 answers
27 views

Select maximum of 2 columns

Is it possible to take the maximum of 2 columns as a new column? Something like: select max(start_date, end_date) from contract
user avatar
-1 votes
1 answer
40 views

SOQL queries Where Clause given Error UNEXPECTED Token

[ SELECT Name, (SELECT Communication_Type__c, Communication_Mode__c, Additional_Information__c, CBProgramInformation__r, Reporting_Type__c FROM Reporting_Detail__c ) FROM ...
user avatar
0 votes
2 answers
41 views

Speed up REST SOQL Query

Other than reducing the complexity of the Query is there any way of speeding up how quickly you can iterate through a SOQL Rest Query? I can't use bulk SOQL as I require Parent-to-child relationships ...
user avatar
2 votes
2 answers
56 views

rest api SOQL Query max records

The documentation states that if it cannot return all records in the query then you can use the next records URL to get more records. Does this still have the same limitation of no more than 50,000 ...
user avatar
2 votes
1 answer
54 views

No profiling information for SOQL operations (Apex Class in Profile)

I have a custom aura component was built to have a custom lookup field in it. The custom aura lookup field takes a search query and replicates standard lookup fields dynamic dropdown. The component ...
user avatar
  • 1,268
-1 votes
2 answers
32 views

SOQL query Contacts x Campaigns by filter with Events on the Contacts

I'm trying to write an SOQL in order to get a Contact list (including which Campaigns those contacts are in) filtered by Events Subjects on the contacts. Essentially I want to see which Campaign is ...
user avatar
0 votes
1 answer
38 views

Dynamic SOQL, LIKE and Apostrophes

I want use an Aura component to perform a lookup on Accounts. For example I want to search for an Account named O'Neills. The query is: query = 'SELECT Id, Name FROM Account WHERE Name LIKE :value'; ...
user avatar
  • 11

1
2 3 4 5
111