56:
57: -------------------- initialize -------------------------
58: SAVEPOINT Update_sales_referral_lead;
59:
60: AS_Utility_PVT.debug_message(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW, l_full_name||': start');
61:
62: IF FND_API.to_boolean(p_init_msg_list) THEN
63: FND_MSG_PUB.initialize;
64: END IF;
59:
60: AS_Utility_PVT.debug_message(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW, l_full_name||': start');
61:
62: IF FND_API.to_boolean(p_init_msg_list) THEN
63: FND_MSG_PUB.initialize;
64: END IF;
65:
66: IF NOT FND_API.compatible_api_call(
67: l_api_version,
75: x_return_status := FND_API.G_RET_STS_SUCCESS;
76:
77:
78: ----------------------- validate ----------------------
79: AS_Utility_PVT.debug_message(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW, l_full_name ||': validate');
80:
81: IF (P_SALES_LEAD_Rec.sales_lead_id is null) THEN
82: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
83: FND_MESSAGE.set_name('PV', 'PV_NO_LEAD_FOUND');
78: ----------------------- validate ----------------------
79: AS_Utility_PVT.debug_message(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW, l_full_name ||': validate');
80:
81: IF (P_SALES_LEAD_Rec.sales_lead_id is null) THEN
82: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
83: FND_MESSAGE.set_name('PV', 'PV_NO_LEAD_FOUND');
84: FND_MSG_PUB.add;
85: END IF;
86: RAISE FND_API.g_exc_error;
80:
81: IF (P_SALES_LEAD_Rec.sales_lead_id is null) THEN
82: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
83: FND_MESSAGE.set_name('PV', 'PV_NO_LEAD_FOUND');
84: FND_MSG_PUB.add;
85: END IF;
86: RAISE FND_API.g_exc_error;
87: END IF;
88:
94: --l_msg_data:=l_msg_data || '** Referral Status from table :'|| l_referral_status;
95: --l_msg_data:=l_msg_data || '** Referral Status from record :'|| P_SALES_LEAD_Rec.REFERRAL_STATUS;
96:
97: -------------------------- call API --------------------
98: AS_Utility_PVT.debug_message(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW, l_full_name ||': update');
99: l_lead_referral_status:=P_SALES_LEAD_Rec.REFERRAL_STATUS;
100:
101: --main if,
102: --if referral type is null, do nothing.
100:
101: --main if,
102: --if referral type is null, do nothing.
103: IF( P_SALES_LEAD_Rec.referral_type is null) THEN
104: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
105: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
106: fnd_message.Set_Token('TEXT', 'In ' || l_api_name || 'Referral Type is null');
107: fnd_msg_pub.Add;
108: END IF;
103: IF( P_SALES_LEAD_Rec.referral_type is null) THEN
104: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
105: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
106: fnd_message.Set_Token('TEXT', 'In ' || l_api_name || 'Referral Type is null');
107: fnd_msg_pub.Add;
108: END IF;
109: --l_msg_data:=l_msg_data || ' Referral Type is null ';
110: end if;
111:
114: --If referral status is changed, we need to update lead and insert row in log table
115: --and send notification based on status
116: IF (l_referral_status is null OR l_referral_status <> l_lead_referral_status) THEN
117:
118: AS_Utility_PVT.debug_message(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW, l_full_name ||': status changed');
119: -- Call API to create log entry
120:
121:
122: AS_SALES_LEADS_LOG_PKG.Insert_Row(
153: l_lead_referral_status = g_referral_status_comm_rej
154: ) then
155:
156: -- Send OUT NOCOPY email notification
157: AS_Utility_PVT.debug_message(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW, l_full_name ||': notification');
158: l_msg_data:=l_msg_data || '** while notifying';
159:
160: AS_SALES_LEAD_REFERRAL.Notify_Party (
161: p_api_version => 1.0
223: IF FND_API.to_boolean(p_commit) THEN
224: COMMIT;
225: END IF;
226:
227: FND_MSG_PUB.count_and_get(
228: p_encoded => FND_API.g_false,
229: p_count => x_msg_count,
230: p_data => x_msg_data
231: );
229: p_count => x_msg_count,
230: p_data => x_msg_data
231: );
232:
233: AS_Utility_PVT.debug_message(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW, l_full_name ||': end');
234: -- x_msg_data:=l_msg_data;
235:
236: EXCEPTION
237:
237:
238: WHEN FND_API.g_exc_error THEN
239: ROLLBACK TO Update_sales_referral_lead;
240: x_return_status := FND_API.g_ret_sts_error;
241: FND_MSG_PUB.count_and_get(
242: p_encoded => FND_API.g_false,
243: p_count => x_msg_count,
244: p_data => x_msg_data
245: );
242: p_encoded => FND_API.g_false,
243: p_count => x_msg_count,
244: p_data => x_msg_data
245: );
246: /*FOR l_index IN 1..FND_MSG_PUB.Count_Msg LOOP
247: my_message := FND_MSG_PUB.Get(
248: p_msg_index => l_index,
249: p_encoded => FND_API.G_FALSE);
250:
243: p_count => x_msg_count,
244: p_data => x_msg_data
245: );
246: /*FOR l_index IN 1..FND_MSG_PUB.Count_Msg LOOP
247: my_message := FND_MSG_PUB.Get(
248: p_msg_index => l_index,
249: p_encoded => FND_API.G_FALSE);
250:
251: loop
258: --x_msg_data:=l_msg_data;
259: WHEN FND_API.g_exc_unexpected_error THEN
260: ROLLBACK TO Update_sales_referral_lead;
261: x_return_status := FND_API.g_ret_sts_unexp_error ;
262: FND_MSG_PUB.count_and_get(
263: p_encoded => FND_API.g_false,
264: p_count => x_msg_count,
265: p_data => x_msg_data
266: );
269: WHEN OTHERS THEN
270: ROLLBACK TO Update_sales_referral_lead;
271: x_return_status := FND_API.g_ret_sts_unexp_error ;
272:
273: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_unexp_error)
274: THEN
275: FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
276: END IF;
277:
271: x_return_status := FND_API.g_ret_sts_unexp_error ;
272:
273: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_unexp_error)
274: THEN
275: FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
276: END IF;
277:
278: FND_MSG_PUB.count_and_get(
279: p_encoded => FND_API.g_false,
274: THEN
275: FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
276: END IF;
277:
278: FND_MSG_PUB.count_and_get(
279: p_encoded => FND_API.g_false,
280: p_count => x_msg_count,
281: p_data => x_msg_data
282: );
497:
498: -- Initialize message list if p_init_msg_list is set to TRUE.
499: IF FND_API.to_Boolean( p_init_msg_list )
500: THEN
501: FND_MSG_PUB.initialize;
502: END IF;
503:
504: -- Debug Message
505: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
501: FND_MSG_PUB.initialize;
502: END IF;
503:
504: -- Debug Message
505: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
506: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
507: fnd_message.Set_Token('TEXT', 'In ' || l_api_name);
508: fnd_msg_pub.Add;
509: END IF;
504: -- Debug Message
505: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
506: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
507: fnd_message.Set_Token('TEXT', 'In ' || l_api_name);
508: fnd_msg_pub.Add;
509: END IF;
510:
511:
512:
535: l_referral_status := p_lead_status;
536: end if;
537:
538:
539: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
540: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
541: fnd_message.Set_Token('TEXT', 'In notify party ref_status' || l_referral_status);
542: fnd_msg_pub.Add;
543: END IF;
538:
539: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
540: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
541: fnd_message.Set_Token('TEXT', 'In notify party ref_status' || l_referral_status);
542: fnd_msg_pub.Add;
543: END IF;
544:
545: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
546: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
541: fnd_message.Set_Token('TEXT', 'In notify party ref_status' || l_referral_status);
542: fnd_msg_pub.Add;
543: END IF;
544:
545: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
546: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
547: fnd_message.Set_Token('TEXT', 'In notify party l_ref_decline_reason' || l_ref_decline_reason);
548: fnd_msg_pub.Add;
549: END IF;
544:
545: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
546: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
547: fnd_message.Set_Token('TEXT', 'In notify party l_ref_decline_reason' || l_ref_decline_reason);
548: fnd_msg_pub.Add;
549: END IF;
550:
551: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
552: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
547: fnd_message.Set_Token('TEXT', 'In notify party l_ref_decline_reason' || l_ref_decline_reason);
548: fnd_msg_pub.Add;
549: END IF;
550:
551: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
552: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
553: fnd_message.Set_Token('TEXT', 'In notify party l_ref_decline_reason meaning' || l_ref_decline_reason_meaning);
554: fnd_msg_pub.Add;
555: END IF;
550:
551: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
552: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
553: fnd_message.Set_Token('TEXT', 'In notify party l_ref_decline_reason meaning' || l_ref_decline_reason_meaning);
554: fnd_msg_pub.Add;
555: END IF;
556:
557:
558: l_lead_id := p_lead_id;
569: INTO l_party_id, l_ptnr_org_name;
570: CLOSE lc_ptnr_org_name;
571:
572:
573: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
574: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
575: fnd_message.Set_token('TEXT', 'partner_org_name : '|| l_ptnr_org_name || ' Party_id: ' || l_party_id );
576: fnd_msg_pub.Add;
577: END IF;
572:
573: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
574: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
575: fnd_message.Set_token('TEXT', 'partner_org_name : '|| l_ptnr_org_name || ' Party_id: ' || l_party_id );
576: fnd_msg_pub.Add;
577: END IF;
578:
579: -- Get Lookup ,meaning for country and state
580: open c_get_meaning('STATE',l_customer_state);
633: OPEN lc_lead_owner (pc_lead_id => l_lead_id);
634: FETCH lc_lead_owner INTO l_assign_to_person_id, l_owner_user_name, l_owner_user_id, l_owner_source_id;
635: CLOSE lc_lead_owner;
636:
637: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
638: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
639: fnd_message.Set_token('TEXT', 'owner user name : '|| l_owner_user_name || ' l_owner_user_id: ' || l_owner_user_id);
640: fnd_msg_pub.Add;
641: END IF;
636:
637: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
638: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
639: fnd_message.Set_token('TEXT', 'owner user name : '|| l_owner_user_name || ' l_owner_user_id: ' || l_owner_user_id);
640: fnd_msg_pub.Add;
641: END IF;
642:
643: --end if;
644: l_user_table(l_user_count).user_id := l_owner_user_id;
677: fetch c_get_ptnr_full_name into l_ptnr_full_name;
678: close c_get_ptnr_full_name;
679:
680:
681: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
682: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
683: fnd_message.Set_token('TEXT', 'l_ptnr_user_name : '|| l_ptnr_user_name|| ' l_ptnr_user_id: ' || l_ptnr_user_id);
684: fnd_msg_pub.Add;
685: END IF;
680:
681: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
682: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
683: fnd_message.Set_token('TEXT', 'l_ptnr_user_name : '|| l_ptnr_user_name|| ' l_ptnr_user_id: ' || l_ptnr_user_id);
684: fnd_msg_pub.Add;
685: END IF;
686:
687: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
688: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
683: fnd_message.Set_token('TEXT', 'l_ptnr_user_name : '|| l_ptnr_user_name|| ' l_ptnr_user_id: ' || l_ptnr_user_id);
684: fnd_msg_pub.Add;
685: END IF;
686:
687: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
688: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
689: fnd_message.Set_token('TEXT', 'l_ptnr_full_name : '|| l_ptnr_full_name);
690: fnd_msg_pub.Add;
691: END IF;
686:
687: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
688: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
689: fnd_message.Set_token('TEXT', 'l_ptnr_full_name : '|| l_ptnr_full_name);
690: fnd_msg_pub.Add;
691: END IF;
692:
693: --Forming notify list form user table
694: FOR i in 1 .. l_user_table.count LOOP
705: l_notify_role_list := substr(l_notify_role_list,2);
706:
707: END IF; -- overring username clause
708:
709: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
710: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
711: fnd_message.Set_token('TEXT', 'partner_user_name : '|| l_ptnr_user_name );
712: fnd_msg_pub.Add;
713: END IF;
708:
709: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
710: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
711: fnd_message.Set_token('TEXT', 'partner_user_name : '|| l_ptnr_user_name );
712: fnd_msg_pub.Add;
713: END IF;
714:
715:
716: -- Create Role
724: role_display_name => l_notify_ptnr_role,
725: role_users => UPPER(l_ptnr_user_name));
726:
727:
728: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
729: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
730: fnd_message.Set_token('TEXT', 'Created role : '|| l_notify_role || ' with members ' || l_notify_role_list);
731: fnd_msg_pub.Add;
732: END IF;
727:
728: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
729: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
730: fnd_message.Set_token('TEXT', 'Created role : '|| l_notify_role || ' with members ' || l_notify_role_list);
731: fnd_msg_pub.Add;
732: END IF;
733:
734:
735: IF (l_referral_status = g_referral_status_sub
739: or l_referral_status = g_referral_status_comm_acc
740: or l_referral_status = g_referral_status_comm_rej
741: ) then
742:
743: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
744: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
745: fnd_message.Set_token('TEXT', 'Referral Status changed: ');
746: fnd_msg_pub.Add;
747: END IF;
742:
743: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
744: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
745: fnd_message.Set_token('TEXT', 'Referral Status changed: ');
746: fnd_msg_pub.Add;
747: END IF;
748: -- Once the parameters for workflow is validated, start the workflow
749: wf_engine.CreateProcess (ItemType => l_itemType,
750: ItemKey => l_itemKey,
890:
891: -- l_mesg_data := l_mesg_data ||'End';
892:
893: -- Debug Message
894: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
895: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
896: fnd_message.Set_token('TEXT', 'Before Start Process ');
897: fnd_msg_pub.Add;
898: END IF;
893: -- Debug Message
894: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
895: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
896: fnd_message.Set_token('TEXT', 'Before Start Process ');
897: fnd_msg_pub.Add;
898: END IF;
899:
900: wf_engine.StartProcess (ItemType => l_itemType,
901: ItemKey => l_itemKey);
901: ItemKey => l_itemKey);
902:
903: -- dbms_output.put_line('started process');
904:
905: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
906: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
907: fnd_message.Set_token('TEXT', 'After Start Process ');
908: fnd_msg_pub.Add;
909: END IF;
904:
905: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
906: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
907: fnd_message.Set_token('TEXT', 'After Start Process ');
908: fnd_msg_pub.Add;
909: END IF;
910:
911: end if;
912:
911: end if;
912:
913:
914: -- Standard call to get message count and if count is 1, get message info.
915: FND_MSG_PUB.Count_And_Get
916: ( p_count => x_msg_count,
917: p_data => x_msg_data
918: );
919: -- x_msg_data := l_mesg_data;
921:
922: WHEN FND_API.G_EXC_ERROR THEN
923:
924: x_return_status := FND_API.G_RET_STS_ERROR ;
925: fnd_msg_pub.Count_And_Get( p_encoded => FND_API.G_TRUE,
926: p_count => x_msg_count,
927: p_data => x_msg_data);
928: --x_msg_data := 'SWKHANNA1'||l_mesg_data;
929: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
928: --x_msg_data := 'SWKHANNA1'||l_mesg_data;
929: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
930:
931: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
932: fnd_msg_pub.Count_And_Get( p_encoded => FND_API.G_TRUE,
933: p_count => x_msg_count,
934: p_data => x_msg_data);
935: --x_msg_data := 'SWKHANNA2'||l_mesg_data;
936: WHEN OTHERS THEN
935: --x_msg_data := 'SWKHANNA2'||l_mesg_data;
936: WHEN OTHERS THEN
937:
938: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
939: FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
940: fnd_msg_pub.Count_And_Get( p_encoded => FND_API.G_FALSE,
941: p_count => x_msg_count,
942: p_data => x_msg_data);
943: --x_msg_data :='SWKHANNA3'|| l_mesg_data;
936: WHEN OTHERS THEN
937:
938: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
939: FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
940: fnd_msg_pub.Count_And_Get( p_encoded => FND_API.G_FALSE,
941: p_count => x_msg_count,
942: p_data => x_msg_data);
943: --x_msg_data :='SWKHANNA3'|| l_mesg_data;
944: End Notify_Party;
963: l_ptnr_user_name varchar2(100);
964: l_resultout varchar2(50);
965:
966: BEGIN
967: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
968: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
969: fnd_message.Set_Token('TEXT', 'In ' || l_api_name || ' Funcmode: ' || funcmode);
970: fnd_msg_pub.Add;
971: END IF;
966: BEGIN
967: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
968: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
969: fnd_message.Set_Token('TEXT', 'In ' || l_api_name || ' Funcmode: ' || funcmode);
970: fnd_msg_pub.Add;
971: END IF;
972:
973: if (funcmode = 'RUN') then
974: -- Figure OUT NOCOPY if the lead was created by the partner. Only if the lead was created by the
983: l_ptnr_user_name := wf_engine.GetItemAttrText( itemtype => itemtype,
984: itemkey => itemkey,
985: aname => g_wf_attr_ptnr_user_name);
986:
987: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
988: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
989: fnd_message.Set_Token('TEXT', 'Category ' || l_category);
990: fnd_msg_pub.Add;
991: END IF;
986:
987: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
988: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
989: fnd_message.Set_Token('TEXT', 'Category ' || l_category);
990: fnd_msg_pub.Add;
991: END IF;
992: IF (l_category = 'PARTY' and l_ptnr_user_name is not null ) THEN
993: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
994: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
989: fnd_message.Set_Token('TEXT', 'Category ' || l_category);
990: fnd_msg_pub.Add;
991: END IF;
992: IF (l_category = 'PARTY' and l_ptnr_user_name is not null ) THEN
993: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
994: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
995: fnd_message.Set_Token('TEXT', 'Category is ' || l_category);
996: fnd_msg_pub.Add;
997: END IF;
992: IF (l_category = 'PARTY' and l_ptnr_user_name is not null ) THEN
993: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
994: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
995: fnd_message.Set_Token('TEXT', 'Category is ' || l_category);
996: fnd_msg_pub.Add;
997: END IF;
998: l_resultout := 'COMPLETE:' || 'Y';
999: END IF;
1000:
1001: else
1002:
1003: l_resultout := 'COMPLETE:'||'N';
1004: end if;
1005: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
1006: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
1007: fnd_message.Set_Token('TEXT', 'Function output : ' || l_resultout);
1008: fnd_msg_pub.Add;
1009: END IF;
1004: end if;
1005: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
1006: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
1007: fnd_message.Set_Token('TEXT', 'Function output : ' || l_resultout);
1008: fnd_msg_pub.Add;
1009: END IF;
1010: resultout := l_resultout;
1011:
1012: END SEND_PTNR_NTF;
1035: l_resultout varchar2(50);
1036:
1037: BEGIN
1038:
1039: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
1040: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
1041: fnd_message.Set_Token('TEXT', 'In ' || l_api_name || ' Funcmode: ' || funcmode);
1042: fnd_msg_pub.Add;
1043: END IF;
1038:
1039: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
1040: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
1041: fnd_message.Set_Token('TEXT', 'In ' || l_api_name || ' Funcmode: ' || funcmode);
1042: fnd_msg_pub.Add;
1043: END IF;
1044:
1045: if (funcmode = 'RUN') then
1046: l_temp_status := wf_engine.GetItemAttrText( itemtype => itemtype,
1047: itemkey => itemkey,
1048: aname => g_wf_attr_lead_status);
1049:
1050:
1051: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
1052: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
1053: fnd_message.Set_Token('TEXT', 'Lead Status in AS_lead_notify ' || l_temp_status);
1054: fnd_msg_pub.Add;
1055: END IF;
1050:
1051: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
1052: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
1053: fnd_message.Set_Token('TEXT', 'Lead Status in AS_lead_notify ' || l_temp_status);
1054: fnd_msg_pub.Add;
1055: END IF;
1056: -- Lead Submitted
1057: IF (l_temp_status = g_referral_status_sub ) THEN
1058: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
1054: fnd_msg_pub.Add;
1055: END IF;
1056: -- Lead Submitted
1057: IF (l_temp_status = g_referral_status_sub ) THEN
1058: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
1059: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
1060: fnd_message.Set_Token('TEXT', 'Lead Status in AS_lead_notify ' || l_temp_status);
1061: fnd_msg_pub.Add;
1062: END IF;
1057: IF (l_temp_status = g_referral_status_sub ) THEN
1058: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
1059: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
1060: fnd_message.Set_Token('TEXT', 'Lead Status in AS_lead_notify ' || l_temp_status);
1061: fnd_msg_pub.Add;
1062: END IF;
1063:
1064: l_resultout := 'COMPLETE:' || g_wf_lkup_lead_status_sub;
1065: END IF;
1093: else
1094:
1095: l_resultout := 'COMPLETE';
1096: end if;
1097: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
1098: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
1099: fnd_message.Set_Token('TEXT', 'Function output : ' || l_resultout);
1100: fnd_msg_pub.Add;
1101: END IF;
1096: end if;
1097: IF fnd_msg_pub.Check_Msg_Level (fnd_msg_pub.G_MSG_LVL_DEBUG_LOW) THEN
1098: fnd_message.Set_Name('AS', 'AS_DEBUG_MESSAGE');
1099: fnd_message.Set_Token('TEXT', 'Function output : ' || l_resultout);
1100: fnd_msg_pub.Add;
1101: END IF;
1102: resultout := l_resultout;
1103:
1104: END AS_LEAD_NOTIFY;