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
3
votes
1answer
39 views

Subqueries in soql for loop vs standard soql queries

I have 26 accounts and 24 contact records in the org and running a SOQL query on them (fetching Accounts along with contacts). Found that if SOQL for loop is used then the child records fetched in the ...
0
votes
1answer
10 views

SOQL query to retrieve PermissionsModifyAllData from all Permissions sets with its assignments

The SOQL query should return PermissionsModifyAllData, the name of PermissionSet, and its assigned users.
-1
votes
2answers
13 views

Why I am getting error : System.SObjectException: SObject row was retrieved via SOQL without querying the requested field?

Covered Product is an object and Installed product is a lookup field on Covered product and Status is a picklist field on Installed product. When I am trying to run the below code in Execute Anonymous ...
0
votes
1answer
11 views

Query field on contentversion from contentdoclink

I had below SOQL to retrieve the records from content document link, created a new custom field "File_Type__c' on content version but not sure how to relate this field to my query: SELECT ...
-2
votes
0answers
21 views

how to compare time from (2021-11-15T21:59:45.000+0000) in soql query?

I Need to extract the records created between 21:55 to 22:00 irrespective of the date. The created date was (2021-11-15T21:59:45.000+0000) this format. any ideas ?
0
votes
0answers
25 views

SOQL Report Query Across Objects

I've no exposure to writing SOQL queries previously, but I'm trying to get the Follow details for Cases by User so that each user can see which cases they are subscribed to (following) for when moving ...
0
votes
1answer
32 views

I didn't see my opportunity in visualforce page

I modified my class with :ApexPages.currentPage().getParameters().get('Id') When I launch my Visualforce page i didn't see records. What i need to see: What i see: When I put my Id, OpportunityId ...
0
votes
1answer
43 views

looping over dynamic soql of indeterminite dimensions

Hoping someone has a clever strategy for the following scenario - I have a dynamic soql query that when assembled could be either: soql = 'select id from a'; soql = 'select id, (select id from b) from ...
0
votes
2answers
56 views

What is the difference between soql for loop vs soql list

