You need to sign in to do that
Don't have an account?
Harmpie
Date field best practises S-control
Could someone give me some best practises + samples on how to deal with date fields in S-Controls?
- How to select a date value using SOQL
- How to parse a date retrieved by merge fields i.e. ({!Opportunity.CloseDate}
- How to re-use a selected date from either SOQL or mergefield in a new query
- What javascript files to include?
To use a date field from a merge field, you should probably use the following:
This will get the date into a JavaScript object, which allows you use getMonth(), getDay, getYear(), etc.
The only javascript file you should need to include ordinarily is the AJAX Toolkit; the link for this file is "/soap/ajax/10.0/connection.js". You can also include the Dojo Toolkit if you need it, or any other files from the Salesforce server or from a remote server.
Just 1 question though, regarding
Code:
is this 100% fullproof ? Isnt the format of the mergefield determined by locale of the user and thus very unconsistant ?
Some more feedback. It seems the new Date() variant breaks in a lot of situations and is far from robust. So far the only way that I can get robust performance is using the code above. And I don't like it :) But it works
Code: This will cause Salesforce to create the correct date format for javascript automatically. So you don't need to do that query anyways!
~ sfdcfox ~
Also, it should be noted that the Date({!CloseDate}) syntax "normally" works (that is, users that use mm/dd/yyyy normally have their computer locale set to the same, and dd/mm/yyyy will have their computer locale set to the same). You have to actually "go out of the way" to break it, since most users would have their Salesforce locale and computer locale set to the same values.
~ sfdcfox ~