Tuesday, May 20, 2008

CSSBusComp verus CSSBCBase

We're using the correspondence table for a custom purpose and tried to use the Correspondence BC oob. We ran into some issues w/ the bc going read-only when the status on our record was "Submitted." Turns out there was some hard-coding in the class and not an editable BC user prop. So, we changed the BC's class to CSSBusComp, which is the default for any new bus comp. Things looked ok for a while until I noticed that my calculated Name field stopped working. As mentioned in the previous post, this uses some calculated fields and the On Field Update BC user props. So I had a hard look at the config, checked VSS for changes (which was extremely tedious) and came across something in Siebel Tools' Help menu. Turns out some user props are limited to certain BC classes. On Field Update is one of those! So, once I changed the class to CSSBCBase, the calculated Name worked again. Additionally, I discovered that for audit trail to work, you must use CSSBCBase. And for those interested, CSSBCBase is derived from CSSBusComp and inherits its properties.

Monday, May 19, 2008

Using Calculated Fields to Parse Dates

We had a requirement to calculate the name of Campaign based on a few attributes. This was accomplished by using a post default of the calculated field into the stored Name field. Additionally, if any of the attributes changed, we used the On Field Update bc user prop to recalculate the Name. Pretty straightforward except that one of the fields was the Created date field that had to get parsed from the MM/DD/YYYY TIME format to something like YYYY-MM-DD. Here's how it was done:

1. Create 3 new calculated fields to grab the MM, DD, YYYY out of the date
a. Year Calc: JulianYear([Created])-4713
b. Month Calc: JulianMonth([Created])-(JulianYear([Created])*12)
c. Day Calc: Right(Left([Created],5),2)

2. String them together as:
ToChar([CEB Year Calc])+"-"+ToChar([CEB Month Calc])+"-"+(Right(Left([Created],5),2))

Figuring out the Day Calc was not straightforward w/ out-of-the-box (oob) Julian function, so I had to parse it the old fashioned way. In reality, I probably could have parsed the three date elements using Right and Left but there was a nice challenge in using Julians. I had to use some simple algebra to solve for Month since bookshelf presents it in terms of Julian Year. I also like the Julian function b/c it should handle any regional differences in date formats.

Sunday, May 18, 2008

changing the length of a field on bc

we added a custom column on a table and set the column's length to 100. however, on the bc, we only needed our field to be 10 characters. i thought that we'd only have to change the length property on the bc's field, however, unit testing allowed me type 100 chars in that field. did some research and found that a field user prop was required: Text Length Override

name: Text Length Override
value: TRUE

a long time coming

i've been working in the field since august of 2000. fresh out of undergrad with a totally unrelated degree, i landed a great job w/ some great people in boston, ma and have pretty much been learning things the hard way. i'll try to keep some notes about stuff i've learned and post any tips or tricks i come across.