As per the documentation it mentions ) (soql for loop) retrieves all sObjects using a call to query and queryMore whereas (list for loop) retrieves a number of objects records. It is advisable to use (...
0
votes
0answers
13 views

SOQL with Junction Table [duplicate]

I have 3 custom objects. Account_Statement_c with custom fields like a Account__c (master-detail to Account) Statement_Item__c where this is the junction Object with Account_Statement__c (master-...
0
votes
1answer
19 views

Can I tap into the inline SOQL results with a string field value?

I am curious on how I would be able to pull out a dynamic field value from an in-line SOQL query. Is this possible? I have tried with no luck but wasn't sure if there was another way. Decimal ...
-3
votes
0answers
50 views

List has no rows for assignment to SObject but i am sure it has [closed]

I am trying to insert Lead with REST API Query with JSON body, but i get this error : System.QueryException: List has no rows for assignment to SObject My query looks like this : Order campaign = [...
1
vote
1answer
53 views

How to replace a SOQL query with a string?

Any idea how to convert a query into a string?
-1
votes
1answer
32 views

How to link Account with Event in a SOQL Query

I need a SOQL Query to List of Ids from Account older than 14 years and with no Events in the Last 6 Months. I tried to "link" both requests with whoId relation on Event: SELECT Id, ...
0
votes
1answer
20 views

Need a query for finding public groups that have no users currently in them [closed]

I'm looking for a query to find public groups that have no users assigned to them and delete them. It's a large set of data so it would be much easier this way rather than going through all of them. ...
0
votes
0answers
36 views

Salesforce sharing set permissions SOQL

For one of my integrations project, I am trying to repurpose the Salesforce record sharing model outside Salesforce. I have been following this article which talks about identifying access for user ...
0
votes
2answers
34 views

Getting error System.AsyncException: Future method cannot be called from a future or batch method: when I am calling future method from a trigger

When I am calling future method from a trigger then I am getting error USER_DEBUG caused by: System.AsyncException: Future method cannot be called from a future or batch method: ExampleFuture....
0
votes
0answers
32 views

Trying to query custom metadata type

Really short question as I am new to salesforce. I got some queries for objects running but I now need to query for records of a specific custom metadata type. I tried it just like I got objects: .../...
1
vote
0answers
16 views

SOQL - Contact Mailing Address

I am trying to run a SOQL query in the dev console to get resultant records where a Contact's MailingStreet matches a particular LIKE query but can't seem to get any results even when I know it ought ...
0
votes
0answers
25 views

Bulk api query - querying last 5 mins

I have a requirement to query through bulk api job to fetch records last modified in 5 mins . While Querying I need to utilise lastmodifieddate field of the record . Note : I can not create another ...
0
votes
1answer
49 views

How to get Owner name Instead of Owner id of record in apex?

I have below code List<Task> taskList = [ SELECT Subject, Description, CallDisposition, Owner.Name, ActivityDate FROM TASK WHERE Status = 'Open' AND Whatid ...
2
votes
1answer
39 views

Dynamic nested soql - how to loop through subquery?

Struggling with building a nested for-loop to parse through the following scenario : String table = 'Account'; String subtable = 'Contacts'; String soql = 'Select id, (id from ' + subtable + ') from ' ...
2
votes
2answers
176 views

Is a SOQL query with FOR UPDATE enough to safely delete a record?

I have a scenario where an external system is calling the Salesforce API, causing a trigger to run. That trigger needs to delete EmailMessage records where the RelatedTo field is an Account. We're ...
-1
votes
1answer
13 views

SOQL query for multilevel grouping on Engagement Activities Object fails with Error

I have created a custom object Engagement Activities which has lookup fields to Account and Contact objects. I have loaded data in Engagement Activities object. I want to know how many contacts are ...
2
votes
0answers
24 views

Unexpected behaviour in formula field (Type - Date)

I am not sure if below is bug in salesforce or is expected behaviour and would like to know reason for same. If I create a formula field as below Type - Date and formula only containing CreatedDate ...
0
votes
1answer
62 views

Soql taking too long - log says 15 seconds

We are getting UNABLE_TO_LOCK_ROW error couple time a week. This time I was able to get the logs of it by setting user trace flag on production. When I check the logs, I see that a single SOQL query ...
0
votes
1answer
33 views

need to capture lastmodifiedBy user and date of LWC in salesforce

I have requirement where i need to fetch modified lwcComponent with the user who modified it programmatically. Is there any soql query we can use or by apex schema we can get it.Audit trail does not ...
-3
votes
1answer
19 views

I want to query on Salesforce Knowledge articles where body of the article contains a specific text [closed]

I want to query on Knowledge articles on workbench. I am having an issue in finding out all knowledge articles which contains "XXX" in the body section. Please help with the query if ...
-3
votes
1answer
21 views

Why I am getting error : A non foreign key field cannot be referenced in a path expression: AccountId?

I want to set the Description field on Contact object same as the Industry field on the Account object. But when I am executing the below code I am getting error A non foreign key field cannot be ...
0
votes
2answers
35 views

Will acc.Contacts return list of all Contacts related to the Account?

Will acc.Contacts return all the related contacts to the Account? What does actually acc.Contacts means in this code? When I am doing System.debug() it returns (). What should be the output for this ...
1
vote
1answer
43 views

SFDX: Execute SOQL Query failed to run

Unable to run SOQL queries on VSCode. I'm getting the following error. Starting SFDX: Execute SOQL Query... 19:33:27.886 sfdx force:data:soql:query --query SELECT Id, Name FROM Account 19:33:27.888 ...
-4
votes
1answer
32 views

SOQL Query for changes in any custom/standard objects then we need to know those changes [closed]

For objects we have to do for metadata level. Say for ex: If any changes in any custom/standard objects then we need to know those changes.
3
votes
1answer
91 views

Non-selective query against large object type (more than 200000 rows) - Solution

Below is my query which throws the exception and is used in the trigger handler SELECT Id, RecordTypeId, Status, customObj1__c FROM Case WHERE customObj1__c IN : customObj1_Ids AND RecordTypeId IN : ...
2
votes
1answer
42 views

Query Indirect GroupMember Records

Is there a way to query GroupMembers who have been granted access indirectly, i.e. via a UserRole? The GroupMember docs imply that no records are created but they are shown in the UI, so I am hoping ...
10
votes
1answer
325 views

What Type of Joins are Supported in SOQL?

There used to be a really great article I could link to when I wanted to describe (or even remember) the names of various joins in SOQL, their syntax, etc. However, the link died, and I have not found ...
0
votes
1answer
23 views

How to get more fields from another object with an IN statement

I use the following query to get the data, but i also want to receive more fields from the "soco__Volunteer_Assignment__c" object. SELECT+FIELDS(ALL),Account.Name,Account.Id+FROM+Contact+...
6
votes
2answers
215 views

SOQL query performance with many or few fields

I have a doubt. Sometimes the developer repeats many queries in different places, but what changes is the number of fields. I sometimes think about centralizing queries, but queries can have fields ...
0
votes
1answer
29 views

Problem Querying Fields on ContentVersion When User is not the Owner

UPDATE This can reproduced in any org, so it may be designed behavior or a bug. Basically, if a user is not the owner of a ContentVersion record they will only be able to filter by Id or ...
0
votes
1answer
22 views

Parent-Child relationship query

Given Account - MaintenancePlan relationship, I have this SOQL: SELECT Id, (SELECT id from MaintenancePlans WHERE Id = 'xxxxxxxxpUGAS') FROM Account Problem is that I just need to get the ...
0
votes
1answer
25 views

SOQL Query for Manually Assigned Accounts in a Territory

The goal is to query all Manually Assigned Account on a particular Territory. If possible, a query that can be run through Developer Console/Workbench. Is this doable? I can't seem to find anything ...
3
votes
1answer
45 views

"No such column 'LocNum__c' on entity 'Name', specifically on LoginEvent - confirmed I have access

Been stuck on this for a while now, trying to write a query against LoginEvent that pulls in some User data so I can eventually craft some custom alerting. Getting an error on a specific field in the ...
1
vote
0answers
6 views

Querying related Period from ForecastingQuota

I'm trying to query relationships to the Period object, specifically ForecastingQuota (in either direction) and have found that the query does not work because the relationship is not found. The query ...
0
votes
0answers
54 views

SOQL : Field not found but it exist

I am doing a simple query on orders but I get an error : Query: Select Id,(SELECT Id, OrderId, LineNumber from OrderItems) From Order Error: No such column 'LineNumber' on entity 'OrderItem'. If you ...
0
votes
0answers
42 views

The field VersionData not queried in SOQL for ContentVersion sobject

I queried the ContentVersion object by following soql, VersionData field is not retrieved in results. SELECT Id, Title, VersionData, PathOnClient, ContentSize FROM ContentVersion WHERE Id=<Id> ...
-1
votes
1answer
14 views

Get records modified by SF Data Loader App (or get history of jobs on it)

I did some bulk upserts using csvs and SF Data Loader. However, my formatting was off for my external Id and "duplicate" records were created instead. Is there a simple option to revert jobs ...
0
votes
1answer
32 views

Passing an array to NOT IN clause

Apex: @AuraEnabled(cacheable=true) public static List<Topic> getFilteredTopics(List<String> notInTypes) { return [ SELECT Id,Type FROM Topic ...
0
votes
0answers
11 views

Field VisitorNetwork from LiveChatTranscript cannot be retrieve from dbamps

We have DB Amp connection with our salesforce production. When i write a soql query in sql server, i am not be able to retrieve data field VisitorNetwork from LiveChatTranscript object, query : select ...
1
vote
1answer
19 views

SOQL CustomObject__Feed See Just see posted messages (different from draft) (Chatter)

I am doing the following SOQL query to retrieve all messages on Chatter for the Essai custom object select CreatedById, CreatedDate, parent.Name, parentId, Id, Body, ...
-3
votes
2answers
44 views

Is it possible to know WHY SOQL retrieves EMPTY?

I have a SOQL in an APEX Class, and it works okay when I'm logged as a System Administrator User, but it gets empty when I log as a different user. I suppose it could be permissions and field ...
-3
votes
1answer
23 views

SOQL Help with DateTime attempting to populate package.xml

I am trying to Create a SOQL search to retrieve the FolderName, ReportType and DeveloperName from all reports ran from Jan 1, 2021. Here is my current search. SELECT Name, FolderName, DeveloperName, ...

1
2 3 4 5
108