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
31 views

SObject row was retrieved via SOQL without querying the requested field: Webinar_Attendees__c.Voucher_Assign_Date__c

'm trying display parent fields and sub query fields in a table.But I'm unable to display sub query fields.Could anyone suggest an idea for me Page : ====== ...
-1
votes
1answer
21 views

Loop must iterate over collection: Webinar_Attendees__c

I'm trying to print sub query fields but I got the error like "Loop must iterate over collection: Webinar_Attendees__c". list<Webinar_Attendees__c> re = [SELECT Id,Login__c,Name,...
2
votes
2answers
46 views

Can APEX perform a bulk INSERT INTO…SELECT FROM like statement dynamically?

The basic question is if it's possible to create an INSERT operation using a SELECT statement as the source, rather than selecting individual records, pulling them out of the Salesforce database into ...
0
votes
1answer
15 views

Get the account list which has only one inactive AccountContactRelation

This might be pretty basic but I can't get anything on top of my head right now. We need to query all the accounts (or AccountContactRelation which is fine as well), which has only one inactive ...
2
votes
1answer
25 views

PARENT CHILD SOQL

I have this query which is working but is it possible to only return a list of Accounts where company__c exists. SELECT ID, name, (select company__c from VotingRelatedCompanies__r where ...
0
votes
1answer
19 views

Get last modified data older than 30 days from now in SOQL

I wrote the code for the condition: delete data where LastModifiedDate is older than 30days from today. Code: data= [SELECT Id, Name, Type, Status, LastModifiedDate FROM Account ]; for(...
0
votes
1answer
18 views

How can I filter a query with the results of a list?

I want to search properties only from this one list, "HIP Prospects". If the name searched is in this list I want it to be returned. How can i achieve this? Apex: public static List <...
2
votes
1answer
40 views

sum of a field giving incorrect values when queried

I have a field called purchase price in orders table. When I query for those orders, I got 4 records. They are as follows Here, as per the above query, when i sum purchase_price__c, i am getting 194....
-1
votes
0answers
14 views

salesforce get n lead records owned by user group by user [on hold]

We facing one situation to pull all lead with Limit 50000 where owner Id from ownerId set. then we are getting 7 records from the all lead group by ownerId. is there a way to achieve in SOQl. ? We ...
-1
votes
0answers
48 views

Add a new product to a custom Object Product__c

I am new to salesforce. My problem is: I have a custom object, called Product__c and I need to add New and Save buttons to the page. The New button should show Input Fields. And the Save button should ...
0
votes
1answer
25 views

System Permissions Assigned to Permission Set

Is there a SOQL/SOSL to export/FETCH only the System Permissions from a Specific Permission Set in Salesforce.
-2
votes
0answers
15 views

Apex Output value has an Apostrophe [duplicate]

I'm adding an output value in apex trigger with a status that has an apostrophe IAP.IAP_Status__c= 'Assessor's Queue' ; But it is throwing an error. How should I change this in the apex code?
0
votes
1answer
23 views

Didn't understand relationship 'Orders' in FROM part of query call [duplicate]

I have a problem to attempt to the Order object based on the custom Contact lookup. I use the query: select Id, (select id from Orders ) from Contact and the object looks like that: The error is: ...
0
votes
1answer
15 views

Append 2 profiles in a single SOQL query

I have a query and I am fetching record based upon a single profile but I want to append one more profile along with this query. So that I can get both the profile record in a single query. UserData ...
0
votes
2answers
36 views

Returning wrong order in SOQL ORDER BY

I'm facing a problem with the SOQL ORDER BY. I'm quering on a custom object with this query SELECT completeTreeSequence__c FROM CPQ_Line__c WHERE CPQ_Header_RU__r.Id = 'a043E000005PfD7QAK' ORDER ...
2
votes
1answer
29 views

How do SOQL queries act in Queueable (async) apex?

I have a set of 4 Queueable apex classes that perform an ordered series of tasks on a large number of records. It queries a limited number of records, modifies them so that they no longer meet the ...
8
votes
1answer
114 views

Custom Metadata SOQL WHERE clause not working

I'm getting some weird behavior with a SOQL WHERE clause on a Custom Metadata Type query: SELECT Id, Label, DeveloperName, Version__c, Content__c FROM My_Text_Content__mdt WHERE Version__c = '2020' ...
0
votes
2answers
22 views

How to get chatter feed of Case in single SOQL query?

I am trying to get chatter feed in single SOQL query as below: [Select id, Casenumber, (Select id, Title From FeedItems) From Case] But its not working. Is it even possible? Or else should I get it ...
7
votes
2answers
94 views

Are the related objects in an SOQL query shared?

I have an SOQL query between two custom objects, let's call them A__c and B__c, where A__c has a Lookup field called B__c that references a B__c instance and B__c has two fields X__c and Y__c like: ...
4
votes
2answers
46 views

how to find out Schedulable class is already scheduled or not?

I have a apex class which implements Schedulable interface, I want to find out whether this class is already scheduled or not? Please help me with SOQL query to find out this.
1
vote
1answer
42 views

Trigger for loop and SOQL limits

I have a trigger. It inserts imported Gears with correct fields' values. One of valu I took from Detail__c - related to MoreInfo__c object. And Tool__c is related to MoreInfo__c too. Each MoreInfo__c ...
0
votes
1answer
29 views

Assigning SOQL results to a set

I am trying to get Id list like this: Set<Id> idSet; idSet = [SELECT Id FROM Account LIMIT 1]; But getting this: Illegal assignment from List<Account> to Set<Id> I need to do ...
1
vote
1answer
36 views

Help with NOT in SOQL [duplicate]

I'm trying to query for records that do not contain LTD or LLP in the name and are also not assigned to a certain record type. I have tried just about every variation with parenthesis and AND/OR ...
0
votes
0answers
30 views

SOQL Knowledge Articles

When I do the soql query: SELECT Id, ArticleMasterLanguage, Language, Summary, Title, UrlName, ValidationStatus FROM KnowledgeArticleVersion I get these results: But when I use this query in ...
1
vote
1answer
16 views

SOQL pagination OFFSET 2000 limit ordered by Created Date for bulk imported records

I have a requirement to present records with infinite scroll (e.g. using lightning-datatable, but frontend presentation part of this is irrelevant) ordered by created date descending (most recent ...
0
votes
0answers
17 views

How can I return a Custom Object with a List of Parent Data from querying the Junction Object? [duplicate]

I am new to Apex trying to do some practice assignments and have gotten stuck on this junction object query. Task: Edit the current getUser() method to do the following: Return a custom object (that ...
1
vote
1answer
37 views

How to identify in Apex what picklist fields are restricted

I wish to apply logic if a picklist field is a restricted picklist. Let's say I have a restricted picklist field called 'County__c'. I can see that there are a number of methods available in the ...
0
votes
3answers
53 views

What's wrong with my query? [closed]

@AuraEnabled public static List<Product2> getProduct2(List<String> Ids) { system.debug('productsetids' + Ids); Set<String> filterIds = new Set<String>(); for(...
0
votes
1answer
41 views

How can I change this method to query my master detail object?

I am new to Apex trying to do some practice assignments and have gotten stuck on this junction object query. Task: Edit the current getUser() method to do the following: Return a custom object (that ...
-2
votes
1answer
24 views

Trigger after insert: can't update a record with no direct connection

I have this construction: If we create a Factory 2 with InDateTime__c = OutDateTime__c of the Tool 1 with the same Opportunity 1 (with another Factory 1 with the same Opportunity 1 relationship), ...
0
votes
2answers
18 views

get email of contact from account with the accountid

I have one contact in one of my account. I have the account id of that account. I am trying to get the email of the contact in my account with a soql query but it is returned blank : contact em = [...
11
votes
2answers
136 views

SOQL query selectivity changes with number of IN clause records

I have a custom object with a Master-Detail relationship to Opportunity. The relationship field to the parent Opportunity is automatically indexed. There are 200,000 plus of these custom objects in ...
1
vote
1answer
34 views

SOQL with conditions on children

I'm unable to finish an easy query, I could use some help on this. I got a junction object called Creche_Zone_de_Tarification__c that links two objects (Account and Zone_de_tarification__c and that ...
0
votes
2answers
42 views

Migration Flow Too Many SOQL Queries

I created a one-time use flow for migration purposes. It looks up all the records to update, and calls a subflow to update each one. The subflow runs 8 or 10 queries and then updates one record. ...
0
votes
0answers
27 views

How do I get the list of Users assigned licenses to my managed package in a subscriber org

How do I get the list of Users assigned licenses to my managed package in a subscriber org based on the Package Name OR Package ID? I do not want to use Package namespace, which is possible by ...
0
votes
1answer
20 views

Field Permissions History Query

I'm aware on how to run a query on FieldPermissions object to check the permissions for a specific field. The question I have, and I haven't been able to find anything online yet, is: If I run the ...
1
vote
1answer
20 views

Getting currency code with SOQL query for all types of organizations

I need to get the currency code of currency fields (such Opportunity.Amount) in a way that works for both multi-currency and single-currency organizations I don't use Apex, I use SOQL My approach ...
0
votes
1answer
28 views

How to avoid limits in Trigger's SOQL?

I have a trigger. And if it's an import of many records I get an error becouse SOQL Limit is 101 records: trigger GearCreationTrigger on Tool__c (after insert) { List<Gear__c> toInsert = ...
-1
votes
0answers
25 views

Group By Malformed Query [duplicate]

what I am trying to do is group by family and MemberType and get a count for how many of each membertypes in each family. I am pretty sure I am close but I am not seeing the issue. SELECT Family__c, ...
0
votes
1answer
28 views

How to query attached fiels from library in Lightning style?

I have the following query: List<Document> attachments = [Select Id, Name, Type, Folder.Name, FolderId From Document WHERE Folder.Name = 'Team Attachments']; In Lightning I have the same ...
2
votes
4answers
55 views

See Number of Queries Executed in Call-chain

I have an Apex Controller that is sporadically bumping up against the SOQL Governor limit when executing some functionality. The functionality does some queries and updates some values which executes ...
1
vote
2answers
148 views

What is wrong with this query (unexpected token: AND)

Can anyone whats wrong with this Query SELECT Id,name,Email,MobilePhone,MailingCity FROM Contact WHERE Key_Skills__c = 'C++' OR MailingCity = 'Austin' AND ( Id Not IN : applicantId ) LIMIT 1000 ...
1
vote
2answers
31 views

Unable to use Less-than/greater-than with Datetime in SOQL condition

I am unable to use a Datetime field in a SOQL query: SELECT Status FROM Campaign WHERE LastModifiedDate >= Last_Sync__c; I have a workaround where I create a checkbox formula field which is true ...
0
votes
1answer
33 views

How to extract attachments data in Lightning Experience?

I'm currently using the Document object/table in SOQL to extract attachments in Salesforce classic. As far as I'm aware in Lightning it is necessary to use File instead of Document object to extract ...
0
votes
1answer
16 views

Aggregate Queries Count is Wrong

As per the Salesforce official document, For COUNT() or COUNT(fieldname) queries, limits are counted as one query row, unless the query contains a GROUP BY clause, in which case one query row per ...
0
votes
0answers
24 views

How to get all data of a profile

I want to get all data including Object permissions, field permissions, system permissions, Apex class access, visualforce page access of a profile, but not able to do that from soql query since ...
0
votes
2answers
36 views

LIKE Clause Error: Only variable references are allowed in dynamic SOQL/SOSL

i'm running a dynamic search, i want to add "where field like" conditions like this filter = ' Name LIKE :(%'+ RowFilter.get('Name') + '%) AND'+ 'Account.Name LIKE :(%' + RowFilter.get('...
0
votes
1answer
21 views

Can't query newly created field after deploying change set (works in sandbox)

I created a field 'Legal_Records_Parent_Box_Folder_Id__c' in a sandbox for the Account object, deployed the field to production, with a few scripts where the field was referenced. When I query the ...
0
votes
0answers
21 views

Lookup Query returning JSON instead of Relationship Field

My SOQL Query is: SELECT Account.Academic_Alliance_Manager__r.Name FROM Contact LIMIT 1 This is returning a string like the following { "attributes": { "type": "User", "url": "fillerurl" }, "Name": ...
0
votes
1answer
30 views

Connect Campaign Members to Opportunities Using SOQL

I am trying to create a SOQL query that will give me contact and opportunity information from people in a specific campaign. I have done the following and I can get Contact information, but I am not ...