יום רביעי, 25 במאי 2011

Multiple Email Validation Script in Siebel

This post is a result of my sheer frustration for not getting this right in a 100 tries. I had been trying to validate the email addresses being entered in Siebel. I tried a lot of ways to get it to work (Data Validation Manager, Runtime events, Configuration etc) but the darn thing would just not work. I had to ultimately resort to the "boo hoo"- Script!

I thought this would be useful for a lot of Siebel guys out there, will save you from all that frustration.(Checks/validates for a comma separated list of emails as well)

Code:

function BusComp_PreWriteRecord ()
{
    try
    {
        this.ActivateField("Email Address");
        if (this.GetFieldValue("Email Address") != "")
        {
            var sEmail = this.GetFieldValue("Email Address");
            var sPattern = /((\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)*([, ])*)*/;
            var isValid = sEmail.replace(sPattern,"Y");
            if(isValid != "Y")
            {
                TheApplication().RaiseErrorText("Please enter a valid email address");
                return (CancelOperation);
            }
            else
                return (ContinueOperation);
            }
        else
            return (ContinueOperation);
    }
    catch (e)
    {
        throw (e);
    }
    finally
    {
        sEmail = null;
        sPattern = null;
        isValid = null;
    }
}

And last but not least. I must give credit to this post which was the only one that actually worked for me. 
Regular ​Expression ​for ​multiple ​email ​validation

Tip: It is advisable to try out string manipulation, validation scripts in a script simulator before coding it in Siebel. Saves you a lot of time and effort.(for eScript you could use the W3Schools JavaScript Simulator)

Cheers!

יום שלישי, 24 במאי 2011

Inner Join Extension Table - User Property

Party business components are fundamental element of the application architecture. They are like piece of beautifully composed music crystallized together in order to reflect the complexities in business environment. Party model helps in the grouping of data according to business logic. The primary difference
between Party and Non-Party BC's is in the manner data is stored. For Non-Party BC's data is primarily stored in base tables while for party BC data is stored in extension tables. There are 8 prominent extension tables used for party data storage.

Now the question surfaces is how siebel determines which extension table to be used for Person-related BC or which extension table should be used for Organization-related BC. Where this mapping in the Account or Contact BC is given that decides which extension table to use? Answer lies in the Buscomp user properties. "Inner Join Extension Table n" user property specifies an extension table to S_PARTY for which the join to the extension table is an inner join. We can have multiple tables that are implicitly joined to S_PARTY extension table. Employee and Organization are examples of multiple extension tables.

Once we have discovered the source between S_PARTY and its extension tables how about creating Custom Party types(Bookshelf gives warning for these types though). A curious case here is can i create a custom table and use it as an extension table for my custom party type using this user property. Well, lets try this and extend the party group.

Happy Party-ing!!

יום חמישי, 19 במאי 2011

Query performance issue : Dedicated Client Vs Thin Client

Very strange behaviour I observed today while working on a performance issue where whenever user do a query in Purchase Order Pick applet, query was taking more than 1 minute to execute in thin client but the same query behaves perfectly fine in dedicated client.So while working on any performance issue, you always want to see the performance on dedicated client as well, so I did the same.1. Took

יום רביעי, 18 במאי 2011

Constraining Business Component to accept unique value for some fields

One of the interesting requirements I heard recently to put a check on the business component to accept only those records which has the unique value in specified fields. Actual requirement goes this way: “Opportunity Product” is the child business component of “Opportunity” Business Component. System should not allow adding the Opportunity Product record with the same “Product” associated with

יום שלישי, 17 במאי 2011

Applet Message

Applet Messages are quite useful in scenarios where one has to display help text to end user in the applet itself. We do have ihelp also but ihelp's are view specific and if we have multiple toggles defined in applet with different operations on each applet then ihelp may not be a good option. One can also go for direct modification of applet WebTemplates but again it will include maintainence overhead. An applet message allows to combine static text and dynamic data which can be displayed on applet. With little bit of HTML one can also add zing to the message.
Siebel bookshelf has elaborated the usage and configuration of Applet Messages how ever one thing is missed there(correct HTML Type) that i will try to fill out here. Let's say we need to add some help text on the SR form applet. Following steps are required to add an Applet Message.

1 - The applet message is configured using the Applet Message and Applet Message Variable object types. Query for the applet you want to add message and navigate to Applet Message object type. Add message in the Text Message. We can use %1, %2 for dynamic data to be defined in Applet Message Variable.

2 - Once the message is confiured,time to create a message control. Following properties should be set:
Name = Any Name
Field = Name of the Applet Message
Field Type = Message
HTML Type = Plain Text (Make sure this is set to Plain text and not to text or text area)
HTML Display Mode = DontEncodeData (If HTML attributes are being used for color and font changes)

3 - Once control is created, we can expose this on the applet. We can map control anywhere on the template where we want to display the message.


The advantage of using Applet message is we can change this on runtime also using dynamic data, where date being displayed from calculated fields using lookup value. This is something which we can be used to enrich UI for end user assistance.

Happy Configuration!!!

יום רביעי, 11 במאי 2011

Removal of Null Tags

A lot has been said and written about removing null tags in xml messages. Any integration ace will always suggest to go for XSLT to transform XML while an siebel eScript enthusiast will defend stating business service will be ideal way to achieve this. But a laggard like me is always in search of solution which is easier to implement and flexible enough to handle frequent changes. After peppering siebel forums one of my friend came up with devilicious idea of using the data mappers itself to remove the null tags.

As per siebel booskshelf:

"The Integration Component Fields list displays the list of fields for that component. Note the system fields Conflict Id, Created, Id, Mod Id, Updated, operation, and searchspec in the list. This setting prevents the EAI Siebel Adapter Query and QueryPage method from outputting these fields."

It says that system fields are not the part of output XML. Any integration field of type "System" is not included in the ouput siebel message of EAI Siebel Adapter. So key here is, if the tag is null we can replace it in datamapper with any system field.

Consider a scenario if description is blank in Service Request then we don't want Description Tag send to external system in the outbound message. In order to remove the null tag we can use following expression in the DataMap:

IIF([Description] IS NULL,[Created],[Description])

In this Description and Created are integration fields of IC. Created is of type System, so if description is coming as null then we are passing Created. Here as Created is system field it will not come up in the ouput message after conversion. Now one may say how to remove entire instance if all the tags are null. Siebel also has solution to that. Try out Source Search Expression for this scenario.

Happy Integration!!

PS: Watch Out for Vinay's world for XSLT to filter out null tags.

יום שלישי, 3 במאי 2011

"Siebel-Authored" flag in Data Map

Lot of things in siebel are still not documented. Talk about those magical user properties or custom classes with super natural powers, most of them needs to be discovered by trial only. Recently while working on the Siebel ASI, my eyes started gleaming when i saw "Siebel-Authored" flag in Data Map editor screen. My initial hollow guess was this flag might be used by siebel to identify predefault data mappers which are used by ASI. But after checking in sample i confronted that this flag was blank for all records.

Out of curiosity i started searching for usage of this flag but was not able to hunt down much. Please feel free to add comment in case you have any clue about this flag.

Happy Cracking!!