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
0
votes
0answers
10 views

Is there a way to full export of UserRecordAccess object

We have an integration with third party application where we want to inherit salesforce Account object security for all the users. SAML is the authentication mechanism used for authenticating user to ...
1
vote
1answer
29 views

Rest API: How to log/monitor executed SOQL queries

We have mobile application which communicates with our SF org via Rest API by executing thousands of different SOQL queries. There are usually three types of problems with such queries built ...
0
votes
1answer
21 views

Filter soql contact records using Google Location API in LWC

Here's what I'm trying to do: Search and find a list of contact records with zip codes. Filter those records using zip codes that are in 5 km radius. I'm unable to perform the 2nd point. Is there ...
1
vote
0answers
30 views

Get # of days for week number X

Is there a way to get the total days or hours of each week of a month? I am using WEEK_IN_MONTH() to get the week number but now I need something like HOURS_IN_WEEK() or DAYS_IN_WEEK() which I can ...
0
votes
1answer
25 views

Why we can't compare two fields in SOQL where clause [duplicate]

Let's say we have a query select id, history_contact__r.last_seen__c, request__c from history__c where lot__r.active__c = true and history_contact__c = '0031y000004Kr1AAAS' and ...
1
vote
2answers
47 views

SOQL Query Exception Non Selective Query in after insert Trigger

I am loading contacts records and when my after insert triggers runs I am getting the following error: System.QueryException: Non-selective query against large object type (more than 200000 rows)...
1
vote
1answer
11 views

Query to find max(RecordId) on Duplicate Record Items

I want to find the AccountId that is most of times used as Duplicate Record Item. I tried select id, count(RecordId) from DuplicateRecordItem group by RecordId but i get MALFORMED_QUERY: select ...
3
votes
1answer
54 views

Do Process Builder/Workflow Actions count against DML/SOQL governor limits?

This might seem to be a fairly simple question but I cannot find documentation which clearly states this. I have doubts about these questions- Do workflow/process builder actions such as field ...
0
votes
1answer
29 views

Account and contact soql query

I want to retrieve all the contacts that have an account with soql query How do i find them Please find below query: Select accountid from contact where accountid in select id from account
0
votes
0answers
36 views

Soql query for self lookup on account

Trying to get a sub-query within the Account trigger. Account has a lookup to itseff self in field entity__c How do i get the entity__c records related to the parent account i tried the above soql but ...
0
votes
2answers
39 views

SOQL SORTING WITH 2 FIELDS

I have the object Animal__c, with the field ZooId. I want to make an SOQL Query with the animals sorted by CreatedDate DESC and Zoo Id. Now the list is: Animal 0 ZooId 5 CreatedDate Yesterday ...
1
vote
1answer
45 views

Didn't understand relationship 'Attachment' in FROM part of query call

