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
26 views

batch apex query - ORDER BY doesn't sort all records?

I have a Batch Apex process that queries about 12,000 Contacts - sorted (descending) by a number field. My process ranks these records based on the sort order (record with the highest value in the ...
0
votes
2answers
26 views

Multiselection paramter for picklist datatype soql

In my vf page the date is presented based on only one value of the status picklist for the opportunists object. Now i need to extend my search criteria in such as way that rather than selecting only ...
1
vote
2answers
52 views

Showing totals in custom page using SOQL

I have a custom object which requires booleon values which are attached to contacts like the following: Contact Option1 Option2 Option3 ============================================ Bob ...
0
votes
1answer
38 views

Wrapper Class is not Fetching the Correct Child records values on Visual Force page

Can any one help me on this .I have created a custom visual force page on Quote object which is in PDF foramt.I have written a wrapper class where values of the opportunity forecast object gets ...
0
votes
0answers
15 views

Displaying key/pair data

I have four objects which allow me to record events, rsvp contacts attending the event and store any additional details for each given event. My schema is as follows: Contact (Id, Name) <-- ...
0
votes
0answers
13 views

Get a list of territory names and assigned rule names

In this child-to-parent relationship query, I am trying to show the territory rule name (MasterLabel) from the RuleTerritory2Association child object: select ...
1
vote
1answer
20 views

How to Query Custom Fields Which are not part of Enterprise WSDL in Salesforce?

I'm Querying Contact object From .Net but I'm unable to Capture the result. We've added some custom fields to Contact Object after Importing Enterprise WSDL in .NET. But I'm unable to capture the new ...
2
votes
2answers
32 views

soql for total license used in SFDC

I am looking for soql which could fetch me all the license used for all inactive and active users in one shot. similar to displaying company license information in native SFDC environment. I am ...
2
votes
2answers
44 views

Why is this SOQL query not selective?

We have following query in our code and its giving timeout error. Select email, firstname, lastname, id From contact Where Email != Null And Opted_Out__c = false And id IN (Select contactid From ...
2
votes
1answer
53 views

How to get list of Objects Master detail with account

I want to get a list of all Custom Object which are master detail with Account object. how can i get it with SQQL or through Apex. Thanks
1
vote
1answer
30 views

How to fetch data from salesforce custom object using SOQL

Below in eventDates method I tried to fetch the Event.eventDates__c but it didn't work. It isn't assigning the Event__c type to String[]. Anyhow I only need the dates from this field in the form of an ...
1
vote
2answers
52 views

Merge Data from Multiple List<SObject> for use in Update/Insert

I'm attempting to rollup some Activity data to Campaign Members from a Trigger event. I've already worked through my trigger/filtering logic and now I have a list of affected campaign members: ...
0
votes
1answer
17 views

Is it possible to query the Import Queue with SOQL?

I would like to run a SOQL query and get the status of a particular import job. I'm referring to the Import Queue found at: Administration Setup > Monitoring > Imports I looked in AsyncApexJobs ...
0
votes
1answer
28 views

How to compare a text value in a list of sobjects?

The following gives me a list of texts which are customer numbers (CUST_NUM__c) List<SYSTEMS__c> lst_PartnersAcc = [SELECT CUST_NUM__c FROM ...
0
votes
1answer
38 views

Salesforce SOQL:Why it return different ID value when I use different Id?

I run this query : SELECT Id,Name FROM Account where Id='0013000000Ghg4k' it returns the value but I noticed the different of return Id.Query with '0013000000Ghg4k' and it return Id ...
0
votes
1answer
15 views

soql subquery in SELECT clause

Can SOQL handle subqueries? For example, to get the row counts of both current and deleted rows in a table.. SELECT (SELECT COUNT(id) FROM SNF___c WHERE IsDeleted = False) is_deleted, (SELECT ...
0
votes
0answers
12 views

Running query on two levels of parents and resulting column is not showing up (no error!)

I'm running a child-to-parent query in Workforce such as this person did - Child-to-Parent Query - [object Object] is the result. However (in Workforce) I am not getting an error, the resulting column ...
3
votes
1answer
46 views

Custom Setting issue in Test Class

I have written a pretty simple VF page that allows support users to add Case Assists (custom object related to Case) to their case. Pretty simple VF page, when opened, it creates a list of a wrapper ...
2
votes
0answers
45 views

toLabel() in aggregate query

I am using the toLabel function in an aggregate query, but it doesn't return the translation of the picklist value. I have changed the language of the user to Dutch and executed the following query: ...
1
vote
1answer
24 views

How to find if a group is internal or external in apex

Is there a way to find out if a group is of external users only. I know you can do something like this: select id,name,portaltype from userrole where id = 'name of the relatedid of the group' Using ...
4
votes
1answer
57 views

Is SOQL Polymorphism also supported in WHERE clause?

I am using the polymorphism in my SOQL queries which is working fine, an generic example of the query is below SELECT TYPEOF What WHEN Account THEN Phone, NumberOfEmployees ...
0
votes
1answer
28 views

Trying to retrieve child object from soql query

I have the parent child relationship table where I provide the data for the job timings of employee on the basis of days(sunday,monday...)..but it will be stored as 30 days in calendar object as ( ...
-1
votes
1answer
51 views

Assignment inside for loop returning null

I am not sure what it is but for some reason my assignment inside a for loop returns null. Below is my code: public class myClass{ public static void ...
1
vote
1answer
37 views

Best way to get the Contact field values like Title, Owner … for each EventRelation/TaskRelation

SELECT id, subject, StartDateTime, EndDateTime, Ownerid, Owner.Name, Type, What.Name, Who.Name, RecordTypeId, Description, CreatedById, **(SELECT RelationId, Relation.Name, ...
0
votes
2answers
36 views

Convert dynamic soql to static soql

I want to make the following dynamic soql to static soql. I'm a bit confused as I haven't done anything like this before. How can it be done? Any help on this would be appreciated. Thanks in advance! ...
1
vote
1answer
27 views

Using SOQL aggregate functions

I have a table in salesforce that stores the topic selected by a person and a person may select the same topic multiple times. At a high level this how the data is stored. {"Person1, "Topic1", ...
2
votes
2answers
43 views

Get most recent record when duplicates are found

I'm trying to do a query of child objects that looks like this List<Child__c> childList = new List<Child__c>(); childList = [SELECT Id, Status__c, Team_Member__c, Deactivation_Date__c ...
1
vote
3answers
28 views

Error: Compile Error: Invalid bind expression type of SOBJECT:AccountShare does not match domain of foreign key

I'm attempting to create a list with accounts from user's territory. SYSTEMS__c is custom object, Account__c is a lookup to accounts. Here what I have gone so far... List<AccountShare> ...
0
votes
1answer
19 views

Updating Parent Record via Apex

I would like to update parent(ExpenseChild__c.EC_Pick__c) and the child record's(ExpenseGChild__c.EGC_Text__c) fields with the string value. I would like to finish the DML on Child and then move on ...
1
vote
0answers
25 views

Extracting data from salesforce trigger object

Objective here – to extract the account__r.id from the record in the trigger and add the value to a list with each for-loop… CODE SAMPLE ONE if (trigger.isinsert) { for (loan__c oloan : ...
0
votes
1answer
23 views

Apex Dataloader : batch size parameter

I have a a file of 5000 recrods in a batch,which fails due to Apex CPU time issue but works fine when execute with 40 records at at time.I dont want to fix Apex right now) but I want to know,how to ...
0
votes
1answer
19 views

Error: Insufficient Privileges while querying User or UserRole in a standard user context

I am running a couple of SOQL queriesthrough a Visualforce page. The queries simply look like: [SELECT Id, Name, UserRoleId FROM User WHERE Id = :UserInfo.getUserId()] [SELECT Id, Name, ParentRoleId ...
2
votes
3answers
207 views

Make 'For Loop' more efficient, getting Too many SOQL queries

Thought I had this nailed until I deployed into production. My loop is generating too many SOQL queries: 101. How can I rewrite my For Loop to reduce the SOQL queries. Thanks in advance! Kevin ...
0
votes
3answers
64 views

Update Child Record via Apex Trigger

I'm trying to write a trigger that will update specific fields on child records if certain criteria are met on the parent object. I have two custom objects Sesaco_Contract__c (Master) and Receiving__c ...
0
votes
3answers
51 views

Complex SOQL query

I have the following structure: Contract__c (1) ----- (*) ContractCover__c (1) ---- (*) Address__c I need to create a query that gets all the addresses that are linked to contract via contractcover. ...
1
vote
2answers
31 views

Apex Dataloader -IN Operator issue

We need to run a job on 1000's of records by filtering over an ID. In the dataloader when the condition section doesnt show IN or contains or LIke option. However i tried to put a condition manually ...
0
votes
2answers
29 views

how do I reference fields from sub query?

Map<Id,Case> cases = new Map<Id, Case>([Select Id, Subject, (Select CreatedBy.Manager.Email, CreatedBy.Manager.Name From Case_Status_Trackings__r WHERE Case_Status__c = 'Closed' ORDER BY ...
0
votes
1answer
34 views

Why can't inner and outer selects be on the same object? [duplicate]

I have oppoortunities related to opportunities via a lookup, and a wanted to find all the opportunities with children opportunities. When I did it, I got the error - that inner and outer selects ...
0
votes
1answer
38 views

Return opportunities with child opportunities

I'm trying to return parent opportunities that only have 1 or more related child opportunities, but I can't get my query right. List <opportunity> oppsWithPotentialChildrenToBeUpdated = ...
1
vote
2answers
61 views

How do I perform an accent insensitive query in SOQL?

I am trying to do an accent insensitive query in SOQL. Using something like : SELECT * FROM table_name WHERE column_name LIKE '%andre%' I would like the database to return me a list of rows which ...
0
votes
0answers
18 views

SOQL vs getall() method [duplicate]

what is similar to SOQL query [SELECT name, customField__c FROM CustomSettings__c WHERE name = :account.name] for CustomSettings__c.getall().values(); method?
0
votes
1answer
35 views

Count of Object in pageblock table

I have a requirement where I have to load a pageblocktable in the following way. Column 1-- Assigned to, Column 2-- Total No Processed, Column 3--Percentage completed. I have a query that returns ...
1
vote
3answers
61 views

custom object not queryable

I have a custom object, say CS in my org. User U1 has profile P1 and P1 has all the crud permission on that object. Still while logging as U1, and try to query that particular object it errors out : ...
1
vote
1answer
46 views

Convert an array of ids to a csv string with quotes

I have a webservice method that takes the $_REQUEST from the URL parameter of my app and I believe handles it like an array, for example: inputs.param1 = "some_value" inputs.param2 = "1209845, ...
1
vote
0answers
12 views

Internal Service Error when using not null in Geolocation SOQL

I have the following SOQL query which uses a geolocation field called Location__c to get the nearest 100 accounts to a location. I want to exclude any records that have a null value for Location__c ...
0
votes
2answers
17 views

SOQL embedded select question

In our implimentation an Opportunity has a *.1 relationship with accounts and a *.1 relationship with brokers. An account is an entry to Object Account with Type = 'Customer'. A broker is an entry to ...
0
votes
0answers
16 views

“SerialBatchApexRangeChunkHandler” Opeartion while Running Batch Class

Please Help me. I Got this Error Message while Running Batch Class Delete failed. First exception on row 0 with id 00P17000000OaUNEA0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, ...
1
vote
2answers
42 views

Trigger for deleting a record

I have a scenario. I have two fields; students and courses (parent). I want to stop the users from deleting course records when course contains at least 1 student. If a course does not have any ...
0
votes
1answer
26 views

How can I use like operator to check against email subject

I have set up an email service and Apex class that handles inbound emails and creates a new task with the details from the email. The task is then related to a custom object based on the subject line ...
1
vote
2answers
48 views

SOQL query problem, need assistance

I am a newbie to apex and was working through Trailhead...and I'm having issues with the below challenge. Need help from you more experienced folks out there... Apex class that returns contacts based ...