For all custom sObject in Salesforce.com. Just learned this today:
http://boards.developerforce.com/t5/Apex-Code-Development/Integer-Double-or-Decimal/m-p/202075/highlight/false#M34823
So if you want to use the value in those fields in code for functions as non-decimal argument, a casting member function from Decimal (intvalue, longValue, doubleValue) is always in order, since Decimal sits right at the highest level of the implicit conversion hierarchy.
There must be a very good reason why we complicated our lives with all these technologies ... arguably that is freedom for something. Freedom might be a right but it is never free; so let me demonstrate how I earned it.
Thursday, February 10, 2011
Useless Isnull() for formula
That's right, or to be gentler, next to useless in Salesforce.com formula. Let's recount:
- Can't be used for TEXT, Rich Text: use Len()=0 instead
- Can't be used for Address: use AddrFieldName=''
- Can't be used for lookup (ID) fields: use isblank() instead - I just realized it today
- Can't be used for pick list: use ='' as well
Wednesday, February 2, 2011
Client side vs. server side on Visualforce
What I needed to do was to disable a drop down box based on the selection in another drop down. Fairly common requirement. The controller drop down starts as disabled, so I set disabled property in , and used JavaScript from onchange to toggle disabled in HTML DOM from the controlling drop down. All sounded fine and dandy and the UI worked as it should, until I realized that the form never returned anything from the controlled drop down no matter what its status was.
It looks like the client side JavaScript did nothing to enable the controlled element. As far as the server was concerned, it's a field it can discard. I didn't do any HTML/JS debugging to confirm that, but it certainly felt that way. Once I switched the controlling mechanism to server-side processing/AJAX, it started to work as intended.
The only drawback with the AJAX way was that it's a bit slower. Action from the client-side Javascript was instant. With AJAX and its server round trip, it took about one second for the controlled drop down to change status.
It looks like the client side JavaScript did nothing to enable the controlled element. As far as the server was concerned, it's a field it can discard. I didn't do any HTML/JS debugging to confirm that, but it certainly felt that way. Once I switched the controlling mechanism to server-side processing/AJAX, it started to work as intended.
The only drawback with the AJAX way was that it's a bit slower. Action from the client-side Javascript was instant. With AJAX and its server round trip, it took about one second for the controlled drop down to change status.
Subscribe to:
Posts (Atom)