El credito de este tutorial se lo lleva Sebastian Lemos. Me pareció interesante postearlo.
Esta guía nos permite configurar VBC que invoquen un Workflow Process y se populen los registros sin necesidad de agregar script para ello.
Pasos de configuración básica:
a) Creamos el VBC con la clase: “CSSFABCVRec”.
b) Creamos los fields del VBC, el link correspondiente con su BusComp padre y lo agregamos al Business Object destino.
c) Creamos un Integration Object basado en este VBC.
NOTA: Este integration object sólo debe contener como Integration Component un registro que haga referencia al VBC recién creado, el cual no debe contener parent integration object component.
d) Creamos un BS con la clase “CSSFAExternalService”.
e) Al BS recién creado le agregamos un método llamado “Query”.
NOTA: Este método no necesita tener código de eScript.
f) Luego en el VBC creamos las siguientes User Properties:
Name: Value
Outgoing Integration Object Name: {Nombre del IO}
ProcessName: {Nombre del WF de integración}
Service Name: {Nombre del BS anteriormente creado}
Enable Caching: N
g) Creamos el applet basado en el VBC y lo agregamos a la vista destino.
h) Alternativas de configuración:
A partir de acá podemos manejar dos alternativas:
1) Hacer el Query del VBC mediante la invocación con un botón.
2) Hacer el Query automáticamente (default de Siebel).
1) Opción con Botón:
Editamos el Server Script del VBC y completamos el siguiente pseudocódigo en el método PreQuery:
function BusComp_PreQuery ()
{
var methodInvoked = this.GetUserProperty("method_invoked");
if (methodInvoked == "Y")
{
/*Setear los profile attributes requeridos por el WF con
los valores correspondientes
Coordinar con el team de Integraciones
*/
}
else
{
/*Setear los profile attributes requeridos por el WF con
una cadena vacía (“”).*/
}
return (ContinueOperation);
}
Agregar un botón al applet del VBC el cual invoque un método custom.
Editamos el Server Script del applet y en el método “PreCanInvokeMethod” ponemos:
function WebApplet_PreCanInvokeMethod (MethodName, &CanInvoke)
{
var retVal = ContinueOperation;
switch (MethodName)
{
case "ExecuteQuery":
case "NewQuery":
case "RefineQuery":
CanInvoke = "FALSE";
retVal = CancelOperation;
break;
case "{Nombre del método asignado al botón}":
CanInvoke = "TRUE";
retVal = CancelOperation;
break;
}
return (retVal);
}
En el método PreInvokeMethod agregamos el siguiente código:
function WebApplet_PreInvokeMethod (MethodName)
{
var retVal = ContinueOperation;
if (MethodName == "MiQuery")
{
this.BusComp().SetUserProperty("method_invoked", "Y");
this.BusComp().ExecuteQuery(ForwardBackward);
this.BusComp().SetUserProperty("method_invoked", "N");
//Esta parte es opcional y sirve para mostrar un mensaje de error:
if (TheApplication().GetProfileAttr("TECO_EAI_Error_Code") != "")
{
var errorCode = TheApplication().GetProfileAttr("TECO_EAI_Error_Code");
var errorMessage = TheApplication().GetProfileAttr("TECO_EAI_Error_Message");
TheApplication().RaiseErrorText(errorCode + "\n\r" + errorMessage);
}
retVal = CancelOperation;
}
return (retVal);
}
2) Opción sin botón:
Editamos el Server Script del VBC y completamos el siguiente pseudocódigo en el método PreQuery:
function BusComp_PreQuery ()
{
/*Setear los profile attributes requeridos por el WF con
los valores correspondientes
Coordinar con el team de Integraciones
*/
return (ContinueOperation);
}
Si queremos mostrar un mensaje al usuario en caso de error debemos editar el Server Script del Applet y agregar el siguiente script en el método “InvokeMethod”:
function WebApplet_InvokeMethod (MethodName)
{
if (MethodName == "ExecuteQuery")
{
if (TheApplication().GetProfileAttr("TECO_EAI_Error_Code") != "")
{
var errorCode = TheApplication().GetProfileAttr("TECO_EAI_Error_Code");
var errorMessage = TheApplication().GetProfileAttr("TECO_EAI_Error_Message");
TheApplication().RaiseErrorText(errorCode + "\n\r" + errorMessage)
}
}
}
lunes, 17 de noviembre de 2008
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario