July 18, 2015

How to pass arguments by reference in Siebel?

Yes! it is possible to pass arguments by reference to Siebel functions. This technique is not documented in bookshelf and most of developer use this unknowingly while passing true or false to CanInvoke property in WebApplet_PreCanInvokeMethod Event of applets to make controls active or inactive.

Lets see how it works.

Nothing special needs to be done by calling function, only change made is in callee function in declaration of arguments by prefixing & ampersand just like &CanInvoke in PreCanInvokeMethod.


 Lets see an example :

function Service_PreInvokeMethod (MethodName, Inputs, Outputs)
{
if(MethodName == "PassByReferenceTest")
{
var privatePS = TheApplication().NewPropertySet();
privatePS.SetProperty("test","something");
subFunction(privatePS);
TheApplication().RaiseErrorText(privatePS.GetProperty("test"));
return(CancelOperation);
}
return (ContinueOperation);
}

function subFunction (&parameter)
{
parameter.SetProperty("test","TestSuccesful");
}


Above script declares a new property set and sets value of a process property to a string("something"), which is over written("TestSucccesful") by subFunction by directly accessing it through the memory pointer.  When business service is executed RaiseErrorText whill print "TestSuccesful" instead of "something".

 
This trick will potentially save you memory allocation and speed up you code a bit. Please be mindful that this code is just an experiment and should not be used in production environment without proper testing.


Happy coding :)

July 02, 2015

Not all control paths lead to a return statement. (SBL-SCR-00128)

Not all control paths lead to a return statement. (SBL-SCR-00128)

  This issue was fixed in version 8.1.1.7, but has been reported re-occurring in IP2014 patchset 3, it is caused due to product defect. This can cause interruptions in full compile of srf.

While compiling srf, if any script which has try catch block which has return statement in try block and does not have return statement outside catch, then this error will interrupt the srf compilation. 


To resolve this disable the "Deduce Types" scripting option in Siebel Tools as shown below.

June 30, 2015

How to change color of screen tab in Open UI?

I think this configuration should available out of the box in Siebel. Never the less I am happy that it is possible to customize the View PR layer in Open UI to change the colors of view bar of specific views.

In this example we will see how can we change the view bar background conditionally using Open UI View level PR customization.

This is how grey tab theme looks out of the box for Manifest File view :
 
Open UI Manifest File View

And this is how Manifest Administration view looks with Open UI PR Customization:

Open UI Manifest Administration View

May be savvy developers would like to have pale yellow for read only views or red for administration screens???


Part 1 : Create CSS class
This customization requires extending the theme in theme.js and creating new class to add different color. New Class should look something like :
custom-theme.css
When this class is associated with any control, it will change the background of the element to transparent and change the background color to blue.

Part 2: Create View PR Customization 
Now the task left is to find the view bar element in the DOM and assigning the class, this can be done with these two commands:

            $("#s_sctrl_tabView").addClass("custom_viewbar");
            $("#s_sctrl_tabScreen").find("li.ui-tabs-active[role='tab']").find("a").addClass("custom_viewbar");

Additionally we need to handle the browser resize event and reassign the class on change of size of browser. Sadly resize event is not passed on the View level PR as described in bookshelf and it has to be done with help of jQuery bind function. Code handling resize event looks like :

        $(window).bind("resize", OnPRResize);

At last we need to handle the cleaanup in the EndLife event of jQuery bind and the class allocation.

$(".custom_viewbar").removeClass("custom_viewbar");
$(window).unbind("resize", OnPRResize);

The final code of PR looks like:


if (typeof(SiebelAppFacade.testPR) === "undefined") {
    SiebelJS.Namespace("SiebelAppFacade.testPR");
    define("siebel/custom/testPR", ["siebel/viewpr"],function () {
    SiebelAppFacade.testPR = (function () {

    function testPR(pm) {
                SiebelAppFacade.testPR.superclass.constructor.apply(this, arguments);
    }
    SiebelJS.Extend(testPR, SiebelAppFacade.ViewPR);

    testPR.prototype.Init = function () {
        $(window).bind("resize", OnPRResize);
        SiebelAppFacade.testPR.superclass.Init.apply(this, arguments);
    }

    testPR.prototype.ShowUI = function () {
        SiebelAppFacade.testPR.superclass.ShowUI.apply(this, arguments);
    }

    testPR.prototype.BindData = function (bRefresh) {
            SiebelAppFacade.testPR.superclass.BindData.apply(this, arguments);
    }
    var OnPRResize = function OnResize(){
            $("#s_sctrl_tabView").addClass("custom_viewbar");
            $("#s_sctrl_tabScreen").find("li.ui-tabs-active[role='tab']").find("a").addClass("custom_viewbar");
    };
    testPR.prototype.BindEvents = function () {
            SiebelAppFacade.testPR.superclass.BindEvents.apply(this, arguments);
    }
    testPR.prototype.EndLife = function () {
        $(".custom_viewbar").removeClass("custom_viewbar");
        $(window).unbind("resize", OnPRResize);
        SiebelAppFacade.testPR.superclass.EndLife.apply(this, arguments);
    }

    testPR.prototype.Setup = function () {};

    testPR.prototype.SetRenderer = function () {
                $("#s_sctrl_tabView").addClass("custom_viewbar");
                $("#s_sctrl_tabScreen").find("li.ui-tabs-active[role='tab']").find("a").addClass("custom_viewbar");
    };

    return testPR;
    }()
    );
    return "SiebelAppFacade.testPR";
    })
}

Part3: Configure Manifest
Now when this PR script is associated to any view in Open UI Manifest, view bar color and screen tab color of that view will change to blue.


Hope it helps, if you like this article and would like to see more articles like this please leave a comment or +1

June 28, 2015

How to make Open UI textarea fields flexible in IE?

As you would know that IE doesn't have flexible textarea even in version 11. When rest of all modern browser allow to open drag one corner of the text area to change its size, IE doesn't let user to change size of elements because of Trident layout engine???


Fixed size multiline fields in IE
Because of this limitation Siebel Open UI users suffer big time. All the multiline textarea fields in open UI are fixed size and there is no way to pop them up as in HI or expand them. read more. 

Flexible multiline fields in chrome
There are many jquery based plugins available for this problem however all of them needs to maintained and lacks in one thing or the other, probably you will end up using one of those plugins at the end. However If someone looking for simple straightforward stop gap solution, then you can use jQueryUI Resizable function to make the textareas flexible just like chrome or firefox.

To implement in simply add following one line in postload.js file on the web server.

 $("textarea").resizable(); 

This will make all the textarea controls which are used for multiline field flexible and show tiny blue cue to expand or decrease the size of element and mimic chrome or firefox textarea elements.


Hope it helps.


June 27, 2015

How to build Siebel Workflow Expression?

I remember my days when i started with Siebel, I just couldn't get the syntax of workflow expression correct. I still see newbies of siebel struggling to get it right the first time. In this post I would try to make the basic rules of workflow expressions as simple as possible.

Basic Rules of Siebel Workflow Expression are :

  1. Siebel Workflow takes String as input.
  2. + (plus) is the concatenation operator.
  3.  Process properties can be referred using & operator like this > [&Object Id] 
  4.  Don't worry about spaces in process property names, they are allowed.

Let's take an simple example where we want to build the expression to search for records with Contact Id specified in Object Id the search spec would be:



if Object id contains : 1-12345 then expression will be evaluated as :


Did I say its a H.U.G ?

See what is the difference between Expression Business Component and Filter Business Component


Hope it helps. If you know similar topic and want to share with Siebel community, please post it in comments below. I will post it as blog post.