[Home] [Help]
PACKAGE BODY: APPS.CCT_TELESALESROUTING_PUB
Source
1 PACKAGE BODY CCT_TeleSalesRouting_PUB as
2 /* $Header: ccttswfb.pls 120.0 2005/06/02 09:34:49 appldev noship $ */
3
4
5 G_PKG_NAME CONSTANT VARCHAR2(30) := 'CCT_TeleSales_Routing_PUB';
6
7 /*------------------------------------------------------------------------
8 TeleSales Routing Workflow Activities
9 *------------------------------------------------------------------------*/
10
11
12 /* -----------------------------------------------------------------------
13 Activity Name : WF_TeleSalesAgentForParty_FIL
14 To filter the agents by Party ID
15 Prerequisites : The Customer initialization phase(CCT_CUSTOMER_INIT)
16 must be completed before using this filter
17 IN
18 itemtype - item type
19 itemkey - item key
20 actid - process activity instance id
21 funmode - execution mode
22 OUT
23 No output
24 ITEM ATTRIBUTES REFERENCED
25 PARTYID - the customer ID
26 MEDIAITEMID - the MediaItem ID
27 *-----------------------------------------------------------------------*/
28
29 procedure WF_TeleSalesAgentForParty_FIL (
30 itemtype in varchar2
31 , itemkey in varchar2
32 , actid in number
33 , funmode in varchar2
34 , resultout in out nocopy varchar2) IS
35
36 l_proc_name VARCHAR2(64) := 'WF_TeleSalesAgentForParty_FIL';
37 l_agents_tbl AST_Routing_PUB.resource_access_tbl_type;
38 l_num_agents NUMBER := 0;
39 l_partyID NUMBER;
40 l_mediaItemID VARCHAR2(32);
41 BEGIN
42 -- set default result
43 resultout := wf_engine.eng_completed||':N';
44
45 if (funmode = 'RUN') then
46 l_partyID := WF_ENGINE.GetItemAttrNumber(
47 itemtype, itemkey, upper(CCT_INTERACTIONKEYS_PUB.KEY_CUSTOMER_ID));
48 l_mediaItemID := WF_ENGINE.GetItemAttrText(
49 itemtype, itemkey, upper(CCT_INTERACTIONKEYS_PUB.KEY_MEDIA_ITEM_ID));
50
51
52 IF ( (l_partyID IS NULL) OR (l_mediaItemID IS NULL) ) THEN
53 return;
54 END IF;
55 --call ASO API
56 AST_Routing_PUB.GetResourcesForParty(
57 l_partyID, l_agents_tbl);
58 IF (l_agents_tbl.count = 0) THEN
59 return;
60 END IF;
61
62 resultout := wf_engine.eng_completed||':Y';
63 CCT_RoutingWorkflow_UTL.InsertResults
64 (l_mediaItemID, l_proc_name , l_agents_tbl);
65
66 end if;
67 EXCEPTION
68 WHEN OTHERS THEN
69 --dbms_output.put_line('Exception in Party2Agent'||sqlerrm);
70 WF_CORE.Context(G_PKG_NAME, l_proc_name,
71 itemtype, itemkey, to_char(actid), funmode);
72 RAISE;
73
74 END WF_TeleSalesAgentForParty_FIL;
75
76 /* -----------------------------------------------------------------------
77 Activity Name : WF_SalesAgentForSourceCode_FIL
78 To filter the agents by Source Code
79 Prerequisite : Source Code must exist
80 IN
81 itemtype - item type
82 itemkey - item key
83 actid - process activity instance id
84 funmode - execution mode
85 OUT
86 No output
87 ITEM ATTRIBUTES REFERENCED
88 SOURCECODE - the Source Code
89 MEDIAITEMID - the MediaItem ID
90 *-----------------------------------------------------------------------*/
91
92 procedure WF_SalesAgentForSourceCode_FIL (
93 itemtype in varchar2
94 , itemkey in varchar2
95 , actid in number
96 , funmode in varchar2
97 , resultout in out nocopy varchar2) IS
98 l_proc_name VARCHAR2(64) := 'WF_SalesAgentForSourceCode_FIL';
99 l_agents_tbl AST_Routing_PUB.resource_access_tbl_type;
100 l_num_agents NUMBER := 0;
101 l_SourceCode Varchar2(255);
102 l_mediaItemID VARCHAR2(32);
103 BEGIN
104 -- set default result
105 resultout := wf_engine.eng_completed||':N';
106
107 if (funmode = 'RUN') then
108 l_SourceCode := WF_ENGINE.GetItemAttrText(
109 itemtype, itemkey, upper(CCT_INTERACTIONKEYS_PUB.KEY_SOURCE_CODE));
110 l_mediaItemID := WF_ENGINE.GetItemAttrText(
111 itemtype, itemkey, upper(CCT_INTERACTIONKEYS_PUB.KEY_MEDIA_ITEM_ID));
112 --dbms_output.put_line('SourceCode='||l_sourcecode);
113
114 IF ( (l_SourceCode IS NULL) OR (l_mediaItemID IS NULL) ) THEN
115 return;
116 END IF;
117 --call ASO API
118 AST_Routing_PUB.GetResourcesForSourceCode(
119 l_SourceCode, l_agents_tbl);
120 IF (l_agents_tbl.count = 0) THEN
121 --dbms_output.put_line('result = null');
122 return;
123 END IF;
124 resultout := wf_engine.eng_completed||':Y';
125 --dbms_output.put_line('agents returned for result='||to_char(l_agents_tbl.count));
126
127 CCT_RoutingWorkflow_UTL.InsertResults
128 (l_mediaItemID, l_proc_name , l_agents_tbl);
129
130 end if;
131 EXCEPTION
132 WHEN OTHERS THEN
133 WF_CORE.Context(G_PKG_NAME, l_proc_name,
134 itemtype, itemkey, to_char(actid), funmode);
135 RAISE;
136
137 END;
138
139 END CCT_TeleSalesRouting_PUB;