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

learn more… | top users | synonyms

1
vote
1answer
19 views

Multi select Picklist and Visualforce issues

I am trying to display picklist values from a multi select picklist from a related object. I am using a visualforce page and putting this in the record detail. VF Code: <apex:page ...
0
votes
1answer
16 views

Trying to dynamically access sObject data defined by a SOQL query returning error

So, I've been struggling with this for a few hours now and I think I need a different pair of eyes which I have a feeling will be able to tell me my mistake in a flash! I've queried for some data as ...
1
vote
0answers
25 views

accessing related lookup in SOQL query

Hi I am writing a SOQL query. I use Fuse IT to check my SOQL queries. So the Query is: Select Id,Name,Material__r.APS_Account__r.FirstName, Material__r.APS_Account__r.LastName from Material_Order ...
1
vote
0answers
21 views

Using Javascipt to Create SelectList Dependencies in a VF Page

I am trying to code create dependent Picklists out of 2 apex:SelectLists on a Visualforce page. I have a junction Object called Service_Transaction_Type__c that creates a many-to-many relationship ...
-1
votes
0answers
38 views

APEX SOQL query

I have bunch of contracts, get only latest agreement for the contract in one SOQL query. How to do that ? Agreement object has lookup relationship with Contract. Contract can have multiple version ...
1
vote
0answers
24 views

Issue with updating custom object with parameters from Lightning App

I'm new to salesforce development. I've developed a lightning component from which i need to insert or delete a particular entry on clicking a checkbox. Delete if the entry exists already and insert ...
2
votes
2answers
38 views

Adding a complex dynamic filter in SOQL

Good day everyone I have a question in regards with queries having a many filters.Below is a sample picture of my data. Let's assume this data came from the contact object. If I try to query the ...
2
votes
1answer
22 views

No such column 'Territory2Id' on entity 'Opportunity'

Overview: "No such column" error presents itself when I wrap valid SOQL in Apex Class. I am familiar with what this error means, but in this situation I don't feel as though the error is justified. ...
-1
votes
1answer
46 views

Dynamic SOQL Injection issue

Please let me know how to use injection for a dynamic query when there is no get/set for the individual fields in the WHERE clause.
0
votes
1answer
13 views

Apex - retrieve account histories from Contact

