3055:
3056: --Code modified for bug13954536(11906160) --start
3057: If pI.party_type = 'ORGANIZATION' then
3058: --Code added for bug11906160
3059: If nvl(fnd_profile.value('AS_NOTES_LEAD_CUSTOMER'),'N') = 'Y' then
3060:
3061: l_note_context_rec.NOTE_CONTEXT_TYPE := 'PARTY_ORGANIZATION';
3062: l_note_context_rec.NOTE_CONTEXT_TYPE_ID := pI.party_id;
3063: end if;
3061: l_note_context_rec.NOTE_CONTEXT_TYPE := 'PARTY_ORGANIZATION';
3062: l_note_context_rec.NOTE_CONTEXT_TYPE_ID := pI.party_id;
3063: end if;
3064: else
3065: If nvl(fnd_profile.value('AS_NOTES_LEAD_CONTACT'),'N') = 'Y' then
3066:
3067: l_note_context_rec.NOTE_CONTEXT_TYPE := 'PARTY';
3068: l_note_context_rec.NOTE_CONTEXT_TYPE_ID := pI.contact_party_id;
3069: end if;
3693:
3694: ----- Begin PARTY SEARCH -----
3695: -- Get rule_id from profile
3696: IF I.party_type = 'ORGANIZATION' THEN
3697: l_rule_id := to_number(FND_PROFILE.value('AS_USE_DQM_RULE_CODE_PARTY'));
3698: ELSIF I.party_type = 'PERSON' THEN
3699: l_rule_id := to_number(FND_PROFILE.value('AS_USE_DQM_RULE_CODE_PERSON'));
3700: ELSE
3701: --else bad party_type
3695: -- Get rule_id from profile
3696: IF I.party_type = 'ORGANIZATION' THEN
3697: l_rule_id := to_number(FND_PROFILE.value('AS_USE_DQM_RULE_CODE_PARTY'));
3698: ELSIF I.party_type = 'PERSON' THEN
3699: l_rule_id := to_number(FND_PROFILE.value('AS_USE_DQM_RULE_CODE_PERSON'));
3700: ELSE
3701: --else bad party_type
3702: AS_UTILITY_PVT.Set_Message(
3703: p_msg_level => FND_MSG_PUB.G_MSG_LVL_ERROR,
3741: IF l_num_matches > 0 THEN
3742: -- A possible duplicate has been found.
3743: -- Get the party id the matched parties having highest score.
3744: -- SOLIN, Bug 3528579
3745: l_activate_flag := NVL(FND_PROFILE.value('AS_ACTIVATE_PARTIES_FROM_IMPORT'), 'N');
3746: IF l_activate_flag = 'N'
3747: THEN
3748: OPEN C_matched_party(I.party_type);
3749: FETCH C_matched_party INTO l_party_id, l_score, l_creation_date;
3824: write_log(3,'#2 :: Calling GET_MATCHING_PARTY_SITES with party_id: '||to_char(I.party_id));
3825:
3826: -- SOLIN, Bug 4942209
3827: -- create a new rule profile for DQM party site match
3828: l_rule_id := to_number(FND_PROFILE.value('AS_USE_DQM_RULE_CODE_PARTY_SITE'));
3829: HZ_PARTY_SEARCH.get_matching_party_sites ('T',l_rule_id, I.party_id, party_site_cond,
3830: contact_point_cond, l_search_context_id, l_return_status, l_msg_count, l_msg_data);
3831:
3832: IF l_return_status <> FND_API.g_ret_sts_success THEN
3874: IF I.first_name IS NOT NULL AND I.last_name IS NOT NULL THEN --3
3875: IF I.party_id IS NOT NULL THEN --4
3876: write_log(3,'#3 :: Calling GET_MATCHING_CONTACTS with party_id: '||to_char(I.party_id));
3877:
3878: l_rule_id := to_number(FND_PROFILE.value('AS_USE_DQM_RULE_CODE_CONTACT'));
3879: HZ_PARTY_SEARCH.get_matching_contacts('T',l_rule_id, I.party_id, contact_cond, contact_point_cond,
3880: l_search_context_id, l_return_status, l_msg_count, l_msg_data);
3881:
3882: IF l_return_status <> FND_API.g_ret_sts_success THEN
3908: --Reset values for person search
3909: party_cond.party_type := 'PERSON';
3910: party_cond.party_name := I.first_name||' '||I.last_name;
3911:
3912: l_rule_id := to_number(FND_PROFILE.value('AS_USE_DQM_RULE_CODE_PERSON'));
3913: HZ_PARTY_SEARCH.find_parties ('T',l_rule_id, party_cond, party_site_cond, contact_cond , contact_point_cond, NULL,
3914: 'N',l_search_context_id, l_num_matches, l_return_status, l_msg_count, l_msg_data);
3915:
3916: IF l_num_matches > 0 THEN --match found
3957: (I.party_type <> 'ORGANIZATION' and I.party_id is not null) THEN
3958: IF l_contact_provided = 'N' AND I.first_name IS NOT NULL AND I.last_name IS NOT NULL THEN
3959: IF I.email_address IS NOT NULL or I.phone_number IS NOT NULL THEN
3960: write_log(3,'#4 :: Calling GET_MATCHING_CONTACT_POINTS with party_id: '||to_char(I.party_id));
3961: l_rule_id := to_number(FND_PROFILE.value('AS_USE_DQM_RULE_CODE_CONTACT'));
3962: HZ_PARTY_SEARCH.get_matching_contact_points('T',l_rule_id, I.party_id, contact_point_cond, l_search_context_id, l_return_status, l_msg_count, l_msg_data);
3963:
3964: IF l_return_status <> FND_API.g_ret_sts_success THEN
3965: RAISE FND_API.g_exc_error;
4182: FETCH C_Get_SLAESFORCE INTO G_SL_SALESFORCE_ID;
4183: CLOSE C_Get_SLAESFORCE;
4184:
4185: If (G_SL_SALESFORCE_ID is null) then
4186: G_SL_SALESFORCE_ID := fnd_profile.value('AS_DEFAULT_RESOURCE_ID');
4187: end if;
4188:
4189: -- Find the sales group of the person being added
4190: -- bugfix # 2772260
4207: WHERE lookup_type = 'SOURCE_SYSTEM'
4208: AND lookup_code = p_source_system;
4209:
4210: -- SOLIN, bug 4494009
4211: l_hz_execute_api_callouts := fnd_profile.value('HZ_EXECUTE_API_CALLOUTS');
4212: write_log(3, 'Profile HZ_EXECUTE_API_CALLOUTS: '|| l_hz_execute_api_callouts);
4213: fnd_profile.put('HZ_EXECUTE_API_CALLOUTS', 'N');
4214: -- SOLIN, end
4215:
4209:
4210: -- SOLIN, bug 4494009
4211: l_hz_execute_api_callouts := fnd_profile.value('HZ_EXECUTE_API_CALLOUTS');
4212: write_log(3, 'Profile HZ_EXECUTE_API_CALLOUTS: '|| l_hz_execute_api_callouts);
4213: fnd_profile.put('HZ_EXECUTE_API_CALLOUTS', 'N');
4214: -- SOLIN, end
4215:
4216: -- For each lead
4217: For I in c_main(p_parent_request_id, p_child_request_id)
4260: --OPEN C_currency_code(I.country);
4261: --FETCH C_currency_code INTO l_currency_code;
4262: --IF C_currency_code%NOTFOUND THEN
4263: -- Set default currency
4264: -- l_currency_code := fnd_profile.value('JTF_PROFILE_DEFAULT_CURRENCY');
4265: --END IF;
4266: --CLOSE C_currency_code;
4267: --I.currency_code := l_currency_code;
4268: END IF; --if currency_code is null
4269: write_log(3, 'Value of currency :'||I.currency_code);
4270: -- End enh: Support for Currency
4271:
4272: -- Check profile for executing custom hook
4273: IF (fnd_profile.value ('AS_LEAD_IMP_EXEC_CUSTOM_CODE')='Y') Then
4274:
4275: write_log(3, 'Before calling custom hook for party match');
4276: -- Call custom hook
4277: aml_find_party_match_pvt.main(I, --IN OUT param
4694: End Loop;
4695:
4696: -- SOLIN, bug 4494009
4697: -- Set profile back to its original value
4698: fnd_profile.put('HZ_EXECUTE_API_CALLOUTS', l_hz_execute_api_callouts);
4699: -- SOLIN, end
4700:
4701: write_log(2, 'Batch Size:'|| l_batch_size);
4702: write_log(1, 'Batch Size:'|| l_batch_size);
4834: --Get conc_request_id
4835: l_request_id := nvl(FND_GLOBAL.conc_request_id, -1);
4836:
4837: --Get the batch size for each thread from profile
4838: l_batch_size := nvl(to_number(FND_PROFILE.value('AS_MIN_REC_PARALLEL_FOR_IMPORT')),0);
4839:
4840: --Get interaction threshold
4841: l_interaction_threshold := nvl(FND_PROFILE.value('AS_INTERACTION_SCORE_THRESHOLD'),0);
4842:
4837: --Get the batch size for each thread from profile
4838: l_batch_size := nvl(to_number(FND_PROFILE.value('AS_MIN_REC_PARALLEL_FOR_IMPORT')),0);
4839:
4840: --Get interaction threshold
4841: l_interaction_threshold := nvl(FND_PROFILE.value('AS_INTERACTION_SCORE_THRESHOLD'),0);
4842:
4843: --If profile is set to -ve value
4844: If l_batch_size < 0 then
4845: l_batch_size := 0;