A Salesforce Object Query Language (SOQL), modeled on SQL, for accessing information saved in the Salesforce database.

learn more… | top users | synonyms

3
votes
1answer
23 views

SOQL to retrieve all contacts for an Account (related and direct)

I have an account with 4 contacts, two are direct and two are related contacts. I'm trying to retrieve all 4 contacts in an SOQL query but can't seem to get it to work . For example if I run this ...
0
votes
1answer
15 views

Createdby cannot reference custom field?

I am struggling with the createdby reference and hope someone could help me out. I have a custom object and as everyone knows there is a standard createdbyId created on every custom object. We can use ...
1
vote
2answers
28 views

Compare two list values with IN and NOT IN SOQL query

I have two queries, each populate a list of Cases, I need to create a third query that gets me the cases with their ID in the first query but exclude them if they are in the second query. Example: ...
0
votes
1answer
23 views

SOQL is not bring back selected field

I am trying to get a contact field(EOB_Opt_Out__c) related to a user, but the contact field is not being returned. Code: Id providerUserId = UserInfo.getUserId(); List<User> thisUser = ...
0
votes
1answer
27 views

Help in SOQL Query

Trying to create query for Contacts Table and Team Member Table. Would like to get data from contacts of off the Opportunity record like Opportunity ID, Contact Name, Phone. Also would like to get ...
1
vote
3answers
75 views

How can i query for lookup from one custom object to Account. And what is parent and child?

I have one custom object which related to Account. one lookup field in Custom object which is to Account. SELECT Id, Name, (SELECT id FROM Question_Answer__r) FROM Account But this is showing don't ...
0
votes
2answers
29 views

Compile Error: Didn't understand relationship 'opportunity' in field path

I'm attempting to create a report that maps activity on an account, by signalling whether certain 'capabilities' (services sold) stored as picklist values are selected on all related opportunity ...
0
votes
3answers
38 views

SOQL to pull child record id from associated parent [duplicate]

