• Brad Bumbalough
  • NEWBIE
  • 30 Points
  • Member since 2013


  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies

I am new to APEX and SOQL however I have been able to figure out of what most I need to know. That being said I have now become stuck.

 

I am developing a Visualforce page that displays results from my Query. Currently the results are over 1000 items so I need to narrow my search down and I want the user of the page to be able to set date ranges that narrows the results down. My thought is that the user can set the date range and that will load into the URL and my SOQL query will grab the date ranges from the URL. However I am unable to make this work.

 

Here is my SOQL code

 

SELECT Name FROM Opportunity WHERE CloseDate = :ApexPages.currentPage().getParameters().get('CloseDate')

 

However I get an error trying to save this code: Invalid bind expression type of String for column of type Date.

 

The code above works perfectly when grabbing the opportunity number form the url however I cannot get it to work for the date.

 

Any help?

Hello,

 

My org provides services to households, and we need to track the members of that household. We originally had custom objects for Households and People, but are now transferring from People to Contacts so we can use the Communities, HTML email tracking, and other standard functionalities that require using Contacts. 

 

My question is, what are the Salesforce functionality that depend on Accounts? We are planning on still using our custom object Housholds and not using Accounts, but want to consider the possibility of making Households into Accounts if the features are necessary.

 

Thanks in advance.

 

-Brad

I am new to APEX and SOQL however I have been able to figure out of what most I need to know. That being said I have now become stuck.

 

I am developing a Visualforce page that displays results from my Query. Currently the results are over 1000 items so I need to narrow my search down and I want the user of the page to be able to set date ranges that narrows the results down. My thought is that the user can set the date range and that will load into the URL and my SOQL query will grab the date ranges from the URL. However I am unable to make this work.

 

Here is my SOQL code

 

SELECT Name FROM Opportunity WHERE CloseDate = :ApexPages.currentPage().getParameters().get('CloseDate')

 

However I get an error trying to save this code: Invalid bind expression type of String for column of type Date.

 

The code above works perfectly when grabbing the opportunity number form the url however I cannot get it to work for the date.

 

Any help?

I'm having trouble with the following code, for date fields only.  I assume it is because the date is not formatted correctly when passing the sobject json to the remote action.  I have tried a few different formats and there seems be a concensus that the date-time format is  ISO8601.  This is fine, but the middle option is formatted with ISO8601 and no dice.  

 

I am using the javascript date() to format the strings as well.

 

This does work for normal string/picklist fields, so that is why I am seeking help for the date field values.  Any help is greatly appreciated.

 

controller:

@RemoteAction
global static void setField(sObject obj) 
{
	upsert obj;
}

 

 

json:

var sObj = {id: "003Xxxxxxxxxxxxx", Date_of_Next_Meeting__c: "2013-08-26"};
or
var sObj = {id: "003Xxxxxxxxxxxxx", Date_of_Next_Meeting__c: "2014-06-23T07:00:00.000Z"};
or
var sObj = {id: "003Xxxxxxxxxxxxx", Date_of_Next_Meeting__c: "6/23/2014"}

 

 

js function;

Controller.setField(sObj, function(result, event){
		if (!event.status && event.type == "exception") {

			$j("[id$=':msgs']").text("Unable to save meeting preference:" + event.message).show();
		}
});

 

 

 JSON received in chrome js console:
action: "Controller"
data: Array[1]
message: "Unexpected type for Controller.setField(SObject)"
method: "setField"
ref: false
result: null
statusCode: 400
tid: 15
type: "exception"
vfDbg: true
vfTx: true
where: ""
__proto__: h
 
and:
$VFRM.Util.error VFRemote.js:114
(anonymous function) VFRemote.js:130
a.Event.fire VFRemote.js:50
a.Observable.fireEvent VFRemote.js:45
VFExt3.Direct.VFExt3.extend.onProviderData VFRemote.js:84
a.Event.fire VFRemote.js:50
a.Observable.fireEvent VFRemote.js:45
VFExt3.direct.RemotingProvider.VFExt3.extend.onData VFRemote.js:92
VFExt3.extend.handleResponse VFRemote.js:73
a VFRemote.js:37
(anonymous function)