I am trying to get all Accounts that has attachmentss. These accounts are of a particular record type, and has a certain value in Manufacture__c field This is what i tried list<Account> acc = [...
0
votes
1answer
39 views

Database Apex class benefits [closed]

The pros and cons of using Database apex class oposite to SOQL direct queries or DML - in which cases we should use database class?
0
votes
0answers
28 views

Batch Class and SOQL Implications: 1% of the time a record gets updated that shouldn't

pretty high level question here based on some of the erroneous updates I'm seeing (less than 1% of total records processed). I'm currently running a batch class (50 record batch size). It is a ...
1
vote
1answer
28 views

Query on Process builder Scheduled Actions

We have 100+ scheduled Process builders that triggers based on conditions. As a end user We want to show which process builder Actions scheduled related with Lead/Contact object as creating child ...
3
votes
1answer
71 views

More efficient to query or to loop through a bulk return of sObjects

Kind of a vague question but I am writing some "rollup" or summary queries that in totality will collect right around 340 account records between the 4 of them. These are rolling up from (client) ...
8
votes
1answer
80 views

How to opt out of FLS validation when a SOQL query is run by a trigger?

I have a large Salesforce application with hundreds of SOQL queries. Currently, the code uses Schema.DescribeFieldResult data to determine if the logged in user has rights to each field in the SELECT ...
2
votes
2answers
41 views

looking to query the sfdc metadata and determine if there are any workflows, validation rules etc that are specifying a “null” record type

There is a requirement where we need to know if there are any workflows, validation rules, code, process builders, etc that are specifying a "null" record type for any of the object in the org. We ...
4
votes
0answers
38 views

Is this a good Model for “Guaranteeing” Record Updates Don't Fail due to ROW_LOCK/Race Conditions?

Background: The zqu__Quote__c object in our org has two child objects from another managed package we use for eSignature and credit card capture. One of those two child objects collects the Credit ...
-2
votes
1answer
29 views

Is it possible to pass string of ids in Where IN dynamic Soql the dynamic part should accept Set id's and Lis id's [duplicate]

I have a dynamic soql in where I pass a string of ids in the WHERE IN clause this thtrows me a error: expecting a colon, found '{' My where clause is as follows: WHERE Id IN {x0x0o000000000xXXX}...
4
votes
1answer
38 views

How to access fields returned by Polymorphic query in apex/soql?

This might seem to be a fairly simple question, but I am unable to figure out how to use the fields returned by a Polymorphic SOQL query. For example: I ran the following query in dev console's query ...
2
votes
2answers
179 views

SOQL IN vs NOT IN operator

Is there any advantage of using operator "IN" instead of "NOT IN" in SOQL? Are there any performance benefits of it? I have a use case where I have to filter the records based on a certain column, ...
0
votes
1answer
22 views

SOQL query giving error - illegal assignment from List to List

trigger AccountCallableContact on Account (before insert) { for (Account acct : Trigger.new) { if (acct.Phone != Null) { LIST<Contact> MatchContact = [SELECT AccountId, ...
4
votes
1answer
88 views

Is there a way to programmatically access change sets as records?

Is there any way to access a change set and its components from a SOQL query or any other programmatic method?
1
vote
2answers
27 views

SQL relation PHP Toolkit

I have the following object (hed__Course_Enrollment__c), with a relation to the Contact object: For a given hed__Course_Enrollment__c Id, I want to show the first and last name of the contacts. If I ...
-2
votes
1answer
31 views

Getting error:-“NewCaseSendEmail: System.LimitException: Too many SOQL queries: 101”

trigger NewCaseSendEmail on Case (after insert, after update) { system.debug('inside Case after insert update trigger*****'); if(Label.EXECUTE_TRIGGER == 'False') ...
0
votes
1answer
43 views

Is it possible listView upsert using query

lightning:listView don't support changing list views, so I get listview name using SOQL in order to make custom list view changer. It's success, so next, I want to make custom list view creater. I ...
-1
votes
0answers
22 views

SOQL : Count of Contacts [duplicate]

I'm getting the following error while quering count of contact(child) from Plan_c(Parent). Integer count = [SELECT Count(Contact__r.id)FROM Plan__c where id = :recordid]; ERROR at Row:1:Column:...
0
votes
1answer
54 views

SOQL with GROUP BY & ORDER BY

I'm trying to get the following lines to function however receive a return of MALFORMED_QUERY: Ordered field must be grouped or aggregated: Line_Number__c. What is wrong here? SELECT ...
2
votes
1answer
31 views

Perplexing ContentDocumentLink SOQL issue

I have the following code: // Note: cdlToDos == Map<Id, Set<decimal>> System.debug(cdlToDos); List<ContentDocumentLink> cdlList = [ SELECT Id, ContentDocumentId, LinkedEntityId ...
1
vote
1answer
28 views

SOQL Query With Running Tally or Running Totals

I have a Payments object with dates and corresponding payments. We can query the data via SOQL in our API and the data looks like this: SELECT Date, Amount FROM Payments WHERE CreatedDate>2019-01-...
0
votes
1answer
28 views

Any way to Query for LinkedEntityId from ContentVersion

Wondering if there is anyway to query for LinkedEntityId from ContentVersion? As i understand, ContentVersion looks up to ContentDocument which then looks up to ContentDocumentLink (could be wrong ...
0
votes
3answers
52 views

Date Format (yyyy/MM/DD)

I am having date field in the UI. I have written code as per below Datetime XXX = (Datetime)FieldName; yyy= XXX.format('yyyyMMdd'); But after executing the batch date is decremented by 1 ...
1
vote
1answer
137 views

How to remove a SOQL query from a loop

I have a query for Opportunity records which are retrieved based on Account Id. I am not sure how I can remove them out of the for loop I had to use the Opportunity for each account in the list, ...
0
votes
2answers
49 views

Newest records for a SOQL Query

I have the Object Case and the Object Agent and I have multiple Agents created by Case. Both of them have their Ids. Agent has a field CaseId and I want a List with the newest Agents related with a ...
0
votes
1answer
34 views

How to query archived product

I noticed that archived products don't get returned in soql. Is there a way to accomplish this? Example query: SELECT Id, IsArchived FROM Product2 WHERE Id = '01t50000001CQp6' AND IsArchived = true ...
3
votes
1answer
48 views

SOQL - Using RecordVisibilityContext clause to filter WITH queries

In the new SOQL changes in the upcoming Spring '20 release, it mentions in the Changed Calls section: Select items based on visibility. Use the new RecordVisibilityContext clause to filter WITH ...
0
votes
1answer
43 views

Batch with 3 related objects

Suppose i have 3 related objects: Continent - Country - City. Country object is child object of Continent and City is child object of Country. City -> Country -> Continent. I would like make changes ...
1
vote
1answer
28 views

Working with searches and query API. Executing a SOQL query using “IN” clause

select Id, Name from Contact where Email in ('apple+super@gmail.com','apple+100@gmail.com') Can anyone help me to query this using the salesforce query api endpoint. The endpoint that I have tried ...
0
votes
2answers
60 views

Too Many SOQL Queries 101 [closed]

I have a test class where i am getting 'Too many SOQL Queries : 101' error. I looked up my batch code for any Query violations in FOR loop or DML operations in FOR loop but i couldn't find some. I ...
0
votes
1answer
23 views

How to retrieve parent filed value

Let's say a have a code User tempo = [select contact.name from user where id= :UserInfo.getUserId() limit 1 ][0]; how can I take contact.name value from tempo?
1
vote
1answer
42 views

Help with JSforce query - 'Bind variables only allowed in Apex code'

I'm trying to execute the following query using JSforce: conn.query('SELECT RecordId FROM UserRecordAccess WHERE UserId=:' + userId + 'AND HasReadAccess = true AND RecordId IN :' + listOfIds + ' ...
2
votes
1answer
90 views

SOQL Query For To Get the Tabs of Particular Application

I want Soql Query for to get the tabs(Navigation Items) under one application (App) in salesforce. Suppose Application Name is Data Management under these We have Database,Table,Column tabs as Custom ...
2
votes
1answer
17 views

Cannot run SOQL on Encrypted Contact Field - Deterministic Encryption Enabled

I have shield encryption enabled on the contact object and on the email field of the contact object. In custom apex code (a inbound email handler specifically), I am trying to run a SOQL query to ...
1
vote
2answers
33 views

Unable to save a new Contact through a custom VisualForce form

Using VisualForce & APEX to submit a new Contact record. Generating a custom form and trying to save the records as a new 'Contact' on my SF instance. Once I click on 'Save' button below error is ...
2
votes
1answer
30 views

SOQL query for all Users who have read access to Task object

I am trying to write a SOQL query to find a list of Users who have read access to the standard Task object but my query keeps coming back empty. Is there a better way to do this? I have a dropdown ...
2
votes
1answer
24 views

Visibility of ContentNote records

This could be a general Developer Console issue as well, but as of now it pertains to the ContentNote object. I am trying to run a query in an apex class that will looks at related Content Notes on ...
4
votes
1answer
59 views

Is there a way to prevent SOQL from returning records that have been locked with FOR UPDATE?

If I have a class that is using FOR UPDATE to lock a record. Is there a way to prevent another instance of that class from calling those records that have been locked before the previous class is done ...
1
vote
1answer
37 views

How do I query data created from last week's Sunday to Saturday so that this data can be included in a batch process to be run on Tuesday? [closed]

I want to run a batch on Tuesday to process records created from Last week's Sunday to Saturday. I want these records to be processed as part of document generation using Conga. I cannot use ...
8
votes
2answers
217 views

Get all field level permission from SOQL for an permission set

What I want to do: I am trying to create a tool in Java, which query permission sets from Salesforce Org using REST(As we do in workbench). After getting all the permission sets which field ...