Monday, July 19, 2010

Getting Started with SIFs

Having downloaded the source files this should help get things started:

1. Import the business service and the workflow process.

2. Add the following line to the config file in the appropriate place (in the [SWE] section)

ClientBusinessServiceXX  = "MFramework"

3. Check in and Deploy the WF Process "MFramework Service Wrapper WF" (if you want to use the asynch business service calling feature).

4. Add the following to the server script declarations section of the application you are using:

var oBS:Service = this.GetService("MFramework");
oBS.InvokeMethod ("BuildFramework", NewPropertySet(), NewPropertySet());

5. Add the following as a new method in the server script of the application you are using:


function FrameworkHandle()
{
    return this.GetService("MFramework").frameworkHandle();
}

This acts as a wrapper for BCs, BSs etc to get a reference to the Framework object.

6. Add the following to the browser script declarations section of the application you are using:

setTimeout("BuildFramework()", 1000);

7. Add the following as a new method in the browser script of the application you are using:


function BuildFramework()
{
    var bsUi = theApplication().GetService("MFramework");
    bsUi.InvokeMethod("BuildBsFramework",NewPropertySet());
};

8. Compile and generate browser scripts.

Run the application.

To test we'll run some of the browser side functionality (which in turn runs the server side, so is a good way to smoke test)... so when the application is running copy and paste the following into the address bar:

javascript:alert(top.oFramework.BusComp.getRecord("Employee.Employee", "0-1", ["Full Name"])["Full Name"]);
//

Hopefully you'll get an alert with "SADMIN SADMIN" here, if so, great, it works!

Some more tests:

javascript:alert(top.oFramework.BusComp.getRecord("Employee.Employee", "0-1", ["Full Name"]).Full_Name);
//

Same result as above, just accessing the value in a subtly different way.

javascript:alert(top.oFramework.Lov.getDescription("LOV_TYPE","LOV_TYPE"));
//

Here you should get a description of the LOV_TYPE lov.

javascript:alert(top.oFramework.BusComp.getRecord("Employee.Employee", "0-1","").Created);
//

So that should give the Date of when the SADMIN Employee record was created.

javascript:alert(top.oFramework.BusComp.getRecord("Employee.Employee", "0-1","").Created.toDb());
//

Same as last test but displays in DD/MM/YYYY format. This makes use of two features of framework - new methods added to JS datatypes, and optional typing of fields in the BusComp.getRecord() method.

So hopefully that all works, let me know if not and I'll try and figure out why.

For info., I use 7.7 and the ST engine - I did have strong typing in the code, which I have removed to allow this work in the T engine, but there may be some  other problems with the way I use the JS objects, so let me know if you've any issues or thoughts.

And let me know if it works too, of course!

Matt

2 comments:

  1. Hi Matt,

    Downloaded your SIF and tried it on Siebel 8.1 Financial Service module, ST Engine

    but it did not work. I get errror as soon as application starts.

    The error is:

    TypeError:Object not initialized

    Application.Application_Start line: 48

    I tried in Application declaration as well as application start event.

    It seems will have start from scratch and build it one function at a time to see where it failing.

    Will update in case if I find something

    ReplyDelete
  2. Hi Neel,

    I had a look at this - I think the problem (or a problem, there may be more) could be the lines of script I've written here for the application - I think the NewPropertySet() method needs either theApplication() or this. ahead of it, so in the application browser script I think it should be:

    function BuildFramework()
    {
    var bsUi = theApplication().GetService("MFramework");
    bsUi.InvokeMethod("BuildBsFramework",theApplication().NewPropertySet());
    };

    and the server script (declarations) in the application should be:

    var oBS:Service = this.GetService("MFramework");
    oBS.InvokeMethod ("BuildFramework", this.NewPropertySet(), NewPropertySet());

    Hopefully that will help get a little further!

    Let me know how you get on,
    Matt

    ReplyDelete