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

Join condition not taking in Developer console [closed]

SELECT FA.Finance_Account_Product_Type__c, FA.Code_Edit_Message__c, FA.Bankruptcy_Flag__c, FA.History_Counter__Due__c, FA.Effective_Date__c, FA.History_Counter__Funds__c, FA.Total_Amount_Due__c, FA....
-1
votes
1answer
41 views

How to display field label in Dropdown in visualforce page [closed]

I need to display Lead labels in dropdown and account, contact and opportunity also in dropdown. public class objectController { public Map <String, Schema.SObjectType> schemaMap = Schema....
0
votes
0answers
22 views

Error: A driving SObject type has already been set, all other entity types in the FROM clause must be relationships to the initial object

I am trying to launch a batch job with scope below Select id, Expiry_date_of_your_license_to_trade__c, Has_Live_Contract__c, Licence_Reminders_Sent__c, Proprietor_First_Name__c, ...
0
votes
0answers
18 views

Display custom list of records in visualforce using SOQL query

I have a vf page on a workorder object. When I open the vf page on a wo record whose account name is ABC and po number (custom field) is 123 for example, I want to display a list of all the work ...
0
votes
0answers
36 views

Sort text fields which contains numbers and text in ascending order

I am trying a sort a text field that has numeric values and text values together in ascending order. Here below, Suite_Number__c is the text field on which I want the order to happen. Numeric fields ...
0
votes
0answers
13 views

Best practice to dynamically remove an inactive user from an Approval Process [closed]

My use case is when a record is submitted, there is an inactive user in the list of users base on the first approver. I have been searching for an automate best practice solution either declarative ...
0
votes
1answer
43 views

Need to write an apex class to take in a custom object id and receive a list of related object Ids from that custom object [duplicate]

I am new to salesforce and to coding in general and I am struggling to understand how to correctly write this class / SOQL query. Any advice or guidance would be appreciated. I need to specifically ...
0
votes
0answers
23 views

Retrieving All Accounts in a Hierarchy Using 15-Character ID

I have an Account hierarchy. I have a formula on my Account that returns the ID of the Account at the top of the hierarchy. Due to formula size restraints, I can't use CASESAFEID in the formula, so it ...
0
votes
1answer
19 views

Bulk Updating Records in Apex from List?

I am writing code that calls an API to get external client info. I'm at the point where I have it working but I am wondering if there is a more efficient way to save the data to the Account object. ...
1
vote
1answer
16 views

SOSL query searching in multiple fields

I want to search in multiple fields using SOSL. I know that it allows to search in all fields using below syntax- FIND {"Smith"} IN ALL FIELDS RETURNING contact (name), lead (name) And also works ...
0
votes
1answer
33 views

Why my SOQL return error

SOQL SELECT Name, AirRegulator__c, AmountReview__c, BatteryCapacity__c, ChargingTime__c, Length__c, NumberUnits__c, Rating__c, TankSize__c, (SELECT UnitPrice FROM PricebookEntries) ...
1
vote
1answer
17 views

field 'Name' can not be sorted in a query call error in only one environment. What can be the issue?

I have an object A which has a lookup to Contact. I am doing a SOQL in an Apex class and it looks like this: SELECT Id, Contact__c, Contact__r.Name FROM A__c ORDER BY Contact__r.Name This SOQL query ...
0
votes
1answer
25 views

Problem with Date format in SOQL

I have a silly problem, when I pass Date from lightning input (type=date) i pass it as a string, and when i creating a query with this paramiter i recived error like below value of filter ...
0
votes
1answer
21 views

Accessing query result fields

I am trying to pull values from a query result I'm performing on the Product2 sObject and am trying to save the values from the query into individual variables. My query result: |DEBUG|...
0
votes
0answers
21 views

Reliable Salesforce JDBC to be used with DataGrip

Do you recommend any particular JDBC for Salesforce (can be paid) which is reliable enough to be used for commercial purposes along with DataGrip (or similar) software? I've been checking similar ...
0
votes
1answer
19 views

there an easy way to so a soql query to see the the applications a profile has access to?

I tried this query recently SELECT Id, Name FROM AppMenuItem WHERE Id IN (SELECT SetupEntityId From SetupEntityAccess WHERE Parent.ProfileId =: id) ORDER BY Label and got this error The selected ...
0
votes
1answer
30 views

How best to optimize SOQL query

I've made an aura component that people can search for records. I'm running into speed issues with the query i'm using. Searchkey is the input the user is typing in. select Fields from Order ...
0
votes
1answer
20 views

Building out a multi-dimensional array / list for an update statement

I have a contact list I am looping over and one of the fields in the contact object holds 1 or more contactIDs in a delimited list using a carriage return. Standard Contact Object: ContactId: ...
0
votes
1answer
30 views

How to get last created record date of all custom objects having total number of records greater than 1 lakh

My requirement as part of org analysis is to get list of all custom objects having more than 100000 records and created date of LAST CREATED record. My tries are as follows:- Go to Setup - Storage ...
0
votes
1answer
43 views

How to use a SOQL query for Sobjects like Passing Sobject as Variable inside the quey

I'm trying to write a SOQL query, But this query have to work for all object in one query. I want to use same query but I want to change object name dynamically public class Test { public static ...
0
votes
0answers
12 views

Product2.Name from PriceBookEntry Query [duplicate]

I'm trying to get the Product2.Name from the following query, however, it only returns the Product2id. Any thoughts? List<PriceBookEntry> priceBookEntries = [select id, product2.name, ...
0
votes
0answers
13 views

SOQL queries with date literals

I am trying to send a SOQL query to salesforce using jsforce. I would like to select all opportunities that are closing within the next year. I firstly tried to use a javascript date but I get an ...
0
votes
1answer
24 views

Get Name of item from SetupEntityAccess SOQL

I'm working on a query that would involving the SetupEntityAccess object in salesforce. I noticed that there is no field that shows what the name of the item is, but only the type of the item such as ...
0
votes
1answer
24 views

System.QueryException: unexpected token: accountid

I run the following code in the scheduled class: List<String> sObjFields = DynamicSOQL.getFields('Contact'); String query2 = 'SELECT ' + sObjFields + ' FROM Contact'; ...
-2
votes
1answer
29 views

Converting a List of Sobject to Map with a specific field as the key on each of the records [closed]

I have a list of Opportunity contact role records and I want to convert this into a map with the ContactId as the key and the rest of the record as the value. SObject[] sObjs = DynamicSOQL.Soql('...
0
votes
1answer
30 views

Get Name of Account and User instead of ID

LOS__c is a lookup to Account and Interface_Manager__c is a lookup to User. In the following SOQl I am trying to get the Name of the Account that LOS__c is looking to, and name of the User that ...
0
votes
1answer
21 views

another GROUP and ORDER SOQL question

Honestly, I have never understood how the GROUP keyword works, I actually read many articles in the salesforce site; however, I still cannot really use this keyword properly, especially when it comes ...
0
votes
1answer
47 views

SOQL Query for Contacts (Related to the Account) & Opportunity Contact Roles - In a LWC (Lightning Web Component)

For a given opportunity I would like a list of all contacts related to that opportunities Account & all of the opportunitycontactroles. For example: if account a has three contacts and two of ...
0
votes
0answers
11 views

SOQL Problem with Date in INSPECTOR

I have an object called Animal__c with a field Custom_Date__c, this field is a string with stores a date such as '17/03/2020'. Which is the date of Today in string format I want create a report which ...
0
votes
1answer
18 views

How to retrieve a list of sharing rules per object via SOQL?

I am looking for a quick way to retrieve all the sharing rules for Account and Opportunity object via SOQL. As per my research, I found two objects AccountShare and OpportunityShare, but this will ...
2
votes
0answers
36 views

order of records received in batches for batch class

I have a batch class where i need to grab the records sequentially. It looks like if i am querying regularly in salesforce and system.debugging the outputs, the records do not seem to be in any ...
1
vote
1answer
24 views

Opportunity Child Query on Contact

The following query is working, but I am not sure why: select Id, (SELECT id FROM opportunities ) from Contact I was always under the impression that there was no relationship between the contact ...
0
votes
1answer
45 views

Batch apex class not querying through all records

The below code runs 57 batches out of 98 and then says the below message: global class MDUSquadRawDataBatchTest implements Database.Batchable<sObject>, Database.Stateful { List<...
-1
votes
0answers
10 views

Getting Invalid field error when using the sObject method to get value of a parent relationship field [duplicate]

List<sObject> recordList = [Select Id, Name, testfield__r.Name from Opportunity]; List<String> fieldsAPIs = <List of API names of all fields from Opportunity object> for(String ...
1
vote
1answer
50 views

Need help with LWC, trying to create datatable to show “Related Contacts” with “Role” (AccountContactRelations)

first time posting here. I'm working on only my 2nd ever LWC. The org I'm working in has the "Related Contacts" feature enabled so they can have desired contacts set with a "Role" such as "Decision ...
0
votes
1answer
21 views

Malfunction SOQL Query

I have the below Data Categories Group1 Category1 Category2 Group2 Now the query which I am trying to execute is below to get all the articles in published state and linked with Group 2, ...
0
votes
1answer
20 views

Data Loader > Edit SOQL query for Extraction > using AND & OR in the conditions = Not working

I'm Using Dataloader to Export. In the SOQL Query, I can't seem to use "AND" & "OR" all in one Query. Only one or the other. Select ID, ParentId, RecordTypeId, OwnerId FROM Account WHERE ...
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
14 views

How to retrieve custom field 3 levels deep from custom metadata

I retrieve a field 3 levels deep which is working currently. The field which I currenly retrieve is going to become a dynamic field retrieved from custom metadata. How do I cast this to an id? I ...
0
votes
1answer
26 views

How to modify two similar queries to optimize my code

I have two queries that are similar except there's a few differences between them. I was wondering if there's a way to optimize this, by querying this once and still do what I want with my code. The ...
1
vote
1answer
31 views

How to modify semi-join and anti-joins

I have similar code to this where I want to store the values of a query from a semi-join and anti-join. I want to store the values in a list respective on whether if its a semi-join or anti-join. But ...
0
votes
0answers
27 views

SOQL query by owners being below in role hierarchy

I have the following role hierarchy CEO | |--Big boss | |--National Manager | |--Regional Manager | |--Team Lead | |--Employee I am free ...
0
votes
2answers
28 views

List Index out of bounds even after null check of the element in the List

Getting List Index out of bounds error even after null check. below sample workable code. Apex Demo Code String order = 'asc'; String usrId = '<userid>'; String query = 'SELECT Id, ...
0
votes
1answer
132 views

No SOQL in for loop

Re-factoring this below code to avoid SOQL in for loop. In this case below soql is for different object than the object passed in param. The solution I am trying needs for loop inside for loop, wonder ...
0
votes
1answer
20 views

Filter Object Queries Based On Profile Name

So, as the title says, I would like to find all the records of an object that have been created by OR are only visible by a certain profile. Here is a query I have tried SELECT Id, Subject, ...
0
votes
1answer
18 views

Can't query within a query

I'm attempting to run a query within a loop to fetch a record and place the value into a newly created record, but am getting an error when attempting the 2nd query. I only included a small portion ...
1
vote
0answers
15 views

Unable to query Task Queues on VF page load?

I have a bit of a frustrating problem. On my VF page, I am getting queues that are assigned to a selected Object. When a user selects 'Task' from the drop down of available objects from an <apex:...
0
votes
1answer
18 views

SOQL API query with custom objects and relationships. Returning a flat result - Not nested

I am working with a third party software solution that consumes Salesforce API data via WDSL. I can run queries on any of the tables to return the result object - this works fine. I need to get ...
-2
votes
1answer
17 views

How to filter records on boolean field in Batch apex

Fields are as follows:- Assistantname which is text Level__c is a picklist field prestigious_contact__c is a boolean field When I run this query I keep getting Unexpected Token :-'&&' error ...
0
votes
0answers
21 views

Is there way to know if skinny table is Enabled in SF org?

I wanted to check if any information is available via SOQL-tooling API or is there any flag or some sought of information available VIA API or anything which will tell me by looking into salesforce ...

1
2 3 4 5
92