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
1
vote
1answer
30 views

Shield encrypted field, unencrypted results?

If a field is encrypted with Shield, can we get the unencrypted value with Apex classes/SOQL statements?
2
votes
1answer
43 views

Bulk API v2 Query job not returning results in same order as that of SOQL

I am using Bulk API v2 Query job to query on data from Salesforce. For example my SOQL is - select id, firstname, lastname, city, state, country from account In the response I am expecting columns to ...
0
votes
0answers
7 views

Data is not displayed in the table Visualforce custom controller

I want my table to display data depends on the picklist value I've chosen. But now it displays nothing. What should I change in my code? I will be grateful for the help! controller: public class ...
0
votes
0answers
18 views

How to find out 'Authentication Status' of specific Named Credential for current user?

Is there any way we can query for and check the Authentication Status of a Named Credential for the current logged in user? I found we can query for Named Credential sObject, as well as ...
0
votes
1answer
34 views

SOQL: List of All users in all Queues With User and Public Group Names

I need to generate a spreadsheet of all members of all queues [whether individual users or Public Groups..we don't use Roles], with columns similar to this: Queue ID, Queue Name, Member Name, Member ...
0
votes
1answer
27 views

Why does a SOQL query have different results from the record page?

I am running this query. select id, name, Community_Partner__c, Community_Partner__r.Name from Engagements__c where id = 'a005e000003wKuwAAE' and the results returned show that the lookup field ...
0
votes
0answers
15 views

SOQL Statement causes use to go from 9 to 101 queries [duplicate]

I have a large class that is shifting various objects around and at the end I formulate lists of SObjects that will do delete, insert, update. As I go through the lists, I can insert and update ...
0
votes
2answers
25 views

SOQL Query to extract certain attachments fails

I want to export attachments of those Owners who belong to a certain Organisation. I tried: SELECT BodyLength FROM Attachment WHERE OwnerId.Organisation_Name__r = 'ExampleCompanyName', but got the ...
0
votes
1answer
30 views

Why does a single profile have duplicate permissions for the same objects?

I am running SOQL queries to compare object permissions, but get duplicate permission for the same profile. For example, the "System Administrator" profile has two identical object ...
0
votes
1answer
30 views

How do I modify this part of code to avoid 'Too Many SOQL'

I have the following SOQL inside a For loop in a batch class that checking the SUM of each vendor with specific Expiration Date. vdrWithExpiryDates is a map that store different expiration date for ...
2
votes
0answers
32 views

Issue in SOQL with field having unicode characters with accent

I want to query records using SOQL in apex based on a string i extract from the file name the user has selected. The use case is to find all the contracts which has PrimaryKey__c = fileName . Here ...
-1
votes
0answers
16 views

Reason for `Unknown error parsing query` error [closed]

Let's say we have some SOQL query. It works fine in dev org when we use Dev Console. But when it comes to UAT user that has permissions to dev console always get Unknown error parsing query. Can CRUD ...
2
votes
1answer
45 views

“Apex action method must be static and annotated with AuraEnabled” but it is already static and annotated

public with sharing class LoanApplicationsData { public static List<Loan_Application__c> getLoanApplications() { @AuraEnabled(cacheable=true) List<Loan_Application__c> ...
0
votes
0answers
45 views

Apex SOQL Strange Behavior skips spaces

I have a custom object under the account entity (master-detail). This object (System Codes) has 3 fields (Account, Code, Line). I perform a query in inspector (or in dev. console - the results are ...
3
votes
1answer
46 views

SOQL for loop with less records - How to approach?

We have a scenario where we need to query 2 large text area fields and add them as a response to an external system. The source object on which these fields are present, we have used SOQL for loop to ...
-1
votes
1answer
44 views

How to query two unrelated objects? [duplicate]

I want to query two unrelated objects, and I can't create a lookup relationship between them. They have the same global picklist sets in both of them and I want to query the records from one of the ...
0
votes
1answer
14 views

Nesting of semi join sub-selects is not supported, Workbench

I'm trying to do a table export based on specific criteria, and the only tools I have at my disposal are Data Loader and Workbench. If I were to do this with SQL I would do: SELECT Id,CreatedById,...
-1
votes
2answers
42 views

Extract all records for current day and month for the last 5 years [closed]

I have a use case where I need a to extract all records of current day and month over last 10 years. For example, today is 14th June 2021, so I need all records of a particular object from 14-6-2021 ...
0
votes
3answers
43 views

Merge multiple List from queries

I would like to merge multiple List into one but I am not sure on how to do it .. My code is the following: public with sharing class ApprovalDashboard { public ApprovalDashboard(){ } ...
0
votes
2answers
41 views

Handle double quotes in a long text field when generating a CSV file from apex

I have a custom object in which I have a long text area field. I am querying it in apex and building a CSV and sending an email with csv as attachment. The value in the long text area field and which ...
0
votes
2answers
25 views

What would make a related field return no results when there is data?

I am trying to debug some code that I found in an org that I joined. We have a test that is failing because of null results. If you look at the code below, there is test data created for student and ...
0
votes
1answer
41 views

Email Duplicates in All Subscriber list with different SubscriberKey

I have different duplicates email contacts with different SubscriberKey. I performed this query : SELECT * FROM _ListSubscribers a WHERE a.EmailAddress IN (SELECT a.EmailAddress FROM _ListSubscribers ...
-4
votes
3answers
45 views

Derived query in SOQL Limits

Let's say we have a query SELECT Name FROM Account WHERE Id NOT IN (SELECT Id FROM Settings__c WHERE Group__c = 'Test') I know about 20K limitation but the question is - what is the limit for this ...
0
votes
0answers
18 views

SOQL query filter by value of another column [duplicate]

I am trying to make an extremely simple query where I filter the result based on the result of two columns. Ex: SELECT x, y FROM coordinates WHERE x > y; So far I didn't found any example of how ...
0
votes
2answers
28 views

Get Request Query Not Including Child Objects

TL;DR - Why is my api query not returning child contacts when run via a test? Problem Despite being included in the query, the query results from my API method does not include the Contacts column and ...
0
votes
0answers
36 views

How do I get the records from the database after they have been added using the “future” method?

I have a task in front of me: for the time period specified by the user, you need to get currency rates from a third-party service and display the results on the screen. I wrote the following code: //...
0
votes
1answer
24 views

SOQL query issue within a for loop - UnexpectedToken

I have an issue with my Apex Code but I have no idea how to solve it .. @AuraEnabled(cacheable=true) public static Map<string,integer> ApprovalKPI(){ Map<string, integer> ...
0
votes
1answer
32 views

Errors: No column name was specified for column 2 of 'Qry'

I try to extract email duplicates from All Subscriber list of Marketing Cloud and I have a syntax error that I do not understand. select a.EmailAddress, COUNT(a.EmailAddress) from _ListSubscribers ...
0
votes
1answer
55 views

Fetch only one child record of a parent in soql

I have a requirement to fetch Timecard records that are related to a Project. Below is my query: List <Timecard__c> timecard = [ SELECT ID,Project__c,resource_name__c FROM Timecard__c ...
0
votes
1answer
47 views

Multiple Emails via Apex Batch instead of one

We have a Batch Apex that loops over 9 Custom objects and sends out one email to each user who are assigned in any one of the custom object. This should send out one email to each even though if they ...
0
votes
1answer
22 views

SOQL Query for Unchanged fields

I want to query records where a field value remain unchanged in an year. For Example query all accounts where status field was not changed in 2020. If I query account history it will give me all the ...
-1
votes
1answer
28 views

Illegal assignment from List<User> to List<User>

I am trying to get the locales in use in my org and a user count for each locale to prepare for the spring update 22. However I am unable to run this SOQL to get this list. I have looked for other ...
0
votes
2answers
24 views

lwc lookup component not returning what I search for

I found a lookup component that I am using and so far was ok until last week. The user would like to type a word and all products with that word will be displaying. example: when a user type CPC in ...
5
votes
0answers
53 views

Error when using FIELDS(STANDARD) in an Apex SOQL query : System.QueryException: No such column 'EffectiveDate' on entity 'Quote'

I recently implemented the new FIELDS(STANDARD) functionality in Apex queries and I am using the following query now: SELECT FIELDS(STANDARD), Custom1__c, ... , CustomN__c FROM Quote WHERE Id =: ...
0
votes
0answers
32 views

Unable to get hyperlink in SOQL query

On Account record I have a text field that gets updated from Apex class with value as 'Click here' where 'here' is a hyperlink to www.google.com. On querying the field using SOQL, I am getting the ...
-1
votes
1answer
28 views

Get user's last assignment (or re-assignment) to profile or permission set datetime

Is it possible? Let's say we have a lot of users, profiles and permsets. There is need to get last datetime when user was assigned to particular permset or profile using SOQL. Which fields could help?
0
votes
1answer
39 views

SOQL Relationship query

I'm trying to query using a very basic line of code. I have a lookup relationship from Account to a custom object (1:1 or 1:many). Below is the query; SELECT id, (SELECT channel__r.name,channel__r....
0
votes
1answer
46 views

Query Parent records of an Object

I would like to ask a question regarding the best management of large data. I have a custom object Product Configuration under Opportunity where it has a lookup field (parent Configuration) to itself. ...
1
vote
1answer
41 views

How to find out which dates are missing in a period?

I have two dates (the start date of the period and the end date) that the user enters in the form to get a list of data. I need to get a list of this data from the database and check if there is a ...
0
votes
0answers
25 views

Why is SOQL query is returning deleted Opportunity split record

I have an Opportunity, under which I had initially added two Opportunity split records. But later I deleted one of the Split records among them using the delete button in the UI, as I didn't need it ...
0
votes
1answer
29 views

How to dynamically set values to object fields?

I have and object 'Car__c' in a package with namespace 'car'. There is a field name 'Price__c' and a lookup field name 'Car_Segment__c'. To initialize 'Car__c' and assign values to its fields from a ...
0
votes
1answer
21 views

How to add values to lookup fields of objects extended in other packages?

I have added an object in my 'Car' package let's say 'Car_Segment__c'. I have a lookup field 'Car_Model__c' for this object. There is another package 'Tyres' which has an object 'Tyre_Quality__c'. In ...
2
votes
1answer
40 views

Apex Compare UserInfo.getUserName() to a custom lookup Contact Field Name

EDIT: I am not receiving any error messages, it's just that the records I'm expecting to appear in the list are not showing up. I need my controller to filter records to show only those where the ...
0
votes
1answer
28 views

How would I get list of all existing Flow Names/Labels within an org?

I would like to access all of the existing Flow Names/Labels that are available for the current user within an org. Is there any way to use a SOQL Query to get access to the names of all existing ...
-1
votes
1answer
16 views

Update custom field on opportunity with the opportunity line items

I am trying to update field List_of_products__c at Opportunity when Opportunity line item is added on the opportunity. Eg. Opportunity line items details should get populated with ',' in ...
1
vote
1answer
19 views

Filtering query results where subquery returns no rows

I'm trying to filter out query results when a subquery doesn't return rows, however, I'm still getting null results... Will someone please tell me what I need to do differently? SELECT afc.ID, ( ...
0
votes
1answer
33 views

How do I pass the date period to the apex method?

I need to pass the date period "from" "to" from the js controller to the apex method in order to extract a list of values from the database. //cmp ... <aura:attribute name=&...
0
votes
1answer
25 views

How to get custom field from ProcessInstance Object

I am trying to get Approval Status and some fields via TargetObjectId. SELECT Id, TargetObjectId, TargetObject.Name From ProcessInstance Where TargetObjectId='XYZ' The above SOQL works fine but when ...
3
votes
1answer
178 views

SOQL: why FIELDS() function in not supported? Test class API version 51

I'm trying to use the FIELDS(ALL) function in my apex test class, in order to prevent this kind of error SObject row was retrieved via SOQL without querying the requested fields... But I can't save ...
1
vote
1answer
22 views

How do I pass the date value from the js controller to the apex method?

Trying to pass the date value I get an error. How to fix it? //cmp ... <aura:attribute name="dateExchangeRates" type="Date"/> ... //js getDataForTheDate : function(component,...

1
2 3 4 5
105