Siebel 7.8 eScript OOP Framework

By | 2014/02/03
This entry is part 1 of 2 in the series Siebel eScript OOP Framework

Hi,
wanted to introduce you to some concept I have developed while working with Siebel.

It is kind of Object Oriented Programming Framework in Siebel eScript – something you will not see in Siebel Bookshelf.

But first 2 examples, so that you will know whether this is what you want or not..
Before:

function InsertAndDeleteRecord(firstName, lastName, type) {
    var bo;
    var bc;
    try {
        bo = TheApplication().GetBusObject("Custom BO");
        bc = bo.GetBusComp("Custom BC");
        bc.InvokeMethod("SetAdminMode", "TRUE");
        bc.SetViewMode(AllView);
        bc.ClearToQuery();
        bc.ActivateField("First Name");
        bc.ActivateField("Last Name");
        bc.ActivateField("Type");
        bc.ExecuteQuery(ForwardOnly);
        bc.NewRecord(NewBefore);
        var rowId = bc.GetFieldValue("Id");
        bc.SetFieldValue("First Name", firstName);
        bc.SetFieldValue("Last Name", lastName);
        bc.SetFieldValue("Type", type);
        bc.WriteRecord();
        bc.ClearToQuery();
        bc.SetSearchSpec("Id", rowId);
        bc.ExecuteQuery(ForwardOnly);
        if (bc.FirstRecord()) {
            bc.DeleteRecord();
            bc.WriteRecord();
        }
    } catch(e) {
        // let's skip this
    } finally {
        bc = null;
        bo = null;
    }
}

After:

function InsertAndDeleteRecord(firstName, lastName, type) {
    var customBC = TheApplication().getSiebelObject().getCustomBC();
    customBC.FirstName = firstName;
    customBC.LastName = lastName;
    customBC.Type = type;
    customBC.save();
    if("" !== customBC.Id) {
        customBC.remove();
    }
}

Both examples do exactly the same. But as you see second one is much shorter.

Here is how to add support for new monitor agent:

  1. add this script to Application Server Script
    function CustomBC() {
        this.tempParent = BCBase; // invoke parent constructor 😉 - nasty hack 😉
        this.tempParent();
        this.tempParent = null;
      
        this.FirstName = "";
        this.LastName = "";
        this.Type = "";
      
        this.boName = "Custom BO";
        this.bcName = "Custom BC";
      
        this.fields.FirstName = "First Name";
        this.fields.LastName = "Last Name";
        this.fields.Type = "Type";
    }
      
    CustomBC.prototype = new BCBase();
  2. add 3 lines to Application Server Script into A_GetSiebelObject (at the end of it):
    A_GetSiebelObject.prototype.getCustomBC = function () {
        return new CustomBC();
    };

Naturally first you need to import all the related code (attached to this post as a zip file: Siebel 7_8 eScript OOP Framework). It also makes use of Messages from Message Category named “General Errors” (data available in the same zip file in general_errors.csv file).

 

Comming up:

  • prototyping in Siebel eScript
  • Siebel OOP Framework details
Series NavigationSiebel 8.x eScript OOP Framework >>

2 thoughts on “Siebel 7.8 eScript OOP Framework

  1. Johnb408

    I really like your blog.. very nice colors &amp theme. Did you make this website yourself or did you hire someone to do it for you? Plz respond as I’m looking to construct my own blog and would like to know where u got this from. thank you gbkeegkcdefe

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *