Scripting Paths for return (CancelOperation)

View previous topic View next topic Go down

Scripting Paths for return (CancelOperation)

Post  Admin on Tue May 11, 2010 12:02 pm

I was very curious about how the CancelOperation works in different events. I did some research on this and below are my findings.

Scripting Paths for return (CancelOperation) in browser or server script

return (CancelOperation) in Applet PreInvoke Method Browser Script
Applet_PreInvoke -> End

return (CancelOperation) in Applet PreInvoke Method Server Script
Applet_PreInvoke -> WebApplet_PreInvoke -> Applet_Invoke -> End

return (CancelOperation) in BusComp PreInvoke Method Server Script
Applet_PreInvoke -> WebApplet_PreInvoke -> BusComp_PreInvoke -> WebApplet_Invoke -> Applet_Invoke -> End


return (CancelOperation) in BusComp Invoke Method Server Script
No Impact

return (CancelOperation) in Applet Invoke Method Server Script
No Impact

return (CancelOperation) in Applet Invoke Method Browser Script
No Impact


return (CancelOperation) on post events does not do anything. For example, if you write return (CancelOperation) in
Applet_InvokeMethod, Buscomp_InvokeMethod, BusComp_NewRecord etc, it does not make any difference to the scripting
flow.

return (CancelOperation) plays role only on Pre events like PreInvokeMethod, PreNewRecord, PreWriteRecord etc. The
above six flows explains the impact of CancelOperation on different Pre Events.


Standard Methods Flow:

Applet Browser Pre Invoke -> Applet Server Pre Invoke -> BusComp Server Pre Invoke ->
Siebel Internal Operation ->
BusComp Server Invoke -> Applet Server Invoke -> Applet Browser Invoke


In case of standard methods like WriteRecord, NewRecord, DeleteRecord etc, operation is performed internally by
Siebel after BusComp Server Pre Invoke event. But in case of custom methods, the custom code is written in the event
itself. It is important that when a custom method is called, control should NOT go to Siebel Internal Operations
event where Siebel performs the standard operations based on the name of method passed to it
because Siebel will not
be able to locate the operation to be performed for custom methods.

In case, a custom script is written on a call of custom method, then it must be written in PreInvoke method event of
Applet or BusComp.

Why only on Pre -> Siebel Internal Operations event is followed directly after BusComp Pre event. We should cancel

the operation once the custom code written on Pre event has executed successfully so that control does not go to

Siebel Internal Operations event. Applet Pre and BusCmop Pre are only two events before Siebel Internal Operations

event and control must be returned in these two.


Take an example where a custom method “test” is called from a Applet. This method is captured in two events namely Applet_PreInvoke and WebApplet_PreInvoke. In Applet_PreInvoke event do not return CancelOperation otherwise WebApplet_PreInvoke event will not get fired. In both the events, call WriteRecord method using this.InvokeMethod(“WriteRecord”). The following trace gets generated:


Applet_PreInvokeMethod: test

Applet_PreInvokeMethod: WriteRecord
WebApplet_PreInvokeMethod: WriteRecord
BusComp_PreWriteRecord
BusComp_WriteRecord
WebApplet_InvokeMethod: WriteRecord
Applet_InvokeMethod: WriteRecord

WebApplet_PreInvokeMethod: test

WebApplet_PreInvokeMethod: WriteRecord
BusComp_PreWriteRecord
BusComp_WriteRecord
WebApplet_InvokeMethod: WriteRecord

Applet_InvokeMethod: test


Is it possible to write a code in all the three events, namely - Applet_PreInvoke, WebApplet_PreInvoke and BusComp_PreInvoke for a custom method and code in all the three should be executed without any error?
Yes, it is possible to do this. Write your code in all the three events but return the CancenOperation only in BusComp_PreInvoke which is executed last. But there are very rare chances where we need this type of coding.


Note that the return value in browser and server scripts are slightly different. In browser script, its enclosed in
doubel quotes and in server script without double quotes.


If you write return(CancelOpration) in browser script, what will happen ?
When the control reaches <return(CancelOpration)>, execution will stop there. Javascript error will show in status
bar. Depending on the IE setting, it may or may not show the popup. All the further actions of the event will not be
executed.


If you write return("ContinueOperation") in server script, what will happen ?
It will throw syntax error at the time of execution.

Please add if any one has more information on this.

-Munavvar
avatar
Admin
Admin

Posts : 21
Join date : 2010-02-25

View user profile http://siebelwithmunav.dodiscussion.com

Back to top Go down

Diagram

Post  Admin on Fri May 14, 2010 4:50 pm

This diagram describes clearly the path of execution of a event.
Attachments
CancelOperation.GIF DiagramYou don't have permission to download attachments.(20 Kb) Downloaded 57 times
avatar
Admin
Admin

Posts : 21
Join date : 2010-02-25

View user profile http://siebelwithmunav.dodiscussion.com

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum