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.