Stack Exchange Network

Stack Exchange network consists of 174 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
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

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

0
votes
0answers
24 views

SOQL and SOSL questions [on hold]

I have a list of questions that I am unsure of. There's a few questions on SOQL and SOSL. SOQL Questions: Can you do joins in SFDC? I have only learned the Parent Child relationship way for SOQL and ...
0
votes
1answer
32 views

Select memebers of master-detail relationships in Map using a single query

Is it possible to select memebers of master-detail relationships in Map using a single query? In other words is it possible to write something like the following? Map<Id, List<SObject>> ...
0
votes
2answers
30 views

SOQL query to update object permission

I want to build the the query to update the object permissions to grant the read edit access of specific profile for the custom object. any idea how to do it
0
votes
0answers
31 views

Linking four many-to-many relationship lookup fields together

NEW EDIT AT THE BOTTOM New SF developer, first question. Our project requires categorizing accounts by four areas we call Domain settings; Division, Branch, Department, Group. We set up a section ...
0
votes
0answers
19 views

How do I create an XML file of Opportunity Products?

I started this by creating a list of opportunities and their OpportunityLineItems. If I run this in the query editor, I get the expected results, but I'm having problems getting the variables to be ...
0
votes
1answer
25 views

How do you pull data from two objects using a soql query?

Select op.Id, op.Name, op.Install_Date__c, op.Scheduled_Go_Live_Date__c, (SELECT Id, Field, OldValue, NewValue, OpportunityId FROM OpportunityFieldHistory) FROM Opportunity op WHERE op....
0
votes
1answer
26 views

How to get Two articles in One list using salesforce query

