soql's questions - English 1answer

3.904 soql questions.

I have an invoice Object which is connected to contact through case. I have a list of invoices which contain list of contactIds. This is what I have done: List <Invoice__c> lstInv = [select ...

I have a list of custom metadata type. I need to check if the string element is present in custom metadata type. Currently, I'm hardcoding the browser name in my if condition, but I need to compare ...

I have successfully setup my oAuth2 flow, created a Connected App and I can retrieve an access_token and instance_url just fine. Now that I have those two pieces of data, how can I perform SOQL ...

So we all know we can put an aggregate directly into an Integer, like this: Integer countAccounts = [SELECT COUNT() FROM Account]; Is it possible to do the same thing, using Database.query()? ...

So we all know it is possible to directly select into a Map, like this: Map<Id, Account> accounts = new Map<Id, Account>([SELECT Id, Name FROM Account]); Is it possible to do the same ...

I have 2 Managed package custom objects workcalnder(pse__Work_Calendar__c) and holiday(pse__HolidayObj__c) and their is lookup relationship between them. WorkCalnder is parent and holiday is child. ...

I am trying to query all of the Event Meetings from Active Prospect Accounts in my org. I think because of the strange way Accounts and Events are connected it's not working. SELECT Id, AccountId, ...

I simply try to execute a batch job and execute a SOQL inside the execute() method as below with having, execute() method has the line List results = (List)database.query(query); , and start() ...

I have an aggregate function in the below SOQL query, this query is executed with this method Database.countQuery(), I only have 32000 rows but the error says I am getting 50001 rows. SELECT COUNT() ...

I have inherited an org with a trigger which was creating duplicate opportunity contact roles. I have fixed the issue of the duplication but there are lot of OCR records which are duplicate. i want to ...

Clone SObject Relationships

6 answers, 1.668 views apex soql clone
Is it possible to use a database query to get a set of related records and clone them into new related records. sObject[] sObjectsWithChildRelationships = [SELECT Id, (SELECT Id, myObject__c FROM ...

REQUIREMENT: Need to move the query outside of the FOR loop in Opportunity trigger. PROBLEM: After moving query outside of the FOR loop, I receive an error when trying to save a new Opportunity ...

How do I learn SOQL? [on hold]

0 answers, 21 views soql
My ASPX developer suggested I learn my own queries in Workbench. I could use some powerful insight. Help would be appreciated. Thanks everyone

I am trying to extract the email domain from each contact record from the email address field and use it to query for matching values on the account record. How do I loop over a list of contact ...

We have moved all our Notes and Attachment to FIles in lightning, Now none of our Community plus users are able to view the files from their community login. We have added files related list on page ...

Soql inner join (Apex)

1 answers, 25 views apex soql
Morning guys, I am having a issue, I need to make a inner join in soql... Example: Process instance( table1) Process instance step(table 2) I need to create a table mixing both tables, Id tabel 1 ...

I have a data extension that has duplicate email addresses with each duplicate having a different rank associated with it. I need to dedupe the email addresses but keep the different ranks in added ...

I want to query all parent record based on the total number of child record and group by Parent but the aggregate query is not returning the child record without parent. SELECT Parent__c, COUNT(Id) ...

SOQL with character range

2 answers, 180 views soql
I am trying to get all records whose name starts with "a" and the second letter is in the range [a-s] The quires I tried but no luck: FROM Agreement__c WHERE Account__r.FirstName LIKE 'a[a-s]...

How can I retrieve all possible values for a REFERENCE field. I mean such a field that Schema.SObjectField field = doesNotMatter(); String fieldName = field+''; //fieldName now holds "...

SOQL on ContactHistory

1 answers, 32 views soql
Please can someone help me how to write query for below Scenario Scenario: Write a SOQL on ContactHistory table to check (FN, LN, DOB) any of these 3 fields has been changed within 24 hrs . I ...

Could you please help me with the syntaxis of this SOQL Query? I would like to do an INNER JOIN between A and B on A.FamilyMember=B.ID SELECT A.FamilyMember__c FROM A WHERE A.StartDate__c > TODAY ...

I need help troubleshooting the below apex. I have this class being called in a custom JSON Builder on a custom object. I'm logging successful runs in the log in the developer console, but in the ...

Please help me to rephrase this query. I want to display the name of the record which has duplicates in 3 fields. I am new to salesforce and am facing trouble in quering using Group By. string ...

I have below query fetching contact fields and task fields from task object SELECT Id,Who.Name, Subject,Description, ActivityDate, Status, OwnerId, CreatedBy.Name, ...

Here I'm trying to perform LIKE operation in SOQL when I'm passing a variable dynamically the Query is not returning the results? List<string> companies=new list<string>(); List<...

How can I query the user id/id's of the Partner User belonging to the Partner Account? Can you provide me with the approach/sample. I have a below query that fetches the id of the Partner Account ...

Can anyone tell me how to get the contentData and contentFileName for FeedComment ? I can get same for FeedItem using below query. [select Id,RelatedRecordId,Type,Body,CreatedDate,CreatedBy....

I'm querying on Contact object where the results are varying on Bulk API vs querying on developer console. Total records on Contact is 997820. Query on developer console: select count(id) from ...

I wrote a class that needs to query for "cases owned by the current user or in a queue", and so I wrote this seemingly normal query: Case[] cases = [SELECT Id FROM Case ...

For a bit of background, I have a string that contains my query that is something like this (with some logic omitted): SELECT Name, Owner.Name... FROM Opportunity.... I am querying some custom ...

I am running a trigger whenever a contact is edited. In trigger I am querying user [Select id from user] I am getting all the users when trigger in run in any internal user context. But when same ...

SOQL Like Query?

3 answers, 477 views apex soql query sosl
I am trying to make a query that will search for accounts with a name similar or exactly matching a field value. So for example I have "Sales-Force" in the field. There is an account called "...

How could I get this object Map<Id, List<Contact>> Using an SOQL query similar to this: Map<Id, List<Contact>> contactMap = new Map<Id, List<Contact>>( ...

I am new to Apex. I have a SOQL query like SELECT Session_Id__c FROM Device__c WHERE User_Id__c = :userid. In this User_id__c is custom field defined datatype as Text and userid is id of user. Is ...

Is there a way to count chatter posts for a specific record? I tried simple query: SELECT COUNT() FROM FeedItem WHERE Type = 'TextPost' But this doesn't work in Apex since it throws an error ...

I would want to know how I can display the result from a soql child to parent request? My request is: $query = "SELECT FirstName, LastName, (select Retreat_Booking__c.Retreat__c from ...

(SELECT Id, ParentId, DataCategoryGroupName, DataCategoryName FROM Info_Hub__DataCategorySelection). In this i did not find complete list of data categories. I want to list up all data categories ...

I've got a Python app that's using the simple-salesforce Salesforce API client. One operation that it performs is automatic re-assignment of contact owners based on the owner of the respective account,...

I trying to learn Triggers from TrailHead, but not able to understand this line of code. Map<Id,Account> acctsWithOpps = new Map<Id,Account>( [SELECT Id,(SELECT Id FROM Opportunities) ...

I have list of dates and I have stored them in a set. List<Account> a=[select id,duedate__c,overduedate__c from account]; Set<Date> sdate=new set<date>(); Set<Date> s1date=new ...

I am new to this entire setup and trying to create a query to add one month to a date field and compare with today's date. ex:today <= first sign up date + 1 **I particularly need to add one month ...

I am retrieving two properties from a record (object1) on update, and I want to look up another record (object2) that has both of these properties. So, for example: object1record.email = 'test@test....

Does Salesforce publish their SOQL and SOSL grammar? Do we have any link to download? I need to use ANTLR for creating parser on the SOQL and SOSL grammar. Please can any one help on this.

In below code, we can observe that 'actionPlanTempList' contains an ID 'a076F00000uedBaQAI'. Also ap_Action_Plan_Task_Dependency__c object also contains records for Action_Plan_Template__c=...

Requirement is:- Let's say there is one campaign named is "Campaign 1", now under this campaign there are three campaign member. now based on the button click system needs to generate pdf where user ...

I want to save the radio button(lightning component) value in salesforce. I am unable to do so. When i try to select any one of the radio button error says resultCmp.set is not a function. Here is ...

How does inner query works in SOQL? Suppose I have a query as : Select Account.Name,Account.Id,Id,Website from Contact I know that Contact has a field AccountId which stores the ID of Parent Account ...

I’m trying to create a SOQL query that returns attachment IDs from a custom object (Invoice__c) related to Account. The tricky part is to extract only the most recent attachment from each Invoice__c. ...

I have below SOQL query which works as expected SELECT Id, Who.Name, Subject, Description, CreatedBy.Name, who.Email FROM Task But when I add any lookup field on this it throws an error SELECT Id,...

Related tags

Hot questions

Language

Popular Tags