Dynamic SOQL refers to the creation of a SOQL string at runtime with Apex code.

learn more… | top users | synonyms

2
votes
1answer
130 views

How to get data type of any object's field in SOQL

how to i get datatype of any filed in SOQL?
2
votes
2answers
209 views

isDeleted=True is not working in SOQL query

Wondering why this query will retrieve ZERO records when executed in Workbench and Developer console. (Though i have records in Recycle Bin) Select Id, IsDeleted FROM Account WHERE IsDeleted = TRUE ...
3
votes
2answers
58 views

BillingAddress in query generate error

I have a query like below in an Apex Class in Sandbox. query = 'SELECT Id, Name, BillingAddress, BillingLatitude, BillingLongitude FROM Account WHERE Name = \''+ name +'\' AND '; query += ...
0
votes
1answer
65 views

Dynamic SOQL for getting all objects in Salesforce Org

I am creating a VF page which contains a Picklist of all objects in my Salesforce org including Custom Objects. I am getting an error 'unexpected token: 'null' when I select custom object. VF Page ...
1
vote
1answer
42 views

Showing matching keyword sentences from SOSL/SOQL results

We have a requirement to search in large text area field (for e.g. Description). We are using SOSL for the same. While showing results on the VF page we want to only few sentence from Description ...
0
votes
0answers
43 views

Custom field visibility error on managed package installation

I have a managed base package and an extension package. The base package had a remote site as one of the components but I had to remove it. Since I couldn't remove the remote site from a released ...
1
vote
1answer
40 views

Transfer SelectOption Values to Dynamin Query

Trying to get the values to my Controller that I can change the limit on the displayed List on my Page. I'm Using a dynamic query and everything is working fine but what's below. What am I'm missing? ...
0
votes
1answer
53 views

How to search for text in Rich Text area field in Apex

i want to search a text in Rich Text area field in a custom object. As We can't use the RichTextArea field in where clause to search records,i am looking for the way to search a text. Is there any ...
1
vote
2answers
61 views

query as string type in controller class

Can any one explain me...what is the meaning of below lines. I get it from This link. String qryString = '<strong class="ph b">SELECT Id, title, UrlName, LastPublishedDate,LastModifiedById FROM ...
1
vote
1answer
50 views

Pass parameters from URL to SOQL query.

How can i pass parameters from URL to Controller? I want to pass URL parameters to My controller class where i can query to fetch data with the help of these parameters.
-1
votes
3answers
74 views

Trailing 12 Months Formula

All, **EDIT: Sorry for being too vague. I'm trying to add another field to my sales summary that displays on Account pages. I'm trying to grab the trades that fall within a date range of the past 12 ...
-1
votes
1answer
59 views

Count on sObject

EDIT: What I'm asking is, do I have to execute two separate query one for retrieving the information and one for count? is that possible to put both together in one query? in the .NET you just have ...
1
vote
2answers
45 views

common field between account table and contact table

I have Three questions 1.) Can you please let me know how to write a SOQL query to get the contact based on a specific record 2.)What is common column name between acount and contact table 3.)How ...
1
vote
1answer
53 views

I am getting Error “ Variable does not exist: queryResult”

Please Find the code <apex:page controller="SOQLController" > <apex:form> <apex:outputText value="Enter Name" /> <apex:inputText value="{!name}" /> ...
2
votes
1answer
45 views

custom setting SOQL vs methods

i often come across scenarios where we have some custom setting with lots of fields created which has rows for multiple purposes. So for a specific scenario, it is often needed to filter all the rows ...
5
votes
5answers
647 views

What's wrong with this SOQL

Declared a string and assigned SOQL value as shown below. While running I am getting an error. String country = 'United States'; String accountQuery = 'SELECT Id,BillingPostalCode,County_Name__c '+ ...
2
votes
1answer
34 views

How to filter query for specific types of parent lookup?

