Quantcast
Channel: The Siebel Scholar
Viewing all 37 articles
Browse latest View live

My BI Quick Reference

$
0
0
I know there are a bunch of cheat sheets out there, but I frequently don't find everything I am looking for in one place so figured I would just start building my own.

Siebel Functions

Include statement

<?namespace:psfn=http://www.oracle.com/XSL/Transform/java/com.siebel.xmlpublisher.reports.XSLFunctions?>

Date Conversion

<?psfn:totext(OrderDate,"MM/dd/yyyy","MM/dd/yyyy hh:mm:ss")?>

Loops:

Basic Loop where QuoteItem is the Integration Component/XML Group
<?for-each:QuoteItem?>
Add a where clause to constrain rows in the loop.  Multiple constraints can be added back to back with each bracketed section representing an AND.  An OR would need to be done inside a single bracketed expression.  the .// is an xpath expression to determine the XML group of the field
<?for-each:QuoteItem[.//LineType='Sales']?>
<?for-each:QuoteItem[.//LineType='Sales'][.//LineNumber<100]?>
<?for-each:QuoteItem[.//LineType='Sales' or .//LineType='Service']?>
Groupings 

Loop that groups by the column LineType and sorts by the grouping
<?for-each-group:QuoteItem;./LineType?><?sort:current-group()/LineType;'ascending';data-type='text'?>
A nested loop showing the sub group records for the loop above:
<?for-each:current-group()?><?sort:Product;'ascending';data-type='text'?>

Loop that groups records together by a particular column and makes each grouping a column in a table
<?for-each-group@column:QuoteItem;./LineType?>
Similar to grouping by column is to group by section.  In this case each grouping creates a heading when the report breaks across multiple pages.
<?for-each@section:G_CUSTOMER?>

Group Expressions

This expression is used to sum a column from series of records outside the context of a loop.  The expression in the bracket specifies those records to include, in this case only non null values.  This is an XPath expression.
<?sum(.//ItemExtendedPriceTotal[.!=''])?>
Conditionals:

If/else
<?if:Comment!=''?>
<?Comment?>
<?end if?>

Keep in mind that Carriage returns outside the expression will still appear so consider this when judging where to put the donditional

Switch/Case/Select/Choose:

<?choose:?> <?when:MY_FIELD='value tested'?> <?call:template?> <?end when?> <?when:MY_FIELD_2='value tested 2'?> <?call:template_2?> <?end when?> <?otherwise:?> <?call:template_other?> <?end otherwise?> <?end choose?> 

Embedding a 64 Bit Image

For this to work, there must be a 64 Bit attachment embedded in the Integration Object being sent to BI. In this example,QuoteAttachment is the element name of the IC Field of type DTYPE_ATTACHMENT containing the 64 Bit inline image.
<fo:instream-foreign-object content-type="image/jpg"><?QuoteAttachment?></fo:instream-foreign-object>
Additional attributes for the fo:instream-foreign-object tag in addition to content-type can resize the image: Specify in pixels as follows:

<fo:instream-foreign-object content type="image/jpg" height="300 px" width="4 px">

... or in centimeters:
<fo:instream-foreign-object content type="image/jpg" height="3 cm" width="4 cm">
... or as a percentage of the original dimensions:
<fo:instream-foreign-object content type="image/jpg" height="300%" width="300%"> ...

SQL Field Search

$
0
0
This is a Query to find references to a particular field.  Just replace the bind variables.  Use your imagination in modifying this query to find Profile attributes.  The objects searched for are those relevant to most Implementations and do not search more specialized features (such as tree applets for instance).  If those features are used, you will need to add another Union to the query.  Also, because of the limitations in searching Oracle LONG data types, this query does not search Script.  I keep a minimized repository search window open in my Tools session with all the script objects selected so that I can quickly drag the window up and paste in what I am searching for.

var :attr_val = "CMI Failure Id";             -- Field Name or string to search for

var :buscomp = "CMI Quote Simple";    -- Business Component of the relevant object if applicable
var :wc = "Y";                                            -- Trailing Wildcard.  N indicates an exact match

select attr_type, obj_name, attr_name, attr_val from (
select 'Applet List Column' attr_type, a.name obj_name, lc.name attr_name, lc.field_name attr_val from siebel.s_list_column lc, siebel.s_list l, siebel.s_applet a, siebel.s_repository r
where lc.field_name like :attr_val||decode(:wc,'Y','%','') and lc.list_id = l.row_id and l.applet_id = a.row_id and a.repository_id = r.row_id and r.name = 'Siebel Repository' and lc.inactive_flg = 'N' and a.inactive_flg = 'N' and a.BUSCOMP_NAME = :buscomp

union all

select 'Applet Control' attr_type, a.name obj_name, c.name attr_name, c.field_name attr_val from siebel.s_control c, siebel.s_applet a, siebel.s_repository r
where c.field_name like :attr_val||decode(:wc,'Y','%','') and c.applet_id = a.row_id and a.repository_id = r.row_id and r.name = 'Siebel Repository' and c.inactive_flg = 'N' and a.inactive_flg = 'N' and a.BUSCOMP_NAME = :buscomp

union all

select 'Applet User Prop' attr_type, a.name obj_name, up.name attr_name, up.Value attr_val from siebel.S_APPLET_UPROP up, siebel.s_applet a, siebel.s_repository r
where up.Value like '%'||:attr_val||'%' and up.applet_id = a.row_id and a.repository_id = r.row_id and r.name = 'Siebel Repository' and up.inactive_flg = 'N' and a.inactive_flg = 'N' and a.BUSCOMP_NAME = :buscomp

union all

select 'Applet Toggle' attr_type, a.name obj_name, t.name attr_name, t.AUTO_TOG_FLD_NAME attr_val from siebel.S_APPLET_TOGGLE t, siebel.s_applet a, siebel.s_repository r
where t.AUTO_TOG_FLD_NAME like :attr_val||decode(:wc,'Y','%','') and t.applet_id = a.row_id and a.repository_id = r.row_id and r.name = 'Siebel Repository' and a.inactive_flg = 'N' and t.inactive_flg = 'N' and a.BUSCOMP_NAME = :buscomp

union all

select 'Applet Drilldown - Source' attr_type, a.name obj_name, d.name attr_name, d.SRC_FIELD_NAME attr_val from siebel.S_DDOWN_OBJECT d, siebel.s_applet a, siebel.s_repository r
where d.SRC_FIELD_NAME like :attr_val||decode(:wc,'Y','%','') and d.applet_id = a.row_id and a.repository_id = r.row_id and r.name = 'Siebel Repository' and d.inactive_flg = 'N' and a.inactive_flg = 'N' and a.BUSCOMP_NAME = :buscomp

union all

select 'Applet Dynamic Drilldown' attr_type, a.name obj_name, d.name attr_name, dd.FIELD_NAME attr_val from siebel.S_DDOWN_DYNDEST dd, siebel.S_DDOWN_OBJECT d, siebel.s_applet a, siebel.s_repository r
where dd.FIELD_NAME like :attr_val||decode(:wc,'Y','%','') and dd.DDOWN_OBJECT_ID = d.row_id
and d.applet_id = a.row_id and a.repository_id = r.row_id and r.name = 'Siebel Repository'
and dd.inactive_flg = 'N' and d.inactive_flg = 'N' and a.inactive_flg = 'N' and a.BUSCOMP_NAME = :buscomp

union all

select 'Join Spec' attr_type, bc.name obj_name, j.name attr_name, js.SRC_FLD_NAME attr_val from siebel.S_JOIN_SPEC js, siebel.S_JOIN j, siebel.s_buscomp bc, siebel.s_repository r
where js.SRC_FLD_NAME like :attr_val||decode(:wc,'Y','%','') and js.JOIN_ID = j.row_id and j.BUSCOMP_ID = bc.row_id and bc.repository_id = r.row_id and r.name = 'Siebel Repository' and j.inactive_flg = 'N' and bc.name = :buscomp

union all

select 'Predefault - Same' attr_type, bc.name obj_name, f.name attr_name, f.PREDEFVAL attr_val from siebel.s_field f, siebel.s_buscomp bc, siebel.s_repository r
where f.PREDEFVAL like '%'||:attr_val||'%' and f.BUSCOMP_ID = bc.row_id and bc.repository_id = r.row_id and r.name = 'Siebel Repository' and f.inactive_flg = 'N' and bc.name = :buscomp

union all

select 'Predefault - Other' attr_type, bc.name obj_name, f.name attr_name, f.PREDEFVAL attr_val from siebel.s_field f, siebel.s_buscomp bc, siebel.s_repository r
where f.PREDEFVAL like '%'||:buscomp||'.'||:attr_val||'%' and f.BUSCOMP_ID = bc.row_id and bc.repository_id = r.row_id and r.name = 'Siebel Repository' and f.inactive_flg = 'N'

union all

select 'Calculated Field - Same' attr_type, bc.name obj_name, f.name attr_name, f.CALCVAL attr_val from siebel.s_field f, siebel.s_buscomp bc, siebel.s_repository r
where f.CALCVAL like '%'||:attr_val||'%' and f.BUSCOMP_ID = bc.row_id and bc.repository_id = r.row_id and r.name = 'Siebel Repository' and f.inactive_flg = 'N' and bc.name = :buscomp

union all

select 'Calculated Field - Other' attr_type, bc.name obj_name, f.name attr_name, f.CALCVAL attr_val from siebel.s_field f, siebel.s_buscomp bc, siebel.s_repository r
where f.CALCVAL like '%ParentFieldValue%'||:attr_val||'%' and f.BUSCOMP_ID = bc.row_id and bc.repository_id = r.row_id and r.name = 'Siebel Repository' and f.inactive_flg = 'N'

union all

select 'BC User Prop' attr_type, bc.name obj_name, up.name attr_name, up.VALUE attr_val from siebel.S_BUSCOMP_UPROP up, siebel.s_buscomp bc, siebel.s_repository r
where up.VALUE like '%'||:attr_val||'%' and up.BUSCOMP_ID = bc.row_id and bc.repository_id = r.row_id and r.name = 'Siebel Repository' and up.inactive_flg = 'N' and bc.name = :buscomp

union all

select 'BC User Prop' attr_type, bc.name obj_name, up.name attr_name, up.VALUE attr_val from siebel.S_BUSCOMP_UPROP up, siebel.s_buscomp bc, siebel.s_repository r
where up.NAME like '%'||:attr_val||decode(:wc,'Y','%','') and up.BUSCOMP_ID = bc.row_id and bc.repository_id = r.row_id and r.name = 'Siebel Repository' and up.inactive_flg = 'N' and bc.name = :buscomp

union all

select 'BC User Prop - Child' attr_type, bc.name obj_name, up.name attr_name, up.VALUE attr_val from siebel.S_BUSCOMP_UPROP up, siebel.s_buscomp bc, siebel.s_repository r
where up.NAME like 'Parent%' and up.VALUE like '%'||:buscomp||'%'||:attr_val||'%' and up.BUSCOMP_ID = bc.row_id and bc.repository_id = r.row_id and r.name = 'Siebel Repository' and up.inactive_flg = 'N' and bc.name <> :buscomp

union all

select 'BC User Prop - Child' attr_type, bc.name obj_name, up.name attr_name, up.VALUE attr_val from siebel.S_BUSCOMP_UPROP up, siebel.s_buscomp bc, siebel.s_repository r
where up.NAME like 'Parent%'||:buscomp and up.VALUE like :attr_val||decode(:wc,'Y','%','') and up.BUSCOMP_ID = bc.row_id and bc.repository_id = r.row_id and r.name = 'Siebel Repository' and up.inactive_flg = 'N' and bc.name <> :buscomp

union all

select 'Pick Map - Same' attr_type, bc.name obj_name, f.name attr_name, pm.NAME attr_val from siebel.s_pickmap pm, siebel.s_field f, siebel.s_buscomp bc, siebel.s_repository r
where pm.FIELD_NAME like :attr_val||decode(:wc,'Y','%','') and pm.FIELD_ID = f.row_id and f.BUSCOMP_ID = bc.row_id and bc.repository_id = r.row_id and r.name = 'Siebel Repository' and f.inactive_flg = 'N' and pm.inactive_flg = 'N' and bc.name = :buscomp

union all

select 'Pick Map - Other' attr_type, bc.name obj_name, f.name attr_name, pm.NAME attr_val from siebel.s_pickmap pm, siebel.s_field f, siebel.s_buscomp bc, siebel.s_repository r, siebel.S_PICKLIST pl
where pm.PICK_FIELD_NAME like :attr_val||decode(:wc,'Y','%','') and pm.FIELD_ID = f.row_id and f.BUSCOMP_ID = bc.row_id and bc.repository_id = r.row_id and r.name = 'Siebel Repository' and r.row_id = pl.repository_id
and f.inactive_flg = 'N' and pm.inactive_flg = 'N' and f.PICKLIST_NAME = pl.name and pl.BUSCOMP_NAME = :buscomp

union all

select 'MVL Primary Id Field' attr_type, bc.name obj_name, mvl.name attr_name, mvl.PRIMEID_FLD_NAME attr_val from siebel.S_MVLINK mvl, siebel.s_buscomp bc, siebel.s_repository r
where mvl.PRIMEID_FLD_NAME like :attr_val||decode(:wc,'Y','%','') and mvl.BUSCOMP_ID = bc.row_id and bc.repository_id = r.row_id and r.name = 'Siebel Repository' and mvl.inactive_flg = 'N' and bc.name = :buscomp

union all

select 'MVL Source Id Field' attr_type, bc.name obj_name, mvl.name attr_name, mvl.SRC_FLD_NAME attr_val from siebel.S_MVLINK mvl, siebel.s_buscomp bc, siebel.s_repository r
where mvl.SRC_FLD_NAME like :attr_val||decode(:wc,'Y','%','') and mvl.BUSCOMP_ID = bc.row_id and bc.repository_id = r.row_id and r.name = 'Siebel Repository' and mvl.inactive_flg = 'N' and bc.name = :buscomp

union all

select 'MVF Destination Field' attr_type, bc.name obj_name, f.name attr_name, mvl.DEST_BC_NAME||'.'||f.DEST_FLD_NAME attr_val from siebel.s_field f, siebel.s_buscomp bc, siebel.s_repository r, siebel.S_MVLINK mvl
where f.DEST_FLD_NAME like :attr_val||decode(:wc,'Y','%','') and f.BUSCOMP_ID = bc.row_id and mvl.NAME = f.MVLINK_NAME and mvl.BUSCOMP_ID = bc.row_id and mvl.DEST_BC_NAME = :buscomp
and bc.repository_id = r.row_id and r.name = 'Siebel Repository' and f.inactive_flg = 'N'

union all

select 'Link - Destination' attr_type, l.name obj_name, '' attr_name, l.DST_FLD_NAME attr_val from siebel.s_link l, siebel.s_repository r
where l.DST_FLD_NAME like :attr_val||decode(:wc,'Y','%','') and l.CHILD_BC_NAME = :buscomp and l.repository_id = r.row_id and r.name = 'Siebel Repository' and l.inactive_flg = 'N'

union all

select 'Link - Search Spec' attr_type, l.name obj_name, '' attr_name, l.SRCHSPEC attr_val from siebel.s_link l, siebel.s_repository r
where l.SRCHSPEC like '%'||:attr_val||decode(:wc,'Y','%',']%') and l.CHILD_BC_NAME = :buscomp and l.repository_id = r.row_id and r.name = 'Siebel Repository' and l.inactive_flg = 'N'

union all

select 'Applet - Search Spec' attr_type, a.name obj_name, '' attr_name, a.SRCHSPEC attr_val from siebel.s_applet a, siebel.s_repository r
where a.SRCHSPEC like '%'||:attr_val||decode(:wc,'Y','%',']%') and a.BUSCOMP_NAME = :buscomp and a.repository_id = r.row_id and r.name = 'Siebel Repository' and a.inactive_flg = 'N'

union all

select 'Picklist - Search Spec' attr_type, p.name obj_name, '' attr_name, p.SRCHSPEC attr_val from siebel.S_PICKLIST p, siebel.s_repository r
where p.SRCHSPEC like '%'||:attr_val||decode(:wc,'Y','%',']%') and p.BUSCOMP_NAME = :buscomp and p.repository_id = r.row_id and r.name = 'Siebel Repository' and p.inactive_flg = 'N'

union all

select 'Bus Comp - Search Spec' attr_type, bc.name obj_name, '' attr_name, bc.SRCHSPEC attr_val from siebel.s_buscomp bc, siebel.s_repository r
where bc.SRCHSPEC like '%'||:attr_val||decode(:wc,'Y','%',']%') and bc.NAME = :buscomp and bc.repository_id = r.row_id and r.name = 'Siebel Repository' and bc.inactive_flg = 'N'

union all

select 'Action Set - Conditional Expression' attr_type, cas.name obj_name, ca.name attr_name, ca.COND_EXPR attr_val from siebel.S_CT_EVENT rt, siebel.s_ct_action ca, siebel.s_ct_action_set cas
where rt.CT_ACTN_SET_ID = cas.row_id and ca.CT_ACTN_SET_ID = cas.row_id and ca.COND_EXPR like '%'||:attr_val||decode(:wc,'Y','%',']%') and rt.OBJ_NAME = :buscomp and rt.OBJ_TYPE_CD = 'BusComp'

union all

select 'Action Set - Attribute Set' attr_type, cas.name obj_name, ca.name attr_name, ca.SET_RHS_EXPR attr_val from siebel.S_CT_EVENT rt, siebel.s_ct_action ca, siebel.s_ct_action_set cas
where rt.CT_ACTN_SET_ID = cas.row_id and ca.CT_ACTN_SET_ID = cas.row_id and ca.SET_RHS_EXPR like decode(:wc,'Y','%','%[')||:attr_val||decode(:wc,'Y','%',']%') and rt.OBJ_NAME = :buscomp and rt.OBJ_TYPE_CD = 'BusComp'

union all

select 'Run Time Event - Conditional Expression' attr_type, rt.OBJ_NAME obj_name, rt.EVT_NAME attr_name, rt.ACTN_COND_EXPR attr_val from siebel.S_CT_EVENT rt
where rt.ACTN_COND_EXPR like decode(:wc,'Y','%','%[')||:attr_val||decode(:wc,'Y','%',']%') and rt.OBJ_NAME = :buscomp and rt.OBJ_TYPE_CD = 'BusComp'

union all

select 'Run Time Event - Sub Event' attr_type, rt.OBJ_NAME obj_name, rt.EVT_NAME attr_name, rt.EVT_SUB_NAME attr_val from siebel.S_CT_EVENT rt
where rt.EVT_SUB_NAME like :attr_val||decode(:wc,'Y','%','') and rt.OBJ_NAME = :buscomp and rt.OBJ_TYPE_CD = 'BusComp'

union all

select 'Integration Component Field' attr_type, io.name obj_name, ic.name attr_name, icf.NAME attr_val from siebel.S_INT_FIELD icf, siebel.S_INT_COMP ic, siebel.S_INT_OBJ io, siebel.s_repository r
where icf.EXT_NAME like :attr_val||decode(:wc,'Y','%','') and icf.INT_COMP_ID = ic.row_id and ic.INT_OBJ_ID = io.row_id and io.repository_id = r.row_id and r.name = 'Siebel Repository'
and io.inactive_flg = 'N' and ic.inactive_flg = 'N' and icf.inactive_flg = 'N' and ic.EXT_NAME = :buscomp

union all

select 'Data Maps - Source Fields' attr_type, o.name obj_name, C.name attr_name, f.src_fld_name attr_val from siebel.S_FIELD_DMAP F, siebel.S_BUSCOMP_DMAP C, siebel.S_BUSOBJ_DMAP O
where C.BUSOBJ_DMAP_ID = O.row_id and F.BUSCOMP_DMAP_ID = C.row_id and F.SRC_FLD_NAME like '%'||:attr_val||'%' and c.SRC_BUSCOMP_NAME = :buscomp

union all

select 'Data Maps - Destination Fields' attr_type, o.name obj_name, C.name attr_name, f.DST_FLD_NAME attr_val from siebel.S_FIELD_DMAP F, siebel.S_BUSCOMP_DMAP C, siebel.S_BUSOBJ_DMAP O
where C.BUSOBJ_DMAP_ID = O.row_id and F.BUSCOMP_DMAP_ID = C.row_id and F.DST_FLD_NAME like :attr_val||decode(:wc,'Y','%','') and c.DST_BUSCOMP_NAME = :buscomp

union all

select 'WF Branch Criteria - Field' attr_type, wf.name obj_name, s.name attr_name, b.name attr_val from siebel.S_WFR_COND_CRIT cc, siebel.S_WFR_STP_BRNCH b, siebel.S_WFR_STP s, siebel.S_WFR_PROC wf, siebel.s_repository r
where cc.BUSCOMP_FLD_NAME like :attr_val||decode(:wc,'Y','%','') and cc.BRANCH_ID = b.row_id and b.STEP_ID = s.row_id and s.PROCESS_ID = wf.row_id and wf.repository_id = r.row_id and r.name = 'Siebel Repository'
and wf.STATUS_CD = 'COMPLETED' and cc.BUSCOMP_NAME = :buscomp

union all

select 'WF Branch Criteria - Expression' attr_type, wf.name obj_name, s.name attr_name, b.name attr_val from siebel.S_WFR_COND_VAL cv, siebel.S_WFR_COND_CRIT cc, siebel.S_WFR_STP_BRNCH b, siebel.S_WFR_STP s, siebel.S_WFR_PROC wf, siebel.s_repository r
where cv.LO_CHAR5 like decode(:wc,'Y','%','%[')||:attr_val||decode(:wc,'Y','%',']%') and cv.COND_CRIT_ID = cc.row_id and cc.BRANCH_ID = b.row_id and b.STEP_ID = s.row_id and s.PROCESS_ID = wf.row_id and wf.repository_id = r.row_id and r.name = 'Siebel Repository'
and wf.STATUS_CD = 'COMPLETED' and cc.BUSCOMP_NAME = :buscomp

union all

select 'WF Branch Step - Argument' attr_type, wf.name obj_name, s.name attr_name, a.name attr_val from siebel.S_WFR_STP_ARG a, siebel.S_WFR_STP s, siebel.S_WFR_PROC wf, siebel.s_repository r
where a.BUSCOMP_FLD_NAME like :attr_val||decode(:wc,'Y','%','') and a.STEP_ID = s.row_id and s.PROCESS_ID = wf.row_id and wf.repository_id = r.row_id and r.name = 'Siebel Repository'
and wf.STATUS_CD = 'COMPLETED' and a.BUSCOMP_NAME = :buscomp

union all

select 'DVM - Rule' attr_type, rs.name obj_name, r.name attr_name, r.RULE_EXPR attr_val from siebel.S_VALDN_RULE R, siebel.S_VALDN_RL_SET RS
where R.RULE_SET_ID = rs.row_id and r.RULE_EXPR like decode(:wc,'Y','%','%[')||:attr_val||decode(:wc,'Y','%',']%') and r.BUSCOMP_NAME = :buscomp and rs.status_cd = 'Active'
);

SQL Applet Search

$
0
0
Here is the SQL to find Applet References.  You will notice there are two queries of Toggle Applets.  One rolls an applet all the way up to the view it appears in while the other shows toggle applets that do not appear in any view.  Therefore, in a toggle sequence, there may be one applet that appears twice.  The wc or wildcard bind variable adds a trailing wildcard

var :applet = "CMI Quote Form Applet - Readonly Excpt Status - Service";     -- Applet Name
var :wc = "N";                               

select attr_type, screen, viewname, obj_name, attr_name from (
select 'View web template item' attr_type, s.name screen, v.name viewname, '' obj_name, vwti.APPLET_NAME attr_name from siebel.s_screen s, siebel.S_SCREEN_VIEW sv, siebel.S_VIEW_WTMPL_IT vwti, siebel.S_VIEW_WEB_TMPL vwt, siebel.s_view v, siebel.s_repository r
where vwti.APPLET_NAME like :applet||decode(:wc,'Y','%','') and vwti.VIEW_WEB_TMPL_ID = vwt.row_id and vwt.VIEW_ID = v.row_id and v.name = sv.VIEW_NAME and sv.SCREEN_ID = s.row_id and s.repository_id = r.row_id
and v.repository_id = r.row_id and r.name = 'Siebel Repository' and vwti.inactive_flg = 'N' and vwt.inactive_flg = 'N' and sv.inactive_flg = 'N' and v.inactive_flg = 'N'

union all

select 'Form Applet Pick Applet' attr_type, '' screen, '' viewname, a.name obj_name, c.PICK_APPLET_NAME attr_name from siebel.s_control c, siebel.s_applet a, siebel.s_repository r
where c.PICK_APPLET_NAME like :applet||decode(:wc,'Y','%','') and c.applet_id = a.row_id and a.repository_id = r.row_id and r.name = 'Siebel Repository' and c.inactive_flg = 'N' and a.inactive_flg = 'N'

union all

select 'Form Applet MVG Applet' attr_type, '' screen, '' viewname, a.name obj_name, c.MVG_APPLET_NAME attr_name from siebel.s_control c, siebel.s_applet a, siebel.s_repository r
where c.MVG_APPLET_NAME like :applet||decode(:wc,'Y','%','') and c.applet_id = a.row_id and a.repository_id = r.row_id and r.name = 'Siebel Repository' and c.inactive_flg = 'N' and a.inactive_flg = 'N'

union all

select 'List Applet Pick Applet' attr_type, '' screen, '' viewname, a.name obj_name, lc.PICK_APPLET_NAME attr_name from siebel.s_list_column lc, siebel.s_list l, siebel.s_applet a, siebel.s_repository r
where lc.PICK_APPLET_NAME like :applet||decode(:wc,'Y','%','') and lc.list_id = l.row_id and l.applet_id = a.row_id and a.repository_id = r.row_id and r.name = 'Siebel Repository' and lc.inactive_flg = 'N' and a.inactive_flg = 'N'

union all

select 'List Applet MVG Applet' attr_type, '' screen, '' viewname, a.name obj_name, lc.MVG_APPLET_NAME attr_name from siebel.s_list_column lc, siebel.s_list l, siebel.s_applet a, siebel.s_repository r
where lc.MVG_APPLET_NAME like :applet||decode(:wc,'Y','%','') and lc.list_id = l.row_id and l.applet_id = a.row_id and a.repository_id = r.row_id and r.name = 'Siebel Repository' and lc.inactive_flg = 'N' and a.inactive_flg = 'N'

union all

select 'Associate Applet' attr_type, '' screen, '' viewname, a.name obj_name, a.ASSOC_APPLET_NAME attr_name from siebel.s_applet a, siebel.s_repository r
where a.ASSOC_APPLET_NAME like :applet||decode(:wc,'Y','%','') and a.repository_id = r.row_id and r.name = 'Siebel Repository' and a.inactive_flg = 'N'

union all

select 'Applet Toggle' attr_type, '' screen, '' viewname, a.name obj_name, t.APPLET_NAME attr_name from siebel.S_APPLET_TOGGLE t, siebel.s_applet a, siebel.s_repository r
where t.APPLET_NAME like :applet||decode(:wc,'Y','%','') and t.applet_id = a.row_id and a.repository_id = r.row_id and r.name = 'Siebel Repository' and t.inactive_flg = 'N' and a.inactive_flg = 'N'

union all

select 'Applet Toggle' attr_type, s.name screen, v.name viewname, a.name obj_name, t.APPLET_NAME attr_name from siebel.s_screen s, siebel.S_SCREEN_VIEW sv, siebel.S_VIEW_WTMPL_IT vwti, siebel.S_VIEW_WEB_TMPL vwt, siebel.s_view v, siebel.S_APPLET_TOGGLE t, siebel.s_applet a, siebel.s_repository r
where t.APPLET_NAME like :applet||decode(:wc,'Y','%','') and vwti.APPLET_NAME = a.name and vwti.VIEW_WEB_TMPL_ID = vwt.row_id and vwt.VIEW_ID = v.row_id and v.name = sv.VIEW_NAME and sv.SCREEN_ID = s.row_id and t.applet_id = a.row_id
and a.repository_id = r.row_id and v.repository_id = r.row_id and s.repository_id = r.row_id and r.name = 'Siebel Repository'
and t.inactive_flg = 'N' and a.inactive_flg = 'N' and vwti.inactive_flg = 'N' and vwt.inactive_flg = 'N' and sv.inactive_flg = 'N' and v.inactive_flg = 'N'
)

Repository Search by SQL

$
0
0
Tools offers a Repository Search feature which is quite robust but it has some significant drawbacks:
  1. Tedious to specify only those items which might have the object name you are looking for
  2. Time consuming to do a full search or a search of certain objects with high record counts
  3. Does not search UI admin objects where a field might be referenced
There have been times when I wanted to inactivate objects in order to streamline the application and have had difficulty identifying all the references.  Or if you see an error in the Siebel log, it is sometimes hard to forensically determine its source.

I have written a series of SQL statements to search for the items directly against the server tools DB.  This SQL looks at both repository tables where a particular object type might be referenced as well as UI administrative objects.  It is not guaranteed to be 100% comprehensive and should be modified to the particular needs of how a client has used the application.  For instance, if Variable Maps are not modified from vanilla, it is probably not necessary to query the tables that store them.

Fields
Applets

Miscellaneous SQL Repository Research

$
0
0
I frequently use SQL to track down potential issues in the repository.  Here are a couple of statements that help solve common problems:

Fields Inactivated in the BC but Active in the Integration Object

select io.name int_obj, ic.name int_comp, icf.NAME int_field from siebel.S_INT_FIELD icf, siebel.S_INT_COMP ic, siebel.S_INT_OBJ io, siebel.s_repository r, siebel.s_buscomp bc, siebel.s_field f
where icf.INT_COMP_ID = ic.row_id and ic.INT_OBJ_ID = io.row_id and io.repository_id = r.row_id and r.name = 'Siebel Repository'
and ic.EXT_NAME = bc.name and icf.EXT_NAME = f.name and f.buscomp_id = bc.row_id and bc.repository_id = r.row_id and f.inactive_flg = 'Y'
and io.inactive_flg = 'N' and ic.inactive_flg = 'N' and icf.inactive_flg = 'N' and f.last_upd > to_date('11/01/2012', 'MM/DD/YYYY');  

 Identify potential causes of the Truncation or Null Fetch error

This can sometimes be caused by not compiling the Table object too.  The first query finds business component joined fields where the BC field length or data type does not match the column length.  The second does the same but only analyzes base table columns and adds a last updated parameter which could be added or removed from either.  The last updated date is useful because vanilla actually has numerous instances of this potential problem.  I say potential because any records returned need to be checked against the data.  The error will only occur if the data in the column is longer than the BC length specified.  The Third query is an example of how to check assuming for instance S_ORDER_ITEM.ATTRIB_40 is mapped to a DTYPE_ID BC field..  

select bc.name Bus_comp, f.name field, f.join_name Join, j.DEST_TBL_NAME Tbl_name, f.col_name Col_name, f.type Field_Type, f.textlen Fld_Lgth, c.DATA_TYPE Col_type, c.LENGTH col_lgth
from siebel.s_field f, siebel.s_repository r, siebel.s_join j, siebel.s_buscomp bc, siebel.s_column c, siebel.s_table t
where bc.REPOSITORY_ID = r.row_id and r.name = 'Siebel Repository'
and bc.row_id = f.buscomp_id and j.name = f.join_name and j.buscomp_id = bc.row_id
and c.TBL_ID = t.row_id and t.NAME = j.DEST_TBL_NAME and c.name = f.col_name
and r.row_id = t.REPOSITORY_ID and r.row_id = f.REPOSITORY_ID and r.row_id = c.REPOSITORY_ID
and t.INACTIVE_FLG = 'N' and c.INACTIVE_FLG = 'N' and bc.INACTIVE_FLG = 'N' and f.INACTIVE_FLG = 'N'
and ((f.type = 'DTYPE_ID' and c.length > 15)
or (f.type = 'DTYPE_PHONE' and c.length > 40)
or (f.type = 'DTYPE_BOOL' and c.length > 1)
or (f.type = 'DTYPE_TEXT' and c.DATA_TYPE like 'Date%'))
order by j.DEST_TBL_NAME, f.col_name;  

select bc.name Bus_comp, f.name field, t.NAME tbl_name, f.col_name Col_name, f.type Field_Type, f.textlen Fld_Lgth, c.DATA_TYPE Col_type, c.LENGTH col_lgth
from siebel.s_field f, siebel.s_repository r, siebel.s_buscomp bc, siebel.s_column c, siebel.s_table t
where bc.REPOSITORY_ID = r.row_id and r.name = 'Siebel Repository'
and bc.row_id = f.buscomp_id
and c.TBL_ID = t.row_id and t.NAME = bc.TABLE_NAME and c.name = f.col_name
and r.row_id = t.REPOSITORY_ID and r.row_id = f.REPOSITORY_ID and r.row_id = c.REPOSITORY_ID
and t.INACTIVE_FLG = 'N' and c.INACTIVE_FLG = 'N' and bc.INACTIVE_FLG = 'N' and f.INACTIVE_FLG = 'N'
and ((f.type = 'DTYPE_ID' and c.length > 15)
or (f.type = 'DTYPE_PHONE' and c.length > 40)
or (f.type = 'DTYPE_BOOL' and c.length > 1)
or (f.type = 'DTYPE_TEXT' and c.DATA_TYPE like 'Date%'))
and f.last_upd > to_date('06/01/2010', 'MM/DD/YYYY')
order by t.NAME, f.col_name;  

select ATTRIB_40 from siebel.S_ORDER_ITEM_XM where length(ATTRIB_40) > 15;

State of Logging - An Introduction

$
0
0
I was reading Jason Le's recent post about XML Logging and I realized the problem statement he was describing was intimately familiar to me because it is something I have been dealing with over the years and have evolved a solution for it.  I say evolved because it has gone though so many iterations by this point I am not sure where to begin.  So let me start with a verbal explanation, and then I will get into the details.

I built an eScript Logging Service back in the day to help with tracing processing through custom script.  This was written out to a text file in the file system.  I don't recall the sequence of events after that but at some point I added an XML logging utility to this so that the XML files would be written to the file system as well. This was initially an explicit call to a business service within the integration WF to pass an XML Property Set  so it could be written out.  I then moved to a client which was using a business service to create custom SOAP headers so I modified the logging service so that it could be called as a custom filtering service itself.  This allowed the exact payload to be captured as it was leaving/returning to the Siebel application.

At some point I ended up on a client that had UNIX Application servers, needed me to do production support post go-live AND was very restrictive about granting access to the production file system.  Rather than deal with the UNIX and access issues, I opted to modify the service so it could operate in two modes.  When using a thick client, it would continue to write all information out to the local file system as defined by the SIEBEL_LOG_DIR environment variable.  But I allowed thin client users to output logging data to a new set of custom tables.  Basically when a user logs in, a session record is created.  All escript logging data is written out to a 1:M detail table in buffered chunks to minimize performance hits.  XML Logging does the same (though in a slightly different way).  Each detail record has the opportunity to store a row id which allows a session to be linked to a particular record that was logged, like an Order Id.  This allows for audit views to be created which show all the user sessions with logging information tied to a particular record.

The other problem I needed to solve was that when an error occurs, Siebel rolls back transactions.  Therefore all interfaces use the EAI Transaction Service and I have modified this service to set a flag so that when in a transaction, all XML payloads are stored in memory until the transaction is either aborted or committed, at which point all the messages are written to the DB in the order they were executed.

To view logging information, whether XML or escript, requires the many detail records to be reassembled into a viewable format.  There is a method of the service that basically just queries all the detail records for a particular session or XML Payload and concatenates the text into a single value.  This method can be invoked from a calculated field and the calculated field exposed on a form applet.  Because form applet fields are not the best way to see the data, I typically copy the data out of the field and into a text editor of choice.  For instance I use Notepad++  with a Pretty Print add on to view XML payloads.

It will take several posts to go over the implementation in detail, but hopefully this whets people's appetites

Next: The XML Logger

The XML Logger

$
0
0
In my last post, I promised to try to bring us up to date on the current implementation of the logging framework, and specifically the XML Logger component of it.  The framework is initialized on the Application Start event making all these methods available from script.  From an XML Logging perspective, it can be initiated in one of two ways:

  • As a standard business service from within the Integration WF (or business service).  In this approach, just before the outbound WS or HTTP call, you would call the logRequest or logResponse methods of the framework business service, passing in at a minimum the property set about to be interfaced.  There are many other attributes of the payload record which can be optionally used which I won't go into detail over.  You can always add attributes to meet your needs and you don't need to populate any of them really.
  • As a Filter Service.  This is used for Web Services and is useful in that it can be turned on or off without modifying any existing Integration WFs.  On the Web Service admin views, for each web service operation that you want to log, just specify the Request/Response Filter Service as the Framework business service and the Request/Response Filter Method as logRequest/logResponse respectively.

Ok, now for the nitty gritty.  What do the logRequest/logResponse methods do?  Both are similar and different only in that all interface logging records have a placeholder for a request and a response payload, which the two methods are differentiated to populate.  The main input to these methods is an XML payload.  At a high level, here is the algorithm:
  1. Navigate the property set until the first 'ListOf*' tag is found which is assumed to be the beginning of the Integration Object data.
  2. Call a method to Parse the remaining child data to correctly name and categorize the interface based on the IO Type and iddentify the record id and unique identifier attributes.  This allows for optional scripting to tailor the logging service to your client's unique needs
  3. Call the logInterface method which:
    1. Checks if in an EAI Transaction.  If so, add the payload to an array, otherwise continue (This is currently only implemented to support outbound interfaces when using the Filter service implementation)
    2. Creates a session record if one does not already exist (Inbound interfaces executed by an EAI OM typically)
    3. Deal with anonymous logins (when used on an inbound interface the request method will be executed under the Anonymous login but the response method with be performed by the interface user id)
    4. Creates a payload record to store the attributes extracted from the payload parsing
    5. Split the payload into chunks no larger than the BLOB length and create detail records for each chunk
First the logRequest and logResponse Methods.  Like I said they are very similar except for which field the payload is passed to.  Also the logResponse method has some additional logic for parsing SOAP faults.

function logRequest(Inputs,Outputs) {
/* ***********************************
Created by Mik Branchaud on 09/20/11
Purpose: Log interface request from/to an external interface in the session log
Usage: In Web Service definition, operations applet, set the Request Filter BS to 'CMI Utilities'
and the method to logRequest. Clear the cache
Arguments: 1 - SoapMessage will implicily be passed as a child property set
**************************************** */
try {
logStack("logRequest", 5);
var soapEnv, soapBody, divePS;
var bodyType="";
var msgType="";
var parseResults = new Object();
var key = TheApplication().Utility.TimeStamp();
var max = 3;
var dives = 0;

if(Inputs.GetChildCount() > 0) {
try { // Try to process the message to get functional data
// Get the SOAP envelope from the SOAP hierarchy
soapEnv = Inputs.GetChild(0); //Like env:Envelope
for (var i=0; i < soapEnv.GetChildCount(); i++) {
bodyType = soapEnv.GetChild(i).GetType(); //Like env:Body
if (bodyType.toUpperCase() == "BODY" || bodyType.substr(bodyType.indexOf(":")+1).toUpperCase() == "BODY") {
soapBody = soapEnv.GetChild(i);
for (var j=0; j < soapBody.GetChildCount(); j++) {
msgType = soapBody.GetChild(j).GetType(); //Full Port name of the WS
if (msgType.indexOf(":") >= 0) msgType = msgType.substr(msgType.indexOf(":")+1); //strip namespace
if (msgType.indexOf(" ") >= 0) msgType = msgType.substr(0, msgType.indexOf(" ")); //strip namespace declaration
if (msgType.indexOf("_") >= 0) msgType = msgType.substr(0, msgType.lastIndexOf("_"));//strip port operation

divePS = soapBody.GetChild(j); //.GetChild(0)
while (divePS.GetType().indexOf("ListOf") < 0 && dives <= max) {
if (divePS.GetChildCount() > 0) {
divePS = divePS.GetChild(0);
dives++;
} else dives = max + 1;
}

if (divePS.GetType().indexOf("ListOf") >= 0) parseInterface(divePS, parseResults);
else parseInterface(soapBody, parseResults);
}
break;
}
}
} catch(e) {
//If an error occurs while parsing, just try to write the message whole
}

if (msgType != "") {
msgType = msgType.replace(/_spc/g, "");
key = msgType+"_"+key;
}
TheApplication().SetProfileAttr("InterfaceKeyInbound", key)
logInterface(key, soapEnv, null, null, parseResults.recId, parseResults.recBC, "Pending", msgType, null, null, null, null, parseResults.ref1);
} // Inputs.GetChildCount()
Outputs.InsertChildAt(soapEnv,0);
} catch(e) {
RaiseError(e);
} finally {
divePS = null;
soapBody = null;
soapEnv = null;
parseResults = null;
logUnstack(msgType, 5);
}
}

function logResponse(Inputs,Outputs) {
/* ***********************************
Created by Mik Branchaud on 09/20/11
Purpose: Log interface response from/to an external interface in the session log
Usage: In Web Service definition, operations applet, set the Response Filter BS to 'CMI Utilities'
and the method to logResponse. Clear the cache
Arguments: 1 - SoapMessage will implicily be passed as a child property set
**************************************** */
try {
logStack("logResponse", 5);
//TheApplication().TraceOn("/opt/siebel81/siebsrvr/enterprises/SBA_81/edad669/log/XTrace-Resp-"+TheApplication().LoginName()+".log", "Allocation", "All");
var soapEnv, soapBody, divePS;
var bodyType="";
var msgType="";
var parseResults = new Object();
var fault=null;
var key = TheApplication().GetProfileAttr("InterfaceKeyInbound");
var max = 3;
var dives = 0;

if(Inputs.GetChildCount() > 0) {
try { // Try to process the message to get functional data
// Get the SOAP envelope from the SOAP hierarchy
soapEnv = Inputs.GetChild(0);
logVars("soapEnv Child Count", soapEnv.GetChildCount(), 5);
for (var i=0; i < soapEnv.GetChildCount(); i++) {
bodyType = soapEnv.GetChild(i).GetType();
logVars("soapEnv Child Type", bodyType, 5);
if (bodyType.toUpperCase() == "BODY" || bodyType.substr(bodyType.indexOf(":")+1).toUpperCase() == "BODY") {
soapBody = soapEnv.GetChild(i);
for (var j=0; j < soapBody.GetChildCount(); j++) {
msgType = soapBody.GetChild(j).GetType();
logVars("Body Child Type", msgType, 5);
if (msgType.indexOf(":") >= 0) msgType = msgType.substr(msgType.indexOf(":")+1)
if (msgType.indexOf(" ") >= 0) msgType = msgType.substr(0, msgType.indexOf(" "))
if (msgType.indexOf("_") >= 0) msgType = msgType.substr(0, msgType.lastIndexOf("_"))

if (msgType.toUpperCase() == "FAULT") fault = soapBody.GetChild(j).GetProperty("faultstring");
else {
divePS = soapBody.GetChild(j);
while (divePS.GetType().indexOf("ListOf") < 0 && dives <= max) {
logVars("Current Dive Type", divePS.GetType(), 5);
if (divePS.GetChildCount() > 0) {
divePS = divePS.GetChild(0);
dives++;
} else dives = max + 1;
}

if (divePS.GetType().indexOf("ListOf") >= 0) parseInterface(divePS, parseResults);
}
}
break;
}
}
} catch(e) {
//If an error occurs while parsing, just try to write the message whole
}

logVars("key", key, "Fault", fault, 5);
if (key == "") {
key = TheApplication().Utility.TimeStamp();
if (msgType != "") {
msgType = msgType.replace(/_spc/g, "");
key = msgType+"_"+key;
}
}

if (fault != null) {
logInterface(key, null, soapEnv, null, parseResults.recId, parseResults.recBC, "error", null, null, fault);
} else {
var recId = (parseResults.recId != "" ? parseResults.recId : null);
var recBC = (parseResults.recBC != "" ? parseResults.recBC : null);
var ref1 = (parseResults.ref1 != "" ? parseResults.ref1 : null);
logInterface(key, null, soapEnv, null, recId, recBC, "Complete", msgType, null, null, null, null, ref1);
}
} // Inputs.GetChildCount()
Outputs.InsertChildAt(soapEnv,0);
} catch(e) {
RaiseError(e);
} finally {
divePS = null;
soapBody = null;
soapEnv = null;
parseResults = null;
logUnstack(msgType, 5);
}
}

The parseInterface method passes the ListOf container of the Integration Object to a switch statement where each BC type can be evaluated.  This useful only when using the Filter Service triggering mechanism otherwise the Record Id and Interface Name attributes can just be explicitly passed as parameters.  A case section should be created for each Integration Object being processed.
function parseInterface(ListOfIC, oReturn) {    //Input ListOfIC is a ListOf...
//Called from logRequest and logResponse to parse a message and get the row id or reference ids of different
//objects
try {
logStack("parseInterface", 5);
if (ListOfIC.GetChildCount() > 0) {
var IC = ListOfIC.GetChild(0); //Integration Component Instance
var icNameSpace = "";
var intCompType = IC.GetType();
var propName;
var stop = false;
var childIC;
var childFlds;

if (intCompType.indexOf(":") >= 0) {
icNameSpace = intCompType.substr(0, intCompType.indexOf(":")+1);
intCompType = intCompType.substr(intCompType.indexOf(":")+1);
}
logVars("Integration Component", intCompType, "Namespace", icNameSpace, 5);

//For these types, dive an additional level
switch(intCompType) {
case "ATPCheckInterfaceRequestOrders":
IC = IC.GetChild(0);
intCompType = IC.GetType();
if (intCompType.indexOf(":") >= 0) {
icNameSpace = intCompType.substr(0, intCompType.indexOf(":")+1);
intCompType = intCompType.substr(intCompType.indexOf(":")+1);
}
logVars("Integration Component", intCompType, "Namespace", icNameSpace, 5);
break;
}

for (var flds = 0; flds < IC.GetChildCount(); flds++) { //Loop through Fields
propName = IC.GetChild(flds).GetType();
switch (intCompType) {
case "Quote":
case "SWIQuote":
oReturn.recBC = "Quote";
if (propName == icNameSpace+"Id") {
oReturn.recId = IC.GetChild(flds).GetValue();
stop = true;
}
break;

case "ProductIntegration":
oReturn.recBC = "Internal Product";
if (propName == icNameSpace+"ListOfProductDefinition") {
childIC = IC.GetChild(flds).GetChild(0);
for (childFlds = 0; childFlds < childIC.GetChildCount(); childFlds++) { //Loop through Fields
propName = childIC.GetChild(childFlds).GetType();
if (propName == icNameSpace+"Id" || propName == icNameSpace+"ProductId") {
oReturn.recId = childIC.GetChild(childFlds).GetValue();
stop = true;
}
if (stop) break;
}
}
break;

default:
logVars("Integration Component", intCompType, "Default", icNameSpace+"Id", 4);
if (propName.indexOf("Id") >= 0) {
oReturn.recId = IC.GetChild(flds).GetValue();
stop = true;
}
oReturn.recBC = intCompType;
stop = true;
}
if (stop) break;
}
}
} catch(e) {
RaiseError(e);
} finally {
childIC = null;
IC = null;
logUnstack("", 5);
}
}

The logInterface method is called by both logRequest and logResponse to manage the session records for inbound interfaces and create the actual payload record.  I will have to go into more detail about the Anonymous login processing at some other time.  Suffice to say this works under a variety of web service setups.
function logInterface(key, request, response, dir, recId, recBC, status, srcObject, name, logText, userText, retCode, ref1, ref2, ref3)
{
try {
logStack("logInterface", 5);
logVars("key", key, "Record Id", recId, "Record BC", recBC, "Global Session Row Id", gSessionId, "Hold Buffer", gHoldBuffer, "Guest Login", gsGuest, 5);

var found:Boolean = false;
var sessionId:String = "";
var guestSessionId:String = "";
var guestSessionFound = false;
var createSession = false;
var firstMessage = false;
var boSessionFlat;
var bcSessionXMLFlat;
var useGuestSession = (response != null && gsMergeGuestSessions=="TRUE" && gsGuest != "" ? true : false);
var boSession:BusObject = TheApplication().GetBusObject("CMI User Session");
var bcSession:BusComp;

if (gHoldBuffer) {
//If in a EAI Txn, store all payloads in an array so they can be written after the commit or rollback
gHoldPayloads[gHoldPayloads.length] = arguments;

} else if (gsTraceIntfaceReqResp == "TRUE" && key != "") {
//If an interface is being logged for the first time, need to instantiate the session
if (gSessionId == "") {
//If Guest connections are not used, a simplified session management can be used
if (gsGuest == "" && key != "") {
bcSession = boSession.GetBusComp("CMI User Session");
with (bcSession) {
NewRecord(NewBefore);
SetFieldValue("Employee Id",TheApplication().LoginId());
SetFieldValue("Session Stamp",gsLogSession);
WriteRecord();
gSessionId = GetFieldValue("Id");
}
createSession = false; //skip logic below to create/merge a guest session
firstMessage = true; //will always insert the input message rather than querying to update
//Reset the variable to check whether to merge the guest session. This allows a log buffer dump
gsMergeGuestSessions = "FALSE";
} else {
createSession = true;

//confirm that current session has not been created yet
bcSession = boSession.GetBusComp("CMI User Session");
with (bcSession) {
ClearToQuery();
SetSearchSpec("Session Stamp", gsLogSession);
ExecuteQuery(ForwardOnly);
found = FirstRecord();

if (found == true) {
gSessionId = GetFieldValue("Id");
createSession = false;
} else {
firstMessage = true;
}
}
}
}

logVars("CreateSession", createSession, "useGuestSession", useGuestSession, "First Message", firstMessage, 5);
if (createSession == true || useGuestSession == true) {
bcSession = boSession.GetBusComp("CMI User Session");

//Because EAI logins can trigger logging from the anonymous login, the response logging will trigger
//from a different session. Query for the most recent corresponding request log and update it
if (useGuestSession) {
boSessionFlat = TheApplication().GetBusObject("CMI User Session Flat");
bcSessionXMLFlat = boSessionFlat.GetBusComp("CMI User Session XML");
bcSessionXMLFlat.ActivateField("Parent Id");
bcSessionXMLFlat.ClearToQuery();
if (typeof(srcObject) != "undefined" && srcObject != null) bcSessionXMLFlat.SetSearchSpec("Source Object", srcObject);
if (typeof(ref1) != "undefined" && ref1 != null) bcSessionXMLFlat.SetSearchSpec("Reference Id 1", ref1);
bcSessionXMLFlat.SetSearchSpec("Response", "IS NULL");
bcSessionXMLFlat.SetSearchSpec("Employee Login", gsGuest);
bcSessionXMLFlat.SetSortSpec("Created (DESC)");
bcSessionXMLFlat.ExecuteQuery(ForwardBackward);
guestSessionFound = bcSessionXMLFlat.FirstRecord();

if (guestSessionFound == true) guestSessionId = bcSessionXMLFlat.GetFieldValue("Parent Id");
}

logVars("guestSessionFound", guestSessionFound, 5);
if (guestSessionFound == false && createSession == true) {
//Anonymous login session not found and there is no current session. Create a new one
with (bcSession) {
NewRecord(NewBefore);
SetFieldValue("Employee Id",TheApplication().LoginId());
SetFieldValue("Session Stamp",gsLogSession);
WriteRecord();
gSessionId = GetFieldValue("Id");
logVars("New Global Session Row Id", gSessionId, 5);
}
} else if (guestSessionFound == true && createSession == false) {
//Anonymous login session found and there is a current session.
//Link child records to the parent session for the Interface User and delete the guest session (faster than a merge)
while (guestSessionFound) {
bcSessionXMLFlat.SetFieldValue("Parent Id",gSessionId);
bcSessionXMLFlat.WriteRecord();
guestSessionFound = bcSessionXMLFlat.NextRecord();
}
with (bcSession) {
ClearToQuery();
SetSearchSpec("Id", guestSessionId);
SetSortSpec("");
ExecuteQuery(ForwardOnly);
guestSessionFound = FirstRecord();

if (guestSessionFound == true) DeleteRecord();
ClearToQuery();
SetSortSpec("");
SetSearchSpec("Id", gSessionId);
ExecuteQuery(ForwardOnly);
}
} else if (guestSessionFound == true && createSession == true) {
//Anonymous login session found and there is no current session. Update the guest session to EAI values
with (bcSession) {
ActivateField("Employee Id");
ActivateField("Session Stamp");
ClearToQuery();
SetSearchSpec("Id", guestSessionId);
SetSortSpec("");
ExecuteQuery(ForwardBackward);
found = FirstRecord();

if (found == true) {
SetFieldValue("Employee Id",TheApplication().LoginId());
SetFieldValue("Session Stamp",gsLogSession);
WriteRecord();
}
}
} else {
//Anonymous login session not found and there is a current session. Do Nothing
}

//Reset the variable to check whether to merge the guest session. This allows a log buffer dump
gsMergeGuestSessions = "FALSE";
}
var bcSessionXML = boSession.GetBusComp("CMI User Session XML");
var bcSessionXMLDtl = boSession.GetBusComp("CMI User Session XML Detail");

with (bcSessionXML) {
if (firstMessage) {
//This is an insert so no query needed to update an existing record
found = false;
} else if (useGuestSession && guestSessionFound) {
//If this is the first update after a guest session is used, the key will not match but there should only be one XML record
ClearToQuery();
SetSearchSpec("Created By Login", gsGuest);
SetSearchSpec("Parent Id", gSessionId);
SetSearchSpec("Request", "IS NOT NULL");
SetSearchSpec("Response", "IS NULL");
ExecuteQuery(ForwardBackward);
found = FirstRecord();
} else {
//This is a normal response update to an existing message record
ClearToQuery();
SetSearchSpec("Parent Id", gSessionId);
SetSearchSpec("Name", key);
SetSortSpec("");
ExecuteQuery(ForwardBackward);
found = FirstRecord();
}

if (found == false) {
NewRecord(NewBefore);
SetFieldValue("Name",key);
SetFieldValue("Parent Id",gSessionId);
logVars("XML Record Id", GetFieldValue("Id"), 5);
}

if (useGuestSession == true) SetFieldValue("Name", key.substring(0, 100));

if (typeof(request) != "undefined" && request != null) {
SetFieldValue("Request Time", TimeStamp("DateTimeFormatted"));
splitPayload(bcSessionXMLDtl, "Request", request, 131072)
}
if (typeof(response) != "undefined" && response != null) {
SetFieldValue("Response Time", TimeStamp("DateTimeFormatted"));
splitPayload(bcSessionXMLDtl, "Response", response, 131072)
}

// if (typeof(request) != "undefined" && request != null) trimPS(request, "Request", bcSessionXML, 131072);
// if (typeof(response) != "undefined" && response != null) trimPS(response, "Response", bcSessionXML, 131072);
if (typeof(dir) != "undefined" && dir != null) SetFieldValue("Direction", dir.substring(0, 30));
if (typeof(recId) != "undefined" && recId != null) SetFieldValue("Record Id", recId.substring(0, 15));
if (typeof(recBC) != "undefined" && recBC != null) SetFieldValue("Record BC", recBC.substring(0, 50));
if (typeof(status) != "undefined" && status != null) SetFieldValue("Status", status.substring(0, 30));
if (typeof(srcObject) != "undefined" && srcObject != null) SetFieldValue("Source Object", srcObject.substring(0, 50));
if (typeof(name) != "undefined" && name != null) SetFieldValue("Functional Name", name.substring(0, 50));
if (typeof(logText) != "undefined" && logText != null) SetFieldValue("Log Text", logText.substring(0, 131072));
if (typeof(userText) != "undefined" && userText != null) SetFieldValue("User Text", userText.substring(0, 255));
if (typeof(retCode) != "undefined" && retCode != null) SetFieldValue("Return Code", retCode.substring(0, 30));
if (typeof(ref1) != "undefined" && ref1 != null) SetFieldValue("Reference Id 1", ref1.substring(0, 100));
if (typeof(ref2) != "undefined" && ref2 != null) SetFieldValue("Reference Id 2", ref2.substring(0, 100));
if (typeof(ref3) != "undefined" && ref3 != null) SetFieldValue("Reference Id 3", ref3.substring(0, 100));

WriteRecord();
}
if (gsLogMode == "FILE") {
if (typeof(request) != "undefined" && request != null) PropSetToFile(key+"_Request", request);
if (typeof(response) != "undefined" && response != null) PropSetToFile(key+"_Response", response);
}
}
} catch(e) {
RaiseError(e);
} finally {
bcSessionXML = null;
bcSessionXMLFlat = null;
boSessionFlat = null;
bcSession = null;
boSession = null;
logUnstack("", 5);
}

}

The trimPS method is actually deprecated in my service but I include it in case it is useful to anyone.  I basically just takes a property set, converts it to text, then sets a specified field on an instantiated BC passed as an input to the converted text of the property set.  The assumption in using this method is that there is a limit to how large the stored payload can be.
function trimPS(ps, fieldName, bc, maxLength){
try {
var psIn = TheApplication().NewPropertySet();
var psOut = TheApplication().NewPropertySet();
var bsService = TheApplication().GetService ("XML Converter (Data in Child PropSet)");
psIn.SetProperty("EscapeNames", "False");
var text:String = "";

psIn.AddChild(ps);
bsService.InvokeMethod("PropSetToXML", psIn, psOut);
bc.SetFieldValue(fieldName, ToString(psOut).substring(0, maxLength));
bc.SetFieldValue(fieldName+" Time", TimeStamp("DateTimeFormatted"));
text = bc.GetFieldValue(fieldName);
text = text.lTrim();
if (text.substring(0, 14) == "PropertySet [ ")
text = text.substring(14);
text = text.rTrim("]");
bc.SetFieldValue(fieldName,text);
} catch (e) {
throw(e);
} finally {
psOut = null;
psIn = null;
bsService = null;
}
}

The splitPayload method is what replace the tripPS method.  It is no longer limited in being able store only a certain character length of payload as this method splits the payload into chunks of a specified size and inserts records into the instantiated BC passed as an input.
function splitPayload(bc, fieldName, ps, maxLength) {
try {
logStack("splitPayload", 5);
var psIn = TheApplication().NewPropertySet();
var psOut = TheApplication().NewPropertySet();
var bsService = TheApplication().GetService ("XML Converter (Data in Child PropSet)");
psIn.SetProperty("EscapeNames", "False");
var text:String = "";
var stripPS = false;
var textPS = "";

psIn.AddChild(ps);
bsService.InvokeMethod("PropSetToXML", psIn, psOut);
textPS = ToString(psOut);

logVars(fieldName+" textPS.length", textPS.length);
while (textPS.length > 0) {
bc.NewRecord(NewAfter);
bc.SetFieldValue("Field", fieldName);
bc.SetFieldValue("Log Text", textPS.substring(0, maxLength));

//Service adds a Prefix that needs to be removed
text = bc.GetFieldValue("Log Text");
text = text.lTrim();
if (text.substring(0, 14) == "PropertySet [ ") {
stripPS = true;
text = text.substring(14);
}

textPS = textPS.substring(maxLength, textPS.length);
logVars(fieldName+" textPS.length", textPS.length);

//If the Text is broken up across multiple records, need to remove the trailing ] from the last record
if (stripPS && textPS.length < maxLength) {
text = text.rTrim("]");
}
bc.SetFieldValue("Log Text",text);
bc.WriteRecord();
}
} catch (e) {
throw(e);
} finally {
psOut = null;
psIn = null;
bsService = null;
logUnstack("", 5);
}
}

Next: Viewing the Payload

The XML Logger - Revieing the Payload

$
0
0
In my last post, I talked about how to capture XML Payloads by splitting large values across a series of DB records. In order to look at the data, we need to reassemble the payloads into a single text blck again. I expose my Payload BC in a view tied to either the User's session:

or to the record on which the interface was executed:

The latter is accomplished through the payload parsing I talked about which allows us to create a view which links an object record to the payload record once the transaction id is stored on the payload record. On these views, I expose I nice looking form applet which displays both the request and response sides of the interface. The form fields are actually calculated fields, defined as DTYPE_TEXT, with the following expression:
InvokeServiceMethod("CMI Utilities", "ConcatenateField", "bo.bc='CMI User Session.CMI User Session XML Detail', FieldName='Log Text', SearchExpr='[Parent Id]=""+[Id]+"" AND [Field]="Request"'", "Out")
where:
  • 'CMI Utilities' is my eScript framework service with many commonly used functions
  • 'ConcatenateField' is a method on that service 'bo.bc' is a parameter name for that method
  • 'CMI User Session' is the name of the business object where my user sessions are stored
  • 'CMI User Session XML Detail' is the name of the business component containing the split up log data 'FieldName' is another parameter for this method
  • 'Log Text' is the name of the field on the 'CMI User Session XML Detail' BC where the split payload text is stored defined as DTYPE_CLOB
  • 'SearchExpr' is another parameter for this method

Finally the search expression looks a bit complicated as passing quotes to the InvokeServiceMethod is difficult. I have improvised by using a commonly used XML expression of " which the method then recognizes and converts back to a quote. Here is the method:

function ConcatenateField(Inputs, Outputs) {
//Inputs: bo.bc "boName.bcName"
// FieldName
// SearchExpr BC Search Expression (Optional)
var retValue = "";
var found = false;
var search = Inputs.GetProperty("SearchExpr");
try {
var arSplit = Inputs.GetProperty("bo.bc").split(".");
var bcQuery:BusComp;
if (arSplit[0] == "ACTIVE")
bcQuery = TheApplication().ActiveBusObject().GetBusComp(arSplit[1]);
else
bcQuery = TheApplication().GetBusObject(arSplit[0]).GetBusComp(arSplit[1]);

var delimeter = (Inputs.GetProperty("delimeter") != "" ? Inputs.GetProperty("delimeter") : "\n");

with (bcQuery) {
if (search != "") {
ClearToQuery();
arSplit = Inputs.GetProperty("SearchExpr").split(""");
search = arSplit.join("'");
SetSearchExpr(search);
ActivateField(Inputs.GetProperty("FieldName"));
SetViewMode(AllView);
ExecuteQuery(ForwardOnly);
}

found = FirstRecord();
while(found) {
retValue += GetFieldValue(Inputs.GetProperty("FieldName"));
found = NextRecord();
if (found) retValue += delimeter;
}

Outputs.SetProperty("Out", retValue);
}
} catch(e) {
TheApplication().RaiseError(e);
} finally {
bcQuery = null;
arSplit = null;
}
}

Vanilla Merge Behavior

$
0
0
I recently encountered an issue when adding a DB View based EBC to a BO.  When I attempted to perform a MergeRecords operation on two records in the primary BC (Contact in this case), I got an error:

[1] An error has occurred writing to a record
Please continue or ask your system administrator to check your application configuration if the problem persists.(SBL-DBC-00111)
[2]ORA-06550: line 137, column 15:
PL/SQL: ORA-01031: insufficient privleges
ORA-06550: line 137, column 1:
PL/SQL: SQL Statement ignored

It turns out this error is caused because siebel is attempting to update a column in a DB View.  Why would it try to do that you might ask?

If we reverse engineer what is happening, we find that when performing a MergeRecords operation, Siebel determines the underlying table of the active business component and uses the SRF to find all links where the identified table is shared with the source business component of the Link and the source field is ‘Id’ (or null which is the same thing).  The merge algorithm then takes this list to write the SQL to update the appropriate destination field to the new value of the Id field on the Source BC.  Since merge is a data integrity operation, the use of Links using the ‘Id’ field is a proxy for those links configured to have a data integrity implication. 

Ideally, Siebel would provide a configurable mechanism to exclude a particular link from a Merge, or, at a minimum, to recognize that when a link points to a destination BC that is based on a table object whose type is ‘External View’, no update is possible and hence should not be attempted.  Alas that is not the case. 

Therefore a way to trick the algorithm into excluding this link is to define the link on one which is not based on data integrity, and instead make it just informational.  This can be done by making the Source field of the link something other than Id.  But since we do not want to actually change the definition of the view this link points to, a column whose value matches the ROW_ID column is desireable.  In the case of the Contact BC, there are a couple of potential options.  PERSON_UID defaults to the Id field but since this column might be populated by EIM to be a value other than it’s ultimate row id, the values may not match on that data set.  But since Contact is based on the Party model, the PAR_ROW_ID should always match since this points to the S_PARTY record and the same ROW_ID is always used. This column is not exposed on the Contact BC though so it needs to first be exposed and then the new BC field can be used in the links.

Scriptless OK/Cancel popup

$
0
0
In the early days of configuring in Siebel, if a user wanted a confirmation or warning message before proceeding, it would require Browser Script to implement and most Siebel configurators would try to discourage the requirement on purely technical grounds.  And to be fair, an application littered with popup warnings may not be a great idea on functional grounds either, but there are probably good reasons to implement a warning message on occasion and it would be nice if it could be done in a way that does not have technical repercussions.  So here you go.

On a BC, configure a 'Named Method' user property with value:
"YourMethodName", "INVOKESVC", "FDNS IDENT Encounter", "LS Pharma Signature UI Service", "ShowConfirmDialog", "'Cancel Method Name'", "YourCancelMethodName", "'OK Method Name'", "YourOKMethodName", "'Confirm Text'", "'Are you sure you want to Proceed or some other message?'"

The method 'YourMethodName' would be invoked according to your requirements.  In a simple case, a custom action button on an applet could invoke this method but it could really be invoked anywhere.

The methods 'YourOKMethodName' and 'YourCancelMethodName' need to be callable methods, either that you also configured as additional Named Methods, or vanilla methods (or scripted ones defined in PreInvoke but that would sort of defeat the point). 

When 'YourMethodName' is invoked, a popup message containing the message parameter is shown with an Ok and Cancel button.  Clicking either button calls the methods defined.  Enjoy

Interesting Web Service approach

$
0
0
I was recently working on a client where all the integration used HTTP Web Services but were not implemented using what I think most Siebel Developers would think of as the "Best Practice".  Basically, the payloads were created using XSLT and the actual call to the Web Service was invoked using 'EAI HTTP Transport' rather than a custom WS Proxy BS created using the Tools wizard. 

The reasoning provided to me behind using XSLT to create the payload is that it was more flexible.  What do I mean by that?  Well assume an outbound interface is needed where the "Best Practice" alternative would be to use 'EAI Siebel Adapter' to query an Integration Objects , then to use 'EAI Data Transformation Engine' to transform the payload into an IO (that was initially created by consuming a WSDL) recognizable by the Web Service.  The limitation in this approach is around a couple pieces that Siebel Tools wizards have trouble with.  The first is that some modern standards compliant  WSDL definitions that use recursive data types cannot be imported at all.  The second is that the SOAP Header follows a standard that is somewhat outdated, is not configurable, and basically requires scripting to create a custom header anyway.  So the question is whether it is better to create the custom header using a scripted Filter Service, or to create the payload using XSLT.  Once you go down the path of using XSLT, you basically cant use a Proxy Service anymore (since the proxy would be adding the SOAP envelope) so 'EAI HTTP Transport' is used instead.

I can think of a number of downsides to this approach:
  • Deployment Complexity increases
    • XSLT files must be deployed to the File System and kept in sync across however many app servers (and failover servers) are used by EAI in the respective environments
    • No WSDL is actually consumed in this approach so web service end points must be stored somewhere which will likely be different in each environment
  • More Steps in the WF
    • 'EAI XSLT Service'  uses UTF-16 input so it is likely Encoding will need to occur both to and from using 'Transcode Service'
    • Reading the XSL File from the file system
  • Mainainability
    • Siebel resources that know XSLT are presumably more rare than Siebel resources familiar with more "Best Practice" approaches
  • Performance
    • Calls to the File System to get the XSLT file might add significant load to a high volume interface
  • Data Integrity
    • The integrity of the outbound message data structure is not really enforceable in Siebel. Using XSLT requires the developer to create a payload that is correct as only the external system would be able to validate it.  This is perhaps debateable because ultimately the developer will probably need to resolve this one way or the other during development.  While I personally believe it is easier to troubleshoot problems that are actually identified within Siebel due to the strict defintion of the messages maintained in Siebel, I will concede that might be personal preference.
I am curious what others think and whether developers that use this approach can defend it better than I can.  Ultimately, I think a scripted filter service is a better solution to the custom Soap Header issue, though I think this approach seems reasonable if the WSDL cannot be consumed, and modifying it is not possible.

EAI Integration Map expressions

$
0
0
While there are many posts I have seen that talk about expressions supported by 'EAI Data Transformation Engine', I have never seen an attempt to compile a list of supported functions and examples of there uses.  So this will be a humble beginning that will hopefully grow over time.  Note that these functions are mostly VB so if trying out one that is not listed, start with what is supported in VB.  They can also be found in Siebel Bookshelf as Siebel Query Language expressions

Transforming Dates (from 'YYYYMMDD' to 'MM/DD/YYYY'):
Right(Left([Source Field Name],7),2) +"/"+Right([Source Field Name], 2)+"/"+Left([Source Field Name], 4)

Conditional Logic:
IIF([Source Field Name] = "false", "N", "Y")

EAI Lookup for an Inbound Interface:

  • EAILookupSiebel("XXX",[Source Field Name])
    • XXX is the Type in the EAI Lookup table.  This needs also needs to be setup as a value under the EAI_LOOKUP_MAP_TYPE LOV type.
  • IIF([Source Field Name] IS NULL, "", EAILookupSiebel("XXX",[Source Field Name]))
    • EAILookupSiebel fails if no value is found so minimize this possibility unless an exception is desired


Extract the file name from a File Path:
Mid([Source Field Name], InStr([Source Field Name], "/", -1) + 1)

Thick Client Event Logging

$
0
0
There are surprisingly few blog posts out there about vanilla options for logging in the thick client.  Perhaps this is because everyone knows how to do it and if so feel free to ignore this.  But perhaps it is because most people just struggle through using inefficient methodologies.

Here is a simple tip for troubleshooting when using the thick client.  There is an OS environment variable called SIEBEL_LOG_EVENTS (if it does not exist you can create it). Many developers know how to set this to an integer between 0 and 5, but values of 4 and 5 where good detail is provided create a file that unreasonably large and hard to parse.  When troubleshooting on the thin client you can set individual event log levels from the Administration - Server Configuration screen, component events view.  You can do the same when using a thick client though you need to do it using the SIEBEL_LOG_EVENTS variable.  You can use any combination of event aliases and levels, but the value I have found useful is the following:
StpExec=4,PrcExec=4,ObjMgrSqlLog=4,SQLParseAndExecute=4,ObjMgrBusServiceLog=4,EventContext=4,ProcessRequest=4,ObjMgrDBConnLog=5,SecAdpLog=5,ObjMgrSessionLog=5,ObjMgrBusCompLog=2
Basically you can enter any comma separated list of event aliases.

One coda is that if I were trying to troubleshoot a WF issue, I could open this log and do a find for the word 'Instantiating'.  The first instance I would find is the Start step of the WF Process followed by the values of the process properties being set by that step:
PrcExecCreate400000002569f1a98:02016-01-20 15:31:33Instantiating process definition 'PPT Passport History Response Integration'.
PrcExecPropSet400000002569f1a98:02016-01-20 15:31:33Setting runtime value of property 'Namespace: 'USER' Name: 'ConfigItem' Datatype: 'String'' to:
PrcExecPropSet400000002569f1a98:02016-01-20 15:31:33Start
PrcExecPropSet400000002569f1a98:02016-01-20 15:31:33Setting runtime value of property 'Namespace: 'USER' Name: 'ObjectName' Datatype: 'String'' to:
PrcExecPropSet400000002569f1a98:02016-01-20 15:31:33Workflow - PPT Test Error Process
PrcExecPropSet400000002569f1a98:02016-01-20 15:31:33Setting runtime value of property 'Namespace: 'USER' Name: 'CurrentStep' Datatype: 'String'' to:
PrcExecPropSet400000002569f1a98:02016-01-20 15:31:33Convert Siebel Message PPH
Subsequent occurrences look like this:
StpExecCreate400000002569f1a98:02016-01-20 15:31:33Instantiating step definition 'Start'.
StpExecEnd400000002569f1a98:02016-01-20 15:31:33Stopping step instance of 'Start' with a 'Completed' status.
In this way you can step through the WF.  The advantage of this logging level over say looking at the WF Instance Monitor or only using WF Simulator, is you will be able to see the SQL executed and the bind variables used, what BCs were instantiated along the way, and what BS methods might have been called.

Use Open UI to Dynamiclly Manipulate Detail Tabs

$
0
0
In a screen with many view tabs it may be useful for process automation to minimize clicking on detail tabs if user does not need to navigate there when no records are present.  Open UI allows changing the view tab labels to provide indicators to signal to the user information about that tab.  In order to do so, join fields or calculations based on MV fields relevant to the child BC need to exist and be exposed as controls on the parent BC applet (they can be hidden).

One additional feature is to hide the view tabs not requiring navigation for UI optimization but keeping them available in case the user needs them.  Siebel uses a UI dropdown widget when there are too many views to fit horizontally across.  We can leverage this widget to conditionally place additional views based on the values in BC fields.


The following script is attached to a navigation manifest event:



if(typeof(SiebelAppFacade.pptCustomNavigationPR) === "undefined"){ 
SiebelJS.Namespace("SiebelAppFacade.pptCustomNavigationPR");
define ("siebel/custom/pptCustomNavigationPR", ["siebel/accnavigationphyrender"], function () {
SiebelAppFacade.pptCustomNavigationPR = (function(){
var PM;
var PRName = "";
function pptCustomNavigationPR(pm){
SiebelAppFacade.pptCustomNavigationPR.superclass.constructor.apply(this,arguments);}
SiebelJS.Extend(pptCustomNavigationPR, SiebelAppFacade.AccNavigationPhyRenderer);

pptCustomNavigationPR.prototype.Init = function() {
SiebelAppFacade.pptCustomNavigationPR.superclass.Init.apply(this, arguments);
PM = this.GetPM();
PRName = PM.GetPMName();
};
/*pptCustomNavigationPR.prototype.ShowUI = function(){
SiebelAppFacade.pptCustomNavigationPR.superclass.ShowUI.apply(this, arguments);
//implement ShowUI method here
};
pptCustomNavigationPR.prototype.BindEvents = function(){
SiebelAppFacade.pptCustomNavigationPR.superclass.BindEvents.apply(this, arguments);
//implement BindEvents method here
};*/

pptCustomNavigationPR.prototype.BindData = function(bRefresh){
SiebelAppFacade.pptCustomNavigationPR.superclass.BindData.call(this, bRefresh);

//Prototype for child record counter on view tabs
if (PRName == "NavigationDetailObject_PM"){
//the framework is processing detail navigation, this is a good place for code that manipulates view tabs. Get applet, control, value and properties
//Code assumes the top form applet has a control that exposes a count
var oView = SiebelApp.S_App.GetActiveView();

if (typeof(oView) != 'undefined'&& oView != null && oView.hasOwnProperty("GetName") == true) {
var sViewName = oView.GetName();

//Limit execution of this script to only views matching a naming convention as it must have a parent form applet containing the hidden calculated fields
if ( sViewName.indexOf("XXX Search Text") >= 0 ){
var suppressTabs = true;

//This applet must have controls containing the BC fields that will be used in the array
var applet = oView.GetAppletMap()["XXX Parent Form Applet"];

//Declared Array where index is UI display name of the detail tab and value is either BC Field Name or '-'. If field name, non 0/non null value indicate tab should
//be displayed. '-' indicates tab should always be hidden. If tab should always be displayed, do not put it in the array
var tabList = {"Contacts":"XXX Contact Count","Activities":"XXX Activity Count","Service Requests":"XXX SR Count","Notes":"XXX Notes Flag","Fees":"XXX Fees Flag","Audit Trail":"-"};
var hitCount, fieldName;
var tabIndex = 0;
var tabs = [];
var tabScreens = [];
var showWidget = false;
var lastTab;

//loop through each visible detail tab...
$(".siebui-subview-navs .siebui-nav-tabScreen .ui-tabs-nav a").each(function(index){
//get the current tab label text
var currentLabel = $(this).text();

//check if tab is in array of labels that need modification
fieldName = tabList[currentLabel];
if (typeof(fieldName)!='undefined'&& fieldName != ""){ //we found the tab
if (fieldName == "-") hitCount = "";
else hitCount = applet.GetBusComp().GetFieldValue(fieldName);

//Either modify the label if an indicator needs to be appended or if tab is to be suppressed, add to an array of labels to appear in the option list
if (hitCount != ""&& hitCount != "0") {
//now change the text
$(this).text(currentLabel + " (" + hitCount + ")");
lastTab = $(this);
} else if (suppressTabs) {
//If this tab should be generally suppressed, there are no indicators needing to be displayed, and it is not currently selected
if (fieldName != ""&& (hitCount == "" || hitCount == 0) && $(this).parent().attr("tabindex")!= "0") {
showWidget = true;
tabs[tabIndex] = currentLabel;
tabScreens[tabIndex++] = $(this).attr("data-tabindex").substring(9);
$(this).remove();
} else {
lastTab = $(this);
}
}
}
});

//If any tabs need to be suppressed, display a drop down at the end of the detail tab row with list of view tabs that have been suppressed
if (showWidget == true) {
var j=0;
var htmlstring = lastTab.parent().parent().html();
var append = '<li><select aria-atomic="true" aria-label="Third" bar="" class="siebui-nav-links siebui-nav-viewlist" id="j_s_vctrl_div_tabScreen" level="" role="combo" view="">==$0<option hidden="" value=""></option>';</select></li>
while (j < tabIndex) {
append = append + '<option value="tabScreen'+tabScreens[j]+'">'+tabs[j++]+'</option>';
}
append = append + '</select></li>';
lastTab.parent().parent().html(htmlstring+append);
}
}
}
}
};

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

Get Process and Thread Ids

$
0
0
It is sometimes useful to know the PID or Thread.  For instance if an error occurs and I want to get the specific server OM Log file I can find that file if I knew the Thread and PID.  I am not aware of any way to get these values directly though it is obvious the Siebel application OM has these values internally.  The TraceOn function allows these values to be used while opening and naming the trace file:
TheApplication().TraceOn("TraceFile_$p_$t.log", "Allocation", "All");
results in name like
TraceFile_7382_8188.log
So the trick is to create this file then read the relevant values out of the name.  To do so, I create the file with a unique name that will be known to the script creating it:
var unique = TheApplication().LoginName()+"-"+TimeStamp("DateTimeMilli");
TheApplication().TraceOn(path+"Trace-"+unique+"_$p_$t.log", "Allocation", "All");
To get the values I am interested in, I need to output the directory listing of only this known file to a log I can then open and read, then use format of the name of this file to extract the two values I am interested in:

function SetThreadPID() {
var pid = TheApplication().GetProfileAttr("XXX OS PID");
var threadId = TheApplication().GetProfileAttr("PPT OS Thread ID");
var line, pidThread, path, command, outs;

try {
if (threadId == "") {
if (TheApplication().GetProfileAttr("IsStandaloneWebClient") == "TRUE") {
path = gsLogPath;
} else {
path = TheApplication().GetProfileAttr("Syspref Error Trace Temp Loc");
}

if (path != ""&& path.toUpperCase() != "FALSE") {
var unique = TheApplication().LoginName()+"-"+TimeStamp("DateTimeMilli");
TheApplication().TraceOn(path+"Trace-"+unique+"_$p_$t.log", "Allocation", "All");
TheApplication().Trace("TEST");
TheApplication().TraceOff();

command = "dir "+path+"Trace-"+unique+"_*.log > "+path+"Trace-"+unique+".log";
outs = Clib.system(command);
var fp:File = Clib.fopen(path+"Trace-"+unique+".log","r");
if (fp != null){
while(Clib.feof(fp) == 0){
line = Clib.fgets(fp);
if (line.length > 0){
if (line.indexOf(unique)>=0) {
pidThread = line.substring(line.indexOf(unique)+unique.length+1, line.length - 5)
pid = pidThread.substring(0, pidThread.indexOf("_"));
threadId = pidThread.substring(pidThread.indexOf("_")+1);
TheApplication().SetProfileAttr("PPT OS PID", pid);
TheApplication().SetProfileAttr("PPT OS Thread ID", threadId);
Clib.fclose(fp);
outs = Clib.remove(path+"Trace-"+unique+"_"+pid+"_"+threadId+".log")
outs = Clib.remove(path+"Trace-"+unique+".log")
break;
}
}
}
}
}
}
} catch(e) {
RaiseError(e);
} finally {
fp = null;
}
}

Once the PID and Thread are stored in profile attributes they are available to the business layer to for instance set a PID or thread column on a custom error table.

Note that 'Syspref Error Trace Temp Loc' is a custom field added to the 'Personalization Profile' BC which has the calculation:
SystemPreference("PPT Error Trace Temp Loc")
This is then set to a directory that the Siebel application server has access to (the Siebel temp directory can generally be used safely).

XML Logger - EAI Data Transformation Engine

$
0
0
If you are already capturing the XML payloads of a web service using the XML Logger, then extending it to further troubleshoot how you might have ended up with that payload might be useful since integration workflows frequently undergo multiple transformations. The existing logRequest and logResponse as invoked by the PreInvoke method of the 'XXX Utilities' business service are central to the actual logic.  What is needed now is to add logic to the 'EAI Data Transformation Engine' business service.  The PreInvoke needs the following script added:

function Service_PreInvokeMethod (MethodName, Inputs, Outputs){
if (MethodName=="Execute") {
TheApplication().Utility.InvokeMethod("logTransformRequest", Inputs, TheApplication().NewPropertySet());
}
return (ContinueOperation);
}

The Invoke needs the following script added:

function Service_InvokeMethod (MethodName, Inputs, Outputs) {
if (MethodName=="Execute") {
TheApplication().Utility.InvokeMethod("logTransformResponse", Outputs, TheApplication().NewPropertySet());
}
}

The logRequest and logResponse methods set the direction attribute to 'EAI Transform' to distinguish it and uses the MapName attribute as the functional name.  The Record Id is assumed to be an element called 'Id' in the first top level container.

I made a personal decision that logging these payloads was not universally necessary and therefore wanted to make logging these records conditional.  In my case I made it run in two scenarios:
  • If the executing user's log level is 5 and payload logging is enabled
  • If the payload logging is not generally enabled but an error occurred subsequently in the executing workflow of a subprocess it called.

Workflow Monitoring - On Demand

$
0
0
The out of the box Workflow Monitoring level specified when deploying a version of a workflow is a great tool but it requires it having been explicitly turned on in order to be of value. I have found that while this was turned on for all users in a production environment, we would have a massive surplus of log data that would fill up the logging tables unnecessarily, some users logins may be setup to only do troubleshooting. Alternatively, a specific user could have logging turned up for so that all workflows are tracked rather than having to know all the workflow process names where an error is going to occur as the user may not know before hand which workflow is causing the problem. What is needed is to add logic to the 'Workflow Process Manager' business service.  The PreInvoke needs the following script added:

function Service_PreInvokeMethod (MethodName, Inputs, Outputs) {
if (MethodName.indexOf("Run") >=0) {
TheApplication().Utility.logRaiseWF(Inputs, MethodName);
}
return (ContinueOperation);
}

The Invoke needs the following script added:

function Service_InvokeMethod (MethodName, Inputs, Outputs) {
if (MethodName.indexOf("Run") >=0) {
TheApplication().Utility.logResetWF(Inputs, MethodName);
}
}

The Utility service is enabled in the Application start event. The 'XXX Utilities' business service uses two additional methods.

function logRaiseWF(Inputs, callingMethod) {
// Method called from Workflow Process Manager, PreInvoke method for methods having 'Run' in the method name if the
// Utilities Service is enabled for the OM Component the session is running within.

//If The Troubleshoot process property is passed (when invoking from a Named Method user prop) or as a child prop (when
//invoked from a WF as a subprocess) or the user's log level is 3 or higher, temporarily set WF monitoring for the WF
//process to detail. logResetWF is called immediately after invokation to turn WF monitoring off.
if (gCurrentLogLvl >= 3 ||
Inputs.GetProperty("Troubleshoot") == "Y" ||
(Inputs.GetChildCount() > 0 && Inputs.GetChild(0).GetProperty("Troubleshoot") == "Y")) {
if (TheApplication().GetProfileAttr("IsStandaloneWebClient") == "TRUE") {
logStep("PPT Utilities.logRaiseWF.callingMethod: "+callingMethod+" - ProcessName: "+Inputs.GetProperty("ProcessName"));
logPS(Inputs);
} else {
logSetWFLevel(Inputs, "3 - Detail");
}
}

//The first WF Called in a stack uses the RunProcess method. If subprocess is called from a WF, the _ method is used.
//All payloads captured after the initial RunProcess call are stored in an array and dumped if an error occurs. If
//system preference 'PPT Hold Buffer Max' is greater than 0 then the array is instead always kept at that count rather
//than resetting on WF start
if (gsTraceIntfaceReqResp != "FALSE"&& callingMethod.indexOf("Run")== 0 && gHoldBufferMax == 0) gHoldReqResp = [];
}

function logResetWF(Inputs, callingMethod) {
// Method called from Workflow Process Manager, Invoke method for methods having 'Run' in the method name if the
// Utilities Service is enabled for the OM Component the session is running within.

//Conditions controlling whether to reset WF monitoring level must mirror those in the logRaiseWF function
if (gCurrentLogLvl >= 3 ||
Inputs.GetProperty("Troubleshoot") == "Y" ||
(Inputs.GetChildCount() > 0 && Inputs.GetChild(0).GetProperty("Troubleshoot") == "Y")) {
if (TheApplication().GetProfileAttr("IsStandaloneWebClient") == "TRUE") {
logStep("PPT Utilities.logResetWF.callingMethod: "+callingMethod+" - ProcessName: "+Inputs.GetProperty("ProcessName"));
} else {
logSetWFLevel(Inputs, "0 - None");
}
}
}

Finally, these wrapper functions call a function to actually set and reset the monitoring level on a deployed workflow:

function logSetWFLevel (Inputs, logLevel) {
//Use:
//Returns:
var boWF:BusObject = TheApplication().GetBusObject("PPT Workflow Process Deployment");
var bcWF:BusComp = boWF.GetBusComp("Workflow Process Deployment");
var found:Boolean = false;
var propName = Inputs.GetFirstProperty();

while (propName != "") {
if (propName.indexOf("ProcessName") == 0) {
with (bcWF) {
ActivateField("Monitoring Level");
ClearToQuery();
SetSearchSpec("Name", Inputs.GetProperty(propName));
SetSearchSpec("Deployment Status", "Active");
ExecuteQuery(ForwardOnly);
found = FirstRecord();
if (found) {
SetFieldValue("Monitoring Level", logLevel);
WriteRecord();
}
}
}
propName = Inputs.GetNextProperty();
}
}

To minimize the times where logging is actually raised, one of the following conditions must be true:

  • An input process property called 'Troubleshoot' has a 'Y' value.  I use this process prop across most of my workflows and only pass the 'Y' value when passed as a command/Named Method BC User property from a button on an admin view or an applet gear menu option.  It is useful to expose manually triggering a workflow this way to replicate a process that is normally triggered by the system in some way.
  • Users log level is 3 or higher

Note that if using the thick client, logging is NOT turned on so minimize SQL in the siebel.log file and since this information can easily be set through the SIEBEL_LOG_EVENTS system variable along with the Step and Process execution events.
Viewing all 37 articles
Browse latest View live