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 (¶meter)
{
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 :)