Hi every one I have a two articles: Offer__kav and Offer_order__kav. How to Query This Two Objects Related All Fields. For Ex: I tried : List<List<SObject>> search_results = [FIND 'SFDC'...
1
vote
1answer
22 views

Handling Zero Results SOQL on Attachments

I have a controller that sends an email and grabs a few different attachments from different records. Not all the records will have an attachment called 'Venue Map' so I want to stop the error if the ...
1
vote
1answer
30 views

How to query the KnowledgeArticleVersion and Linked Article Objects in sfdc

i get "SELECT id, abdulking__Knowledge_Linked_Artical__c ^ ERROR at Row:1:Column:12 No such column 'abdulking__Knowledge_Linked_Artical__c' on entity 'KnowledgeArticleVersion'. If you are ...
1
vote
1answer
37 views

Accessing the Tracking Data

Does anyone know how can I access / export the data that is in the Tracking section in Email Studio? I'm not interested in sending myself an Email Report. I'd like to get that data into a Data ...
2
votes
0answers
22 views

Is applying a LIMIT to a Count() query an optimization?

Salesforce has recently updated the way that the Apex Governor counts Count() query row limits so that the entire aggregate is a single SOQL Row (as opposed to previously where each aggregated row was ...
0
votes
1answer
11 views

PermissionSetId and Name when queried not valid PS

When querying the PermissionSetAssignment table, I'm getting a very strange result: SELECT Id, AssigneeId, PermissionSetId, PermissionSet.Name FROM PermissionSetAssignment WHERE AssigneeId = '...
0
votes
4answers
41 views

How to retrieve exact matching records using SOQL?

Let's say there are 5 accounts in the system as below: Account1 ACCOUNT1 account1 ACCount1 acCOUNT1 I want the SOQL query to return me only 1 record: account1 So i tried the below query: ...
2
votes
2answers
53 views

Query becoming non-selective with null values

In the query I asked here - Confirm if sub-query is selective? , is there a chance of the top level query becoming non-selective if conAccMap.values() has null values? Below is the query: [SELECT Id,...
0
votes
2answers
30 views

Fetch child's lookup field data

I need to take out data of an object (Object_C__c) in a single query. We have another object (Object_B__c) which has a lookup relationship with Object_A__c and Object_C__c. My requirement is I need to ...
0
votes
1answer
53 views

SOQL junction record query to get master

Have a junction object called AccountPublisherAssociation that is a junction between an Account and a custom object called Publisher. I would like to write a query to display all the Publishers that ...
0
votes
4answers
104 views

Convert string to query

Can anyone help me on how to convert the String q1 into a query? I am trying to put my variable 'q1' inside the [] but I always got an error "Unexpected token q1" Heres the code. String q1 = 'SELECT ...
0
votes
1answer
33 views

Data retrieval from multiple objects from a single query [closed]

I have just started understanding SOQL. I am trying to query to retrieve data from multiple object. I have below objects and junction objects: I want to display unique records of Object 3 based on ...
2
votes
1answer
34 views

Combine multiple SOQL queries on multiple objects into one

Background & Data structure: please click here to data structure image Each contact can have multiple tours/trips and each trip will have records in 3 custom objects (with a lookup ...
1
vote
1answer
26 views

Upsert in junction records without duplicate creation

Have a junction object that is a many to many relationship between two obejcts - Account and Publisher. As mentioned in the documentation I set the key in the Is there an easy way to upsert junction ...
0
votes
0answers
14 views

Check if a query on OCR is selective [duplicate]

I have a query that looks like this: SELECT ContactId, OpportunityId FROM OpportunityContactRole WHERE ContactId IN: conAccountMap.keyset() I checked the QueryPlan and it looks like ...
2
votes
1answer
78 views

SOQL query by using standard filter

I want to query data of Account with a standard filter likes (All, All Accounts, My Accounts,..). How can I apply one of these filters to SOQL query below? SELECT Id, Name FROM Account ORDER BY ...
1
vote
3answers
119 views

SOQL query for Master detail relationship filtered by master record ID

Newbie to Salesforce. I have an object ExpenseItem which master detail relationship with another object Expense where Expense is the master. I am trying to list expense items for a particular ...
0
votes
2answers
21 views

Get all child records

Trying to get all child records, but keep getting the "Didn't understand relationship 'ChildObj__c' in FROM part of query call" Query Example: SELECT ForeignKey__c, (SELECT Id FROM ChildObj__r), (...
0
votes
1answer
27 views

SOQL Parent Child Query Salesforce

I am new to salesforce, I am using the below query to fetch data from Salesforce Approval Process, Here actorId is the Id which matches with the Id of User table. I need User email from the User table ...
1
vote
1answer
27 views

Get attachments from related object

Is there a way to get an attachment from a related object? Example: SELECT RelatedObject__r.Id , RelatedObject__r.OtherField , (SELECT RelatedObject__r.Id FROM Attachments) , ...
1
vote
1answer
40 views

Preventing Users from Performing SOQL Queries

Is there a setting at the profile level to prevent users from performing SOQL queries against our Production Salesforce instance? I have disabled both "API Enabled" and "Apex REST Services", but the ...
2
votes
2answers
23 views

Encountering a very strange Data loader error with number field values in a WHERE-IN clause

Our product backend has an ID field for each customer's instance of our software, so we have a custom Number field on our SFDC Account object to track each customer's Product_Org_Id__c. Often folks ...
0
votes
3answers
38 views

Insert 2 objects (parent and child) at a time (over 200 records)

I have over 200 records, and I need to insert 2 lists. Work's records are created too fast and can't take a customField from still not inserted Case. If insert 1 per time - Error: Too many DML ...
0
votes
0answers
17 views

How to populate Parent Account's data to all child accounts associated with the top most Parent

I have a custom object CSI which is a master-details relationship with Parent account (which does not have any Parent Account i.e. top most Parent). now my requirement is that once CSI record gets ...
0
votes
1answer
19 views

Getting some kind of ID when querieng the field in soql [duplicate]

For below query: System.debug([SELECT ContactMobile FROM Case]); I'm getting: 15:13:52:137 USER_DEBUG [1]|DEBUG|(Case:{Id=5003C000001YKoSQAW}, Case:{Id=5003C000001YKoNQAW}, Case:{Id=...
1
vote
1answer
20 views

Soql giving id for field when qurieng lookup field

For below query: System.debug([SELECT Id, Account_lookup__r.Account_Number__c FROM Case]); I'm getting: 12:05:52:125 USER_DEBUG [1]|DEBUG|(Case:{Id=5003C000001YKoSQAW}, Case:{Id=...
0
votes
0answers
18 views

Query an aborted CronTrigger

So I can query CronTrigger and see it's status, previous runs, next run time, etc. However, if I abort the job from SF UI, the record gets deleted. Now, there is some info on AsyncApexJob, but the Id ...
2
votes
2answers
178 views

Getting the row culprit of an insertion failure [closed]

Sometimes some of my orders and contracts are not define in the same date terms. That causes my system to throw an exception as follows: Message: Insert failed. First exception on row 8; first ...
0
votes
0answers
18 views

How to fetch all organisation wide address which are verified via SOQL only? [duplicate]

I need to fetch all the verified organisation wide address. Is it possible using a single soql query? I do not want to send a test email and check in try cacth block. As it is not suiatble for my ...
0
votes
0answers
17 views

Fetch Metadata from Salesforce using Tooling API objects [duplicate]

I am building a tool in Java to fetch all the metadata from Salesforce using the Tooling API. For Ex: I want to fetch all the profiles details including object-permission, field-premission, ...
0
votes
1answer
22 views

How to Import/Query the 'EntityHistory' Object Data Through Data Loader in salesforce

i have some records/data, i mention in Excel File is in below, and i need How to Query the Records from "EntityHistory" Object... please Help me i will try my developer Edition.
0
votes
1answer
33 views

Force.Com Sites Sandbox vs production SOQL not returning results

I have a vf page that displays queried results in a data table that works perfectly fine in my sandbox's force.com site. However, when I try to access it in production's force.com site it does not ...
3
votes
1answer
68 views

Confirm if sub-query is selective?

I have a query in a before-update trigger that looks like following: [SELECT Id,(SELECT Id,Active_opp__c FROM Opportunities ORDER BY Days_from_Last_Stage__c ASC) FROM ...
1
vote
0answers
38 views

Adding a LIMIT higher than the average number of rows returned?

Let's say they do a search for Contacts with a filter Name = 'John Smith'. Out of a couple million Contact records and assuming there are 600 records that match this criteria, would it make a ...
0
votes
1answer
19 views

How to get LIST of Custom Settings by API with Query Condition?

I want to get list of available Custom Settings using SF API in Java. I mean Setup > Build > Develop > Custom Settings > Get that list Additionally, I need to have got the condition in ...
3
votes
4answers
172 views

Compare the result of a date function with a date literal in a WHERE clause

The below query is not working: SELECT Id FROM OrderItem WHERE CALENDAR_MONTH(Order.EffectiveDate) = THIS_MONTH AND CALENDAR_YEAR(Order.EffectiveDate) = THIS_YEAR I am getting the following error ...
0
votes
0answers
38 views

Salesforce Delta Deployment / Change Tracker

We have a requirement to generate the Salesforce components modified between two dates. I can achieve it by generating package.xml for the entire org and then leveraging GIT diff to obtain the delta ...
0
votes
1answer
22 views

Estimate the number of queries per month

Is there any way to estimate the number of Queries per month in a salesforce instance?
1
vote
1answer
22 views

SOQL Order By field in child relationship

I'm trying to use SOQL (with JSForce in a nodejs app) to execute a query like what is below. SELECT Name, Oppnum__c, Id, ( SELECT CreatedDate FROM Times__r ORDER BY CreatedDate DESC LIMIT 1) FROM ...
0
votes
1answer
19 views

Soql to count How many each pick list values for picklist field in Object?

I have a picklist field 3 values Like Red,Blue,White. There are 50 records in the object with different picklist values. Now I need a query - How many records with Picklist value - Red and AND how ...
2
votes
1answer
34 views

How to get only PermissionSet License.Name if License is UserLicense?

Is it possible to get field value by SOQL query only if has some specific value or type? Following example query: SELECT Id, License.Name FROM PermissionSet returns permission sets with field ...
0
votes
2answers
34 views

Why DAY_ONLY(convertTimezone()) Query giving wrong results?

I need to display time retrieved from a dynamic SOQL and display at visualforce page using remoteaction. As we know code runs in system context and values in UTC time zone are retrieved. Is there ...
2
votes
3answers
96 views

Check field's data availability in WHERE clause

Can we make a check on WHERE clause of a SOQL query for comparing 2 date fields availability? My requirement is, I want to get the response from query based on data availability on two different ...
1
vote
1answer
27 views

Query Object from Reference Id in Trigger.New List

I'm having issues returning results from a query of the Partner object. I have a trigger written on a custom object that is the child object which has a look-up to the Account object. Ideally I'd like ...