I just spent an hour or so with a production bug involving temporary rows in a table. We have a field that indicates what percent of a line item should be applied to an invoice. Obviously this field is important to calculating our invoices accurately. My admin has told me with certainty that a PERCENT field with a default value of 1 will default to 100% in salesforce (I’m taking his word on this…). The field is set up like so:
However when users were creating new rows in the table of line items, the newly created line items were showing up as 1% instead of 100%. I logged the metadata of the field and it looks like skuid has it as “1.0” :
Is this the correct behavior for a percent field?
Also before this release when a user created a new row (via a snippet) if there was no value sent in for the “Applies To” field, it would default to null. It seems like after superbank it started defaulting to the metadata default value. I know that is probably what most people want, but it my case it made some issues. Did something change in superbank about the way default values are set?
Moshe,
Thanks for reporting this.
In Superbank we started doing limited processing of default field values for Number, Percent, and Currency field values, which in past releases would have just had defaults of NULL because technically the Salesforce Schema information for these fields’ getDefaultValue() is NULL — what we had to do was to start using the getDefaultValueFormula() method instead.
You are correct, though, about there being a bug with Percent field default value handling — apparently Salesforce expects Percent Field default values to be the decimal version of the percent, meaning that we need to multiply by 100. We’ll get this rolled into our next patch release.
Zach
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.