Tuesday, January 24, 2012

Siebel Format Date Strings Within a Workflow Process Without Having to Resort to Script

It's possible to have a requirement to compare dates coming from different sources such as Field Values, Methods (Timestamp or Today), or Integrations. They may be in different formats making comparisons sometimes difficult.

Being able to format a date string to be similar to another format is useful and doing so without Script is very desirable. This post shows a Workflow technique using the ToChar Method to format date strings without Script where both the input date and the format are dynamic process properties.


Create a Workflow process with three process properties:

1. BeforeDate
    a. Type: Date
    b. Default Date (for testing only) 08/11/2011 06:06:54

2. AfterDate
    a. Type: String

3. DateFormat
    a. Type:String
    b. Default String: "M/DD/YY"
NOTE: The Process Property that holds the input date must be of type Date. If one tries to use String as the Data Type for the Process Property holding the input date the format will be ignored in the ToChar Method and the date will simply be copied as a string to the Output Process Property.

Add three steps to the Workflow.

1. Start

2. Business Service
    a. Business Service Name: Workflow Utilities
    b. Business Service Method: Echo

3. Add an Output Argument to the Business Service step with the following properties.
    a. Property Name: AfterDate
    b. Type: Expression
    c. Value: ToChar([&BeforeDate], [&DateFormat])

4. Connect them so that the final Workflow Process looks like this figure 1.


Figure 1 This is the way the test workflow looks.
5. The ToChar Method will take our input date and our desired format and produce a string in the format desired. When simulating the Workflow one can see the input and output in figure 2.

Figure 2 This is the resulting formatted date string

M = Month as a single digit
MM = month as two digits
m = minutes as single digit
mm = minutes as two digits
DD = two digit days
YYYY = four digit years
HH = hours
MM = minutes (if after the hours token)
SS = seconds


  1. IS this really working.. I tried the same and getting SBL-BPR-00121 error

    1. Hi

      its working.Send ur email Id i will send u the Workflow xml

  2. Its working fine but i want to use system date and today() function is not working in default string value. please suggest me i want to perform this task

    ToChar([&BeforeDate] + 1, [&DateFormat]) + ' ' + '09:00 AM'

    1. Use another echo function to get the Today() value for this Date Variable

  3. Thats - That work nice in 7.5 workflow, getting the month date from today (ie. 1-31)
    : ToChar(Today(), "D")

  4. Hi.. is it possible to have a string format and convert to date in workflow without scripting?