I want child record id with associated parent record id (e.g parent id=a8u540000004CWVAA3). I need all the associated child record ids given that parent Id SELECT Name,id, (SELECT ID FROM CHILD ...
0
votes
0answers
19 views

SOQL to self lookup. To display on a VF page [on hold]

I have a scenario where I have object Activity, a lookup field to same object and a checkbox. A activity can be a main activity and can have many child activities(lookup). I have a VF Page where each ...
0
votes
1answer
15 views

How do I validate an email to be compatible with Salesforce's database constraints?

Suppose I have an email. Suppose I want to insert a lead with an email. How would I make sure the email is valid before I insert it into the database? I am asking because I am inserting a lot of leads ...
1
vote
2answers
41 views

workaround sql govenor limits

I am building this program that will generate numbers in fields based off of other records in that object. As such, queries will be needed. I have the program to the point where it will update when ...
2
votes
1answer
74 views

Too many DML rows: 10000

I have a batch job that does lots of calculations and batch size is reduced to 10. Reducing batch size further is not an ideal option at this time due to other factors so to catch Too many DML rows : ...
2
votes
3answers
41 views

Invalid field for SObject using nested SOQL Query

Trying to create a list of Open activities so that I can sort and display as an apexDataTable on a VF page. I'm currently seeing the error: Invalid field Subject for SObject Account VF Page ...
3
votes
2answers
134 views

SOQL multiple LIKE matches [duplicate]

I am trying to figure out the best way to do multiple LIKE matches in a complicated soql statement. I want to change the hubFilter value from just "BCS%" to "BCS%,Benefit Advisor,Mgr of Ben,BSR". I ...
0
votes
1answer
18 views

How to update approver comments in opportunity object

My requirement is to copy the approver comments in the Opportunity Level Field When the approver approves the record with comments.I have to update in opportunity level. Is there a way to achieve ...
0
votes
0answers
29 views

Arithmetic expressions must use numeric arguments

if(AcctIds.size() > 0) { listAcct = [SELECT Id, Count_of_Contact__c FROM Account WHERE Id IN : AcctIds]; for(Account acct : listAcct) { Integer noOfConts = 0; ...
0
votes
1answer
16 views

Unable to assign 2 leading zeros in field creation

Hi friends i stuck in a place i want to assign two zeros when ever any record is created. My requirement is i have a number field.whenever i created any record i want to assign default with 2 zero's....
0
votes
0answers
17 views

SOQL getting the first date of Week number with Group by WEEK_IN_YEAR function

I would like to query aggregated results from SOQL, grouping by Week number using WEEK_IN_YEAR. I am aware that Salesforce defines as such: Week 1 is first 7 days of the year, that is 1 Jan to 7 Jan, ...
11
votes
0answers
95 views

SOQL ignores : WHERE RequiredLookup__c = null

I just figured out, that SOQL ignores null checks on required fields. It seems to expect that required fields can never be null. In my case it's a new field, so a bunch of records actually have null ...
1
vote
0answers
16 views

SOQL over REST: “Truncated”, “Malformed query” depending on which record IDs I ask for

The following query, when run over the REST API, gives me an error: SELECT Id WhatId, WhoId , TaskWhoIds , Subject, ActivityDate, Status, Priority, Owner.Name, ...
0
votes
1answer
12 views

Process builder is not firing based on approval process field update

I stuck in a place where in approval process i have a field update. So based on this field value i run a process builder.But approval process is working fine.But the process builder is not working.If ...
0
votes
0answers
20 views

Create an approval process for specific conditions

I got a requirement in approval process.but i'm in new in that.Icreated an approval process but i stuck in a place. My requirement is like i have three fields called unitprice activationfee and ...
0
votes
1answer
26 views

How to make a field mandatory based on multiple fields

I have 6 fields, 3 of which are picklist and 3 of which are text fields. If any of these fields are not null or blank, I want make another filed mandatory. I tried a validation rule with or condition....
0
votes
1answer
23 views

Any way to restrict empty fields from email templates

Hi friends is there any way to restrict empty fields from email templates when sending email to users with workflow or any other. I have a workflow.Whenever any record meets the criteria it will sent ...
1
vote
3answers
36 views

SOQL error on enabling namespace

I have enabled namespace in my dev org. Namespace name - LightningMyth. When I write the following query in any class/trigger, List<Account> acc=[SELECT ID FROM ACCOUNT limit 1]; I get ...
0
votes
1answer
18 views

SOQL add dummy column

Is it possible to create dummy column while fetching in SOQL Like select 'Dummy Column Text' as DUMMYCOL from MY_TABLE
3
votes
1answer
24 views

System index is not being used when running a SOQL query with DAY_ONLY()

CreateDate is a system index field maintained by Salesforce. I'd like to know when you running a query like this: Select Id from Account Where Day_Only(CreatedDate) > exampleDate Does the ...
3
votes
1answer
120 views

Query to fetch parents on the basic of number of children

Group__c has a lookup relationship to Account. What should be the query to fetch the number of Account records which have more then N Group__c child records? N can be anything like 3,5 etc.
0
votes
1answer
29 views

Get value of custom field using Javascript

I am trying to make a button that shows up on the Lead List results page. In order to sync with another system properly I need to have this button basically copy the name of an Account that has a ...
1
vote
2answers
48 views

SOQL - Check if record exists without throwing null error

I am trying to check and see if a user has a record in another object. I am pretty sure that the way I have it coded right now will throw a null pointer exception if no record is found. How do I do ...
1
vote
3answers
270 views

How to query child to parent

How to query child to parent like contact to parent..and how to query master lookup relations. select id,lastnam,(select id,name from account where accountid=conatctid)from contact
1
vote
1answer
29 views

SOQL - Join accountshare, account & user

How can I use SOQL to join the AccountShare, Account & User objects to fetch matching data? Here are my attempts so far select id, accountid, accountaccesslevel, rowcause from accountshare ...
0
votes
0answers
20 views

Process builder is not updating with related records

Hi Friends i got a requirement like whenever a case is created (Or) edited with specific criteria.I need to update specific field in opportunity. So,for cases & opportunities have lookup ...
1
vote
1answer
33 views

SOQL load data all at once

How can I iterate and grab the data for different month instead of passing month and execute the soql and return the data and I believe this code can be written better than what I'm doing here... ...
1
vote
2answers
30 views

soql contains on multiple values

I have accounts with billingcities. I have a query like below, select id , billingcity from account where billingcity like%atl% If i want to search on multiple cities, how can I do this? will ...
1
vote
1answer
41 views

Apex String Query Error

I am trying to compute a query from a string variable such as public String query = 'SELECT Id,ownerid,closedate,name FROM Opportunity WHERE isClosed =false and closedate =: dtreshold and (...
0
votes
1answer
25 views

Limit in WHERE-Clause subquery

I want to do a query like this: SELECT Id, Name, Email FROM User WHERE Id IN (SELECT OwnerId FROM Opportunity WHERE AccountId = '001610000085XsNAAU' ORDER BY LastActivityDate DESC NULLS LAST Limit 1)...
2
votes
2answers
58 views

Process builder is not working as expected

I got a requirement like I have case record type called customer.Whenever any case is created with specific set of fields.i need to update specific field in opportunity. So,In that record type Look ...
4
votes
1answer
54 views

Is it possible to leverage SFDC Duplicate Matching fuzzy algorithm's within APEX code?

I'm hoping to leverage SF's existing fuzzy matching capability specifically with regards to addresses during a SOQL query or some other lookup mechanism. Before I just implement their solution for ...
0
votes
1answer
43 views

Simple SOQL Question about custom fields

I've been playing around with SOQL, and I've run into an issue I don't understand. Maybe someone can shed some light for me. I have the following code: public static String test(String ...
0
votes
1answer
33 views

Testing SOQL Calls in Custom Controller

I'm trying to write a test class for a custom controller that only has some variable definitions and SOQL calls. I've never written a test class for a SOQL call before and honestly have no idea where ...
6
votes
1answer
304 views

Is there a desktop (Windows) application I can run SOQL queries with?

I am new to Salesforce and so far I have found three ways to run queries: Developer Console Workbench Force.com IDE (Eclipse) These work for quick ad-hoc queries but for writing more complex ...
0
votes
1answer
38 views

Query is either selecting too many fields or the filter conditions are too complicated(Because of Formula Fields)

Please suggest... How to break up SOQL query? We have formula fields in an object which is making SOQL query complex. I would like to break up SOQL in to multiple datasets and revert back all to ...
0
votes
1answer
33 views

Unable to calculate days in apex

I need to calculate days between two fields. So I use daysBetween to complete when I try to do with two dates. When I try with single values. But, when I try with list it throws an error like: ...
3
votes
1answer
70 views

Can you use COUNT() in a SOQL query from SOAP API?

I want to use the Java SOAP API to execute a query like the following: connection.query("SELECT COUNT(Id) FROM Contact WHERE . . ."); However I get back a single SObject: [SObject fieldsToNull='{[...
0
votes
0answers
30 views

How to update standard opportunity field in lead conversion through Flow

I got a new requirement like whenever any lead is converted. I have to update specific standard field in opportunity. The requirement is if user assigns the new opportunity to existing account so I ...
0
votes
2answers
48 views

Creating dependency in multi picklist

Hi Friends i'm new to development.I got a requirement to create a dependency between multipicklist in standard object page. I have two Multi picklist in standard object CASE.But the controlling field ...
1
vote
1answer
152 views

Please explain below SOQL query

I have seen many people writing this kind of query: Account acc = [select Id,name from account where Id=:someId].Name; can any one please explain me what is the use of ".Name" here. What it do and ...
1
vote
1answer
17 views

Need to access the Period for a custom fiscal year, when PeriodLabel is null when SOQLing on the Period object

We have a Salesforce org where they are using a custom fiscal year. The following results in a correct week number, but a null PeriodLabel: select Id, Number, PeriodLabel from Period When going ...
1
vote
1answer
47 views

how to use group by in soql with lists

Hi friends i'm new to sfdc development I wrote a sample query to fetch opportunities related to account with some conditions try to group i getting error. my code is: List<Opportunity_Trial__c>...