Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [soql]

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

0
votes
1answer
34 views

System.QueryException: Inline query has too many rows for direct assignment, use FOR loop

I have a batch executed : 1 out 4200 is failing with : inline query has too many rows for direct assignment,use FOR loop My code in the exec function: List<String> personAccountsIDs = ...
0
votes
1answer
18 views

How to do Tooling API Query filtering name

/services/data/v45.0/tooling/query?q=select+id,FullName+from+globalvalueset+limit+1 I'm able to fetch the one of the records. /services/data/v45.0/tooling/query?q=select+id,FullName+from+...
0
votes
2answers
22 views

Problem adding elements to a Map

I have the following for loop: for(FGM_Base__Benchmark__c bmrecords:[ select id, Number_Completed__c, ( select id, FGM_Base__Number_Update__c, Status_Grantee_Report__c from ...
0
votes
1answer
20 views

Using Python and simple salesforce with parameters “Bind variables only allowed in Apex code”

dict = sf.query("SELECT Id,FirstName,LastName,Email FROM Contact WHERE Id=:cid") cid is a variable defined by myself. I wonder how to use the simple query function to select the field. Any response ...
1
vote
0answers
28 views

Unable to compare Date value returned from SOQL within next SOQL where clause date field

Not able to compare dates returned from one SOQL as a list into another SOQL's where clause: ApexCode to store all date data into list: List<Account> a = [SELECT ID, FIRSTNAME,PersonContactId,...
-2
votes
0answers
13 views

Unable to get Campaign in Lead even there is standard lookup [duplicate]

I try to fetch the lead records as List<Lead> ld=[Select id,name,Campaign from lead]; but I am unable to fetch the records. it showing an error ERROR:-No such column 'Campaign' on entity 'Lead' ...
0
votes
1answer
30 views

soql Expression cannot be assigned

list<dnc_suppression__c> dncsup = new list<dnc_suppression__c>(); dncsup = [ select id, vin__c, DNC_Owner_Ind__c, First_Name__c, Email_Ind__c, Campaign_ID_1__c, ...
0
votes
1answer
12 views

Search in All Fields plus topics for feeditems

I currently have an SOSL query [FIND :finalSearchText IN ALL FIELDS RETURNING FeedItem(Id, Title WHERE Type = 'QuestionPost') LIMIT 10]; This works great for searching the feed item title and body. ...
0
votes
1answer
32 views

How to move a SOQL query that contains a loop variable, out side of for loop?

I'm new to Apex and need to assign a User to a Contact via lookup field on the contact record based off of the user with the least amount of assignments and matching endpoints (account name custom ...
2
votes
1answer
32 views

Salesforce searching capability

We're trying to provide a search interface in lightning community, where user can search Accounts and Contacts. No of Accounts and Contacts are in range of 2-4 millions in our Org. Currently, what we ...
3
votes
2answers
31 views

Get Standard User Profile Id no matter what the users language is

When a (scratch) org is created by a non-english user this query will have no results: [SELECT Id FROM Profile WHERE Name='Standard User'] Instead you have to use a localized name (here in German) [...
6
votes
1answer
157 views

Should I use Javascript Classes or Apex Classes in Lightning Web Components? [on hold]

I am working on designing a timesheet Lightning Web Component for my company. Internally, we use a sObject that tracks individual sessions, which then gets rolled up one way to generate payroll, and ...
1
vote
1answer
26 views

How can I query ListView records that were created by users?

When logging in as a user I can see that they have ListView's that I can't find programatically (I'm a System Administrator). Using the Id of the ListView in the URL when logging in as that user, I ...
0
votes
1answer
14 views

Select custom objects of users i manage

Very similar to my previous question here: Select all my tasks or tasks relating to my Accounts or Accounts of users i manage Which seems to have been magically resolved by SF just somehow working. ...
0
votes
1answer
33 views

can we used soql query in triggers

I just want to ask you all of you. can we use soql query in triggers? when I was searching in google and found that in one article "SOSL is not used in Triggers". while soql is used in triggers.
0
votes
2answers
33 views

to access username field using LoginHistory Object

I am trying to access Username field (which is present in User Object) Using LoginHistory Object as follow: SELECT+Username+FROM+LoginHistory but is shows below error: [{"message":"\nSELECT ...
0
votes
0answers
15 views

get records based on recordtypeID and listviewID

I need to get records based on recordtypeid and listviewid but it is returning all records. I don't know where I'm doing it wrong.(it will return records based on listview but recordtypeid condition ...
1
vote
1answer
18 views

How to query non-index field on Big Object?

I'm learning Big Object on trailhead and I have completed deploy the big object to my org. But I have a question is that: how can I query non-index field by SOQL? I know that only index fields can ...
0
votes
2answers
22 views

I want the result of my query should be without the time and only date will be shown in result [closed]

Select Id, CreatedDate From Opportunity Where DAY_ONLY(CreatedDate) this the query I used but result is still with time
0
votes
1answer
25 views

How Do I Get A Child Record ID Into The Master Record?

Currently i'm using this simple iframe to show a visualforce page built on a custom object called Paperwork__c which is a child relationship to Apprentice__c where I currently have it displaying. &...
2
votes
1answer
19 views

Select all my tasks or tasks relating to my Accounts or Accounts of users i manage

I am using SF Mobile SDK to do a SmartSync. Because of that, i need to make sure that the results come down in one query. I want to select data from Task where one of the following is true: OwnerId ...
0
votes
2answers
18 views

Trigger on Email message related to an opportunity optimization problem

I actually have some confusion with my code . i'm trying to create a trigger that fires when an emailMessage related to an opportunity is inserted. My code is fine but i was thinking that if my ...
8
votes
1answer
184 views

Is there any use for defining additional entity types in a SOQL FROM clause?

Here's a somewhat odd SOQL query from the question query user and profile: select user.id, user.Email,user.FirstName,user.LastName,user.profile.name,user.Username,user.IsActive from user, user....
0
votes
0answers
10 views

What is the proper way to escape a conditional SOQL query in php?

What is the proper way to escape a conditional SOQL query? I am using php, if that helps. It is quite difficult to find examples of search string URLS for conditional searches.
1
vote
1answer
33 views

How to get all account IDs with only one opportunity which is in 'New Opportunity' stage using SOQL query?

I attempted using this query, however this gets all accounts that have one related opportunity in the 'New Opportunity' stage, but the account may have more related opportunities in any other stage. ...
0
votes
2answers
22 views

fetch leads whos id match with Campagain

Query Select id,name,phone,email,CampaignMember from lead where CampaignMember=:selectedcampaign Error No such column 'CampaignMember' on entity 'Lead'. If you are attempting to use a custom ...
1
vote
1answer
32 views

SOQL Relationship issues

I am trying to write a SOQL query to pull out a number of items from 3 Objects - Contact, Account and Case. I have the following code: SELECT id, accountid, contactid, contact.primary_contact__c ...
3
votes
2answers
61 views

Anyone know of any open source ORM (domain layer) initiatives for Salesforce?

Object-Relational Mapping (ORM) mechanisms are widely available and used in other technology stacks, usually involving code generation. But searching here for ORM doesn't yield too much. While ...
0
votes
1answer
15 views

SOQL - Conditional PermissionSet Assignment

I'm new to SOQL. I'm trying to write a SOQL query to get me all the users associated with a permissionset. For that I can just query the PermissionSetAssignment object. However, I'd like to have some ...
1
vote
1answer
33 views

SOQL and Indexes

I am trying to understand more about "SOQL Query Performance" topic and I'm reading all the Salesforce docs. I have a doubt when we have a WHERE clause with an AND condition. The two docs on this ...
1
vote
1answer
25 views

Test Lead has OwnerId but Cannot Access Owner Fields

I have the following test setup method: @TestSetup public static void testSetup() { //system.runAs(u) { //JITTriggerManagement.toggleTrigger('Lead'); Lead l = new Lead( ...
1
vote
1answer
80 views

Method Does Not Exist error message

My class subtracts the values of child account number fields from the current values of it's parent account number fields in a hierarchy. I need this class to run everytime a child account changes its ...
2
votes
0answers
15 views

Can I use more than one “USING SCOPE” clause?

I am using this query to get a list of old reports in private folders and I am wondering if I can include public folders also. Here is the query: SELECT Id,name,LastRunDate,owner.firstname,foldername,...
0
votes
3answers
19 views

Account Name not displaying

I created this formula field to display a hyperlink to the direct parent account on whatever record a user is viewing. For some reason the link displays the account Id number and not the actual name ...
0
votes
1answer
26 views

how to query for the participants in an event in salesforce?

Events are being created in salesforce from some external application. I need to get the participants from them in a trigger. I am looping over the newly inserted Events and then trying to query, but ...
3
votes
0answers
63 views

Strange SOQL Query result

So i used two queries one after another in same org: Q1: SELECT Id,Name, Project__c, Activity__c, AMS_Solutions_c__c FROM Design_Time_Sheet__c WHERE Project__c = null OR Activity__c = null ORDER BY ...
1
vote
3answers
49 views

Need help-apex cpu time limit exceeded

I scheduled an apex job to run daily at midnight but noticed that the job failed due to the Apex CPU time limit exceeded error. The code works in my developer sandbox but not in production. I'm ...
0
votes
0answers
31 views

Order by (multi-select picklist value alphabetically) Order by LastModifiedDate

I am attempting to bring back a list of contacts per account, but I need the contacts with type of Billing to be returned before contacts of type Account Owner, then in addition to this I would like ...
0
votes
1answer
29 views

Query Still Pulling Records Even with Clear WHERE statement

I'm really confused / lost on this one. Writing a Query to select Opportunities not of Stage '6 - Closed Won' and it still pulls these records. This is happening with no other picklist values in the ...
1
vote
1answer
17 views

Unable to get content in plain text from notes and attachment file [closed]

Attachment att=[Select Body From Attachment where id='00P7F00000F8EQs']; string stringvalue = EncodingUtil.base64Encode(att.body); blob blobvalue =EncodingUtil.base64Decode(ss);
3
votes
1answer
350 views

Salesforce opportunity stages

Is that possible to get the stage name, probability and forecast category using SOQL/Apex/APIs ? and I could not find that you can pull that data.
0
votes
3answers
60 views

replace ' with \' in apex code

i have string variable called "Identifier" which has apostrophe in it. example: Identifier = "string's length" i need to replace this apostrophe with "\'" the result should be Identifier = "string\'...
0
votes
2answers
22 views

Getting a record's sibling records in SOQL with a single query

I've looked high and low and cannot find an answer to this question. Lets say I have a custom object called Appointment__c which is a child of the Case object, I have a VisualForce page that is ...
0
votes
1answer
39 views

How to identify similar records in a List and then updating corresponding fields

trigger setCertificationToFailed on Exam__c (after update) { List<Exam__c> ExamList = new List<Exam__c>(); ExamList = [SELECT Id, Exam_id__c, Exam_state__c, doNothingExam__c, ...
0
votes
1answer
30 views

Why SOQL 'select id name from folder' do not get 'My Personal Custom Folder' and 'Unfiled public reports'

Why SOQL 'select id name from folder' do not get 'My Personal Custom Folder' and 'Unfiled public reports'. But when I use 'select OwnerId from Report', it will return the reports under these two ...
0
votes
1answer
23 views

What is RowCause in share object [duplicate]

Can someone please help me to understand when ROWCAUSE is = Manual or Owner or ImplicitChild or Rule. and if ROWCAUSE is not Manual can we still delete shareObject from apex if yes then how because I ...
0
votes
1answer
17 views

Query - Opportunities where last Stage change date is this calendar year

I am struggling to get a query constructed to Opportunities where last Stage change date is this calendar year. SELECT Actual_Decision_Year_DE__c, Decision_Outcome_Details__c, Delegate_Days_del__c, ...
1
vote
1answer
15 views

How to get the Email field in a SOQL query mapped from a custom Opportunity field?

I have custom field in the Opportunity object that is a Lookup and maps the Opportunity object to the User object. I'm trying to write a query that retrieves fields from the Opportunity, and also ...
0
votes
0answers
10 views

Difference b/w assigning fetched rectors to for-each and directly fetching in for-each [duplicate]

List<Account> acc=[Select id from Account]; for(Account a:acc) { } for(Account a:Select id from Account) { } what is the difference in both
1
vote
1answer
30 views

Apex access to Flows

I have a datatable with an actions menu on the right side. I want to populate that menu dynamically with the names of Flows that accept inputs of a particular name or SObjectType (that which is ...