The dynamic-soql tag has no wiki summary.
2
votes
3answers
55 views
Map of API name and value pair..?
I want to create a map of apiname and value pair..please help...
i want record value...like if apiname of opportunity field is name..then i want record value..ie opportunity name...
for eg
...
3
votes
1answer
79 views
How to implement a generic DAO object for Service pattern with Apex?
Considering advice given for DAO objects or Service pattern from What is a good set of coding conventions for Salesforce development?, I'm wondering how can they be made generic enough?
Some generic ...
2
votes
2answers
54 views
Avoiding casting with dynamic SOQL
According to this http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_dynamic_soql.htm
I should be able to avoid casting using dyanmic soql
However when I try:
opportunity = 'select ...
7
votes
5answers
93 views
Trying to LIMIT a SOQL Statement based upon projected Heap size
THE GOAL: Return as many rows as possible from a Remote method without hitting Heap limits.
We have a Visualforce page calling into a @RemoteAction method in Apex to return sObjects to the page. The ...
0
votes
3answers
80 views
Using a variable in dynamic sql [duplicate]
I have a set of IDs I wanted excluded from a Task query. I need to use dynamic sql for this. I try:
Set <ID> unwantedIds = ... // ids I don't want.
String query = 'select Id, ThirdPartyId__c, ...
4
votes
1answer
77 views
Build String Similar To That is Allowed in Database.query
Well Salesforce Database.query has a unique feature that allows us to append the bind variable inside the Query string. All the variables that is included in the query string automatically calculated ...
5
votes
1answer
262 views
How to use the escapeSingleQuotes method?
I'm trying to use this method in a dynamic SOQL query. Follow the sample code:
public static String getRowById(String sobjName, id id) {
String query = 'SELECT ';
Map<String, ...
10
votes
2answers
189 views
Bind variable with dotted name not working in dynamic SOQL
As mentioned in this answer, it's possible to use bind variables in dynamic SOQL queries. This seems like a great way to avoid SOQL-injection, and to build a query string once but use it multiple ...
1
vote
1answer
160 views
Retrieving value using dynamic SOQL
This is my query...
List<Opportunity> opportunities = Database.query('SELECT OwnerId, Amount, Probability, ExpectedRevenue ' + mycustomatt + ' FROM OPPORTUNITY ' + ' where isClosed = false');
...
6
votes
1answer
149 views
Field Sets & Dynamic DML & Describing Fields Included in Field Set
I am attempting to write generic code which will use a fieldset, allowing for dynamic creation of a query. This bit is documented well enough in dynamic DML examples from SFDC. In addition to the ...
5
votes
1answer
183 views
Integration - Outbound Messages - configure Endpoint URL dynamically!
Hello guys!
Scenario: I am sure all of you come across this everyday if you do integrations. I have 2 sets of machines (Training and Production). The outbound messages in prod. instance point towards ...
1
vote
2answers
90 views
Can we query hidden fields in apex?
There is a field named "Email Opt Out" in the contact object. Can we query this field and put in the filter condition if the "Email Opt Out" field does not have both "Field-Level Security" and "Field ...
3
votes
2answers
54 views
What makes a field not groupable
I'm trying to use an aggregate query, but one of the fields I want to group by is not groupable (saw it in the soql error and then verified groupable=false in the metadata).
It's just a number field ...
1
vote
5answers
786 views
Dynamic SOQL variable binding not working for multiple records
Am building a dynamic SOQL where I am using a list of strings that represent record ids, here's an example similar to my class:
String q = '';
q += 'SELECT Id FROM' + object;
q += ' WHERE Id IN ...
1
vote
3answers
969 views
use string array in IN clause in dynamic soql
I have an array of strings i'd like to use in the IN clause of a dynamic soql query.
if i wasn't building the string at runtime i could simply use (from the SF docs):
String[] ss = new String[]{'a', ...
2
votes
1answer
213 views
CurrencyIsoCode - Auto included in query results, except for test cases
I've implemented some functionality around MultiCurrency in a Managed package. Since it needs to be able to support non-multi-currency orgs, all references to the CurrencyIsoCode field are done using ...
2
votes
2answers
80 views
Less verbose dynamic +=?
I'm trying to do something like this:
sObject.Custom_Field__c += myNumericVar;
But I'm using dynamic SOQL, so I can't hard-code the name of the fields. The following code works, but it's really ...
4
votes
2answers
403 views
SOQL inline query vs dynamic query
I just wanted to know weather to use inline query or dynamic query as my daily practice. I know in some cases we have to use dynamic query. But as routine practice which one to use. Any thoughts?
13
votes
4answers
2k views
Elegant way to convert Set<Id> into String for Dynamic SOQL IN comparison
When I have a Set of Id's and I want to do a dynamic SOQL query that I want to use it in for an IN comparison, I have to convert the Set to string in the format of:
('id1','id2',id3',...)
The way I ...



