This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* (c) Benj Kamm 2012 | |
* Determine current fiscal year in Apex -- add this method to a class that needs it. | |
* | |
* FiscalYearStartMonth - Integer 1-12 corresponds to starting month of FY | |
* UsesStartDateAsFiscalYearName - If false, FY Name is year of ending month; if true, name from beginning month. | |
*/ | |
private integer getCurrentFY() { | |
Organization orgInfo = [SELECT FiscalYearStartMonth, UsesStartDateAsFiscalYearName | |
FROM Organization |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Apex doesn't expose dependent picklist info directly, but it's possible to expose. | |
* Approach: | |
* * Schema.PicklistEntry doesn't expose validFor tokens, but they are there, and can be accessed by serializing to JSON | |
* (and then for convenience, deserializing back into an Apex POJO) | |
* * validFor tokens are converted from base64 representations (e.g. gAAA) to binary (100000000000000000000) | |
* each character corresponds to 6 bits, determined by normal base64 encoding rules. | |
* * The binary bits correspond to controlling values that are active - e.g. in the example above, this dependent option | |
* is available for the first controlling field only. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* By Benj Kamm, [email protected] */ | |
// Look for the value of the first text node within the current node. | |
// Returns 'false' if not found, otherwise the value of the first text node in the subnode. | |
function getXMLNodeValue(el, key) { | |
var matches = el.getElementsByTagName(key); | |
if (!matches.length) { | |
return 'false'; | |
} | |
return matches[0].childNodes[0].nodeValue; |