I have a requirement, where I need to retrieve Account history while querying Contact object. Is it possible something like below? SELECT ID, Account.id, (SELECT field, currentvalue, previousvalue ...
3
votes
1answer
107 views

Deployment Test Failure - Too Many SOQL Queries: 101 but Query isn't in a Loop

First: I know this question has been posted many times so I apologize for making a new one, but I read over a lot of the old ones and they almost always seem to be that the SOQL query is inside of a ...
1
vote
1answer
41 views

soql query to all contacts where lastname = firstname

I need a soql query to query to all contacts where lastname = firstname
3
votes
3answers
86 views

Dynamic SOQL Query not accepting custom object id in where clause

I have a structure question today regarding a dynamic SOQL query that I seem to be entering the wrong custom object id value for in the WHERE clause. I have retrieved the custom object id from my ...
0
votes
1answer
20 views

how to fetch productname,product code,family and list price

i am trying to fetch fields with this code. public with sharing class opproductcls { public List<pProduct> getProduct2() { if(ProductList == null) { ProductList = new ...
2
votes
2answers
41 views

Good practice in querying very large data from different objects inside batch process

Good day everyone, I have created an apex class which will save data from csv to account and contact object in salesforce. The concept of this class is that it will read the column in my csv and will ...
1
vote
1answer
22 views

How to join two selects

I have these queries, select ownerId from account select firstname from user How can I join them? OR How can I get the owner name from account table? Thanks in advance.
1
vote
2answers
25 views

How to check check earliest date & latest date in apex class

I have an object X__c which has 2 date fields D1__c & D2__c. There are meny records for this object X__c. I want to get from all records the earliest date value from D1__c field and latest date ...
9
votes
2answers
100 views

“Limit expression must be of type Integer” error when using Apex variable in SOQL

I'm building a simple Lightning Component that pulls in a set amount of accounts and displays them. However, I keep getting a Limit expression must be of type Integer error message. I've hard-coded a ...
6
votes
1answer
259 views

What is wrong with SOQL Condition Expression Syntax (WHERE Clause)

1) Working: SELECT CreatedDate, Account.CreatedDate FROM Opportunity WHERE CALENDAR_YEAR(CreatedDate) = 2016 2) Working: SELECT CreatedDate, Account.CreatedDate FROM Opportunity WHERE ...
4
votes
2answers
48 views

SOQL query help

I am pretty new to Salesforce and would appreciate any help on this. This is my data model Opportunities : {O1, O2, O3} Campaigns : {C1,C2} Campaign Members : {C1M1 , C2M1,C2M2} Campaign Members ...
0
votes
2answers
35 views

How to convert Contents of Rich Text Area?

I am Querying Rich text area field using sforce connection in vf. I am getting the result in html format. I need only the text with the applied css format. how to achieve this. SOQL Result: ...
1
vote
2answers
70 views

“Campaign - Opportunities” report - underlying SOQL or joins

Can someone tell me how to get the underlying SOQL (or atleast the joins) of a standard report type ? I have to make changes to the existing "Campaigns - Opportunities report" (standard) and I am not ...
3
votes
1answer
21 views

Query 4 levels and get bulk csv from workbench

I'm hoping this is an easy one but I'm having no luck in developer console or workbench. I have an object called Order_Line_Item__c that is related to Order__c which is related to Opportunity which ...
0
votes
1answer
26 views

SOQL Object to Structure [on hold]

Say we have a custom object Object1 with many fields (fieldA, fieldB...fieldZ) and we want to select 3 of those fields into a structure/class Object2 with only 3 fields (fieldA, fieldD, fieldM). Is ...
0
votes
1answer
50 views

SOQL Inner Join Query

I am just wondering if I could write a SOQL query for this: Find list of Lead That have an open Task assigned to specific User and Where the Lead.CreatedDate equals the Task.CreatedDate?
3
votes
1answer
23 views

JavaScript SOQL Query for Emailing from Listview

I'm trying to create a button which will pull emails from a list view and push them to an empty email template. It is for a custom object (Students_Programs__c) which has a custom formula field for ...
2
votes
1answer
35 views

invalid ID error using SOQL to get field from related record

I am getting an invalid ID error in my VF page on the below code and I don't understand what I am missing. In my controller's constructor I am running the below code: ...
1
vote
1answer
24 views

How to find all Assets that are not referred by other Assets?

My situation is: Assume I am selling computers, so each computer has an Asset. Also, each computer has components like monitor, motherboard, cpu, etc. Each component has an Asset too, and they all ...
1
vote
1answer
23 views

Adding filter to dashboard using Apex or visualforce

We have a dashboard that we want to scale for all Accounts, currently it is based on one account. User should have the capability to see this dashboard for any account that he chooses Is there any ...
-1
votes
0answers
11 views

How to apply grouping function on calander_year?

When I run the following query, system says nested functional syntax can only be used in the following manner: date_function(convertTimezone(columnName)): CALENDAR_YEAR SELECT Priority, ...
0
votes
1answer
41 views

my query not working?

I am querying the products from a particular price book as below.i want to select product code, product name, product family and list price.To show all these columns in my table. (Select ...
0
votes
1answer
26 views

Getting a SOQL query out of a for loop

I am trying to make it so I do not need to include a SOQL query in my for loop. In the below list, "a" is a list of accounts that I have previously queried. List<CustomObject__c> sn = [SELECT ...
0
votes
1answer
41 views

Method can't get values from SOQL query based on pagereference

I have those two methods inside my RSVP class : public LIST<News__c> getExcerpts() { String paramId = Apexpages.currentPage().getParameters().get('eventid'); return [SELECT ...
2
votes
2answers
104 views

Relationship between Opportunity, OpportunityLineItems(Opportunity Product), PricebookEntry, Product2 & Pricebookentry in Salesforce?

Correct me if am wrong in these relation Ship between Opportunity, OpportunityLineItems(Opportunity Product), PricebookEntry, Product2 & Pricebookentry in Salesforce. OpportunitylineItem is ...
1
vote
1answer
28 views

How to find a value in all column of an object?

How to find field_name/api_name name for any object that contains a value? I'm working on a object that has dozens of fields but I'm after finding out particular value belongs to which field name. ...
1
vote
2answers
22 views

SOQL - ignore custom field if non existent

I want to run a query like this - select id from lead where inactive__c = false limit 1 If the org doesn't have the custom field inactive__c, it throws an error. Is there any way to ignore the ...
0
votes
1answer
31 views

SObject row was retrieved via SOQL without querying the requested field: Opportunity.OwnerId

I have the following code: public with sharing class ExportCheckPageController { public boolean checkYes { get{if(checkYes == null) checkYes = false; return checkYes;} set;} ...
0
votes
1answer
20 views

Query user details from EventRelation object

I need to be able to pull certain user attributes from the User object where the user is listed as an invitee for an event. I checked and could not find any true relation between the EventRelation ...
1
vote
1answer
33 views

CRUD permission check Security Review with SOQL queries needed?

The CRUD permission check for Security Review has been imposed recently, though I'm clear on the DML statement and Create/Update/Delete permissions I need to check for in my code, but I'm not clear ...
0
votes
0answers
13 views

How to find email alerts users recipients?

How to find email alerts users recipients? More than 100 user 200+ email alerts 200+ workflow rules Is there any way to find the email alerts specific to the user recipients?
2
votes
1answer
42 views

SOQL joining multiple tables to get account info from record owner

So I have a custom object standard controller and I want to auto-populate a field on a form from the users account record. In preparation to build my controller I need a valid SOQL statement and ...
4
votes
0answers
50 views

SOQL error with relationship

I have one query as below: select id,functional_system_user__c, Test_Created_Date__c, Test_Login_Date__c,lastmodifieddate,name, ...
3
votes
1answer
26 views

Relationship between contact and opportunity

In the salesforce UI, there is a related list of opportunities on contact layout. However, I can't figure out an API field that relates contact and opportunity. I basically want to get all ...
3
votes
1answer
42 views

repeat inputfields dynamic dependent on list of string

I have an sObject custom_obj__c with a multi-select picklist field items_list__c and its values (items) are (item1 list, item2 list, item3 list,..), and checkbox fields (item1_list__c, item2_list__c, ...
1
vote
2answers
37 views

SOQL For Loop Architecture Question

I have a pretty simple/general question, out of the two approaches below, what is the best method when querying and looping over a collection? Approach 1: for(Account a : [SELECT Id, Name FROM ...
0
votes
1answer
33 views

Test Class for SOQL Query Apex Class

I have created an apex class that queries three objects to create a list of records. I use this with a Visualforce page to display a table. It works just fine however my test class isn't giving me any ...
1
vote
1answer
36 views

Where are the SOQL hits coming from?

I've created an apex class that simply generates random data. we have created a sort of "checklist", similar to the todomvc project, which has checklist items and checklist assignees (contacts that ...
2
votes
1answer
36 views

Dev Help - Get SOQL in Map

Need some help creating an apex class. I don't code APEX frequently enough and as such don't know what the proper syntax is for this. I need both of the SOQL statements below to function in the map. ...
1
vote
1answer
39 views

Relationship Query issue

i need your help to understand my problem with a relationship query. I want to get all users with the role "ceo" so i tested the following query in the workbench: SELECT Id,Email,Name FROM User ...
1
vote
1answer
33 views

APEX testing a List variable

I am currently looking at more tests in Salesforce - I have made a new lightning app(just an expense application) and I am now just going through my controller and writing tests for it. I have been ...