String query = 'SELECT Id, isDeleted, LastModifiedDate, parentId FROM Attachment WHERE isDeleted = true AND LastModifiedDate >= :timestamp ALL ROWS'; for (SObject deletedObject : ...
1
vote
1answer
46 views

unexpeced token: ( with dynamic SOQL

The following gives an error on runtime: String queryString = 'select name,street_address__c from warehouse__c where' + 'DISTANCE(location__c,GEOLOCATION('+ lat + ',' + lon+ ' ),\'mi\') ...
1
vote
1answer
111 views

query sObject or Custom setting by multiple fields

i need to implement logic at couple of places which is like querying an sObject or a custom setting. There are input fields using which i need to create filter criteria to reach appropriate records in ...
0
votes
1answer
45 views

Retrieve earliest record from each Grand child object

I have 3 objects, Object A, Object B and Object C. Object B is a child of Object A, while Object C is a child of object B. I am trying to access the all the single earliest records of all records in ...
1
vote
1answer
95 views

What meant by DescribeFieldResult Class?

Can anyone clearly explain what exact use of DescribeFieldResult Class in Apex code. And also please provide an example.
1
vote
1answer
153 views

Getting SOQL/SOSL Injection error when I send my code for security review

I have send my code for security review I am getting error for SOQL/SOSL Injection. I have made the changes on the bases they have mention in report. But even I am getting issue with dynamic soql I am ...
5
votes
1answer
160 views

Force Dynamic Soql results to include fields with null value

So I've read a lot about this and it seems that queries run with Database.query(queryString) will skip over any field values set to null instead of returning the property set to null This has cause a ...
0
votes
1answer
61 views

How to fetch the Account Name By selecting contact Name in custom object( communications__c)

I have a 2 fields in Communication__c (Custom object). field 1: Select_Contact__c (Lookup) (from Contact Object) field 2: Account_Name__c (Text). In Visualforce Page, when ever user selects the ...
0
votes
0answers
28 views

Pass Field Api From Visualforce Page to Controller

Hi everyone I have a scenario where I can select the fields and that can be either multiplied/subtracted/added/divided and that result should be updated in another field. Using describeobject class ...
2
votes
1answer
137 views

How to get Cases, Opportunities, Contacts Associated with Account Object Dynamically?

I need to get all the associated Contacts,Opportunities and Cases, for a given Account, if there are any. Right now, I am doing something like below: public List<Case> getCases(SObject sobj){ ...
1
vote
2answers
103 views

Updating the owner of records connected via lookup relationship

I was given a task to write a trigger to update the owner of records connected via lookup relationship. Consider i've a custom object which is having a lookup relationship to another custom object. ...
4
votes
1answer
164 views

How to use dynamic SOQL to instantiate a MAP

I've tried doing it, but I get this error: Compile error at line 101 column 32 Invalid initial type List<SObject> for Map<Id,Opportunity> Here's my code: //build out the set set ...
0
votes
1answer
41 views

Multiple LIKE in SOQL

I have a batch class where I need to find all contacts with titles like director, cEO, etc. This should allow partial matches such as 'support director', 'sales director', I was trying this but is not ...
0
votes
1answer
23 views

Dynamic SOQL - Risks/Impacts

I understand SOQL is a much restricted version of SQL but what are the potential risks associated with using dynamic SOQL? What damage could be done with malicious intent through it? I'm just trying ...
0
votes
1answer
87 views

Sorting functionality using dynamic soql

I have created a visual force page in Account page that displays related opportunities by RecordType(5 Records at a time) for the given Account and when click on Go to List it directs to new VF page ...
0
votes
0answers
65 views

Error as MALFORMED Query in Developer console (Group by Rollup, Group by Cube)

Why do I get this ERROR as :MALFORMED Query in Developer console? I'm trying to use :Group By Roll or Group By CUbe to get the subtotals and grand totals. When I tried this Query: SELECT ...
0
votes
2answers
96 views

Not able to query on standard Asset field 'ProductCode' . Please suggest

List<Asset> lst= [select Id, ProductCode, Product_Family1__c, Product_Family__c from Asset WHERE AccountId = '0015000000IBGof' AND ( (NOT IB_Status__c Like '%eval%') ...
1
vote
1answer
212 views

System.QueryException: Non-selective query against large object type with 0 records

I am getting the following error for a query I am running dynamically System.QueryException: Non-selective query against large object type (more than 100000 rows). Consider an indexed filter or ...
1
vote
1answer
39 views

How do I know which objects can use FOR VIEW/REFERENCE?

I'm implementing a custom UI for Salesforce using Visualforce and Remote Actions. When I'm displaying a specific record, I look for all visible fields and display it on the screen. The code in the ...
0
votes
2answers
63 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! ...
0
votes
2answers
33 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
42 views

Urgent Issue on Custom Settings

I've a Custom Settings with Hierarchy, on that two fields Read__c, Unread__c. integer i=10; integer j=5; query1='select id,name,is_read__c, (select id from Attachments where createddate ...
0
votes
0answers
64 views

How to feed a junction object, with a trigger using soql, and involving multi-select picklist

here is the situation: I have a custom object which is a database of apartments for rent (Appartment__c). Fields include the format (1-Bedroom, 2-Bedroom, etc), the rental price, an availability ...
1
vote
1answer
170 views

How Get Parent Field in Attachment?

Please Help me... Account sObject is Parent of Attachment. Now I want to bring Read-only Field Custom field (isReadOnly__c). SELECT Id, Name, Account.isReadOnly__c FROM Attachment How It Gets ? ...
0
votes
1answer
56 views

Dynamic SOQL multiple statements

My OR condition with in the where statement is failing to execute, Can someone let me know if I'm missing something or querying it wrong. Any help is much appreciated. SELECT Id FROM Object__c ...
1
vote
1answer
22 views

Query Records “where MyCustom__Date__c.Month()=1”

I want the records where MyCustom_Date__c month is = January. Where my field MyCustom_Date__C is formula field lst="select Name from CustomObj__c where MyCustom__Date__c.month() = : 1" Its giving ...
0
votes
0answers
13 views

Count stamp in a field

I have a requirement where there are custom objects like Incident_abv__c , Incident_Transaction_abv__c (child of Incident) , Incident_Transaction_Line_Item_abv__c (child of Incident Transaction). Now ...
0
votes
0answers
47 views

How to use SOQL to query Account IDs that has 0 records of a custom related object?

I'm trying to write a trigger that would count upon insert/update the amount of "Active_Competitor_Relationship__c" records that's associated with each account record. The problem is that when an user ...
0
votes
2answers
329 views

Dynamic SOQL ERROR: invalid operator on id field

I'm facing this problem while creating this query. String qry = 'select name, id, account__c from orders__c '+' where account__c LIKE \'%'+searchText+'%\''; searchText is declared as public string ...
2
votes
1answer
117 views

Pagination with Wraper class List

I have Wraper class list which holds list of Records form 2 objects. This list Iam using in Page block table to show the data from both objects. Now I have to work on Pagination. For Pagination we ...
1
vote
1answer
102 views

How can we add colon to a string value before dynamic soql query

I have a soql statement which is used to soql the result from a sObject but I need to mention the id in the soql how can add colon to the both side of id. my requirement SELECT Result__c,Notes__c ...
0
votes
0answers
64 views

Visualforce Error - Dynamic SOQL Binding

I have queried Account record using dynamic SOQL <apex:PageBlockTable id="tableid" value="{!lstAccount}" var="acc"> <apex:repeat value="{!lstField}" var="f"> <apex:column ...
3
votes
1answer
94 views

SOQL injection in dynamic query

I am facing soql injection issue in my dynamic query, i have done with sting.escapesinglequotes() also but still facing this issue. here is my code. query: query = 'select id,Name,Owner.Id from ' + ...
0
votes
1answer
28 views

Need to refer child objects records also in PDF

I have a requirement to display child object records also alongwith Parent records. Please find the below SOQL pattern. SELECT Name, Account_Abs_abv__c,Account_Location_abv__c,Attendee_Role_abv__c ...