How to get active user partyId in istore:
RequestCtx.getPartyId()
RequestCtx.getPartyId()
Query to retrieve Organization contacts associated
with account.
1)
SELECT
party_id
INTO l_party_id
FROM hz_cust_accounts
WHERE account_number = p_customer_account_number;
--Pass this party_id as subject id to the below query to get organization contact;
SELECT *
FROM hz_parties
WHERE party_id IN (
SELECT object_id
FROM hz_relationships
WHERE subject_id = l_party_id
AND relationship_code LIKE 'CONTACT'
AND status = 'A');
INTO l_party_id
FROM hz_cust_accounts
WHERE account_number = p_customer_account_number;
--Pass this party_id as subject id to the below query to get organization contact;
SELECT *
FROM hz_parties
WHERE party_id IN (
SELECT object_id
FROM hz_relationships
WHERE subject_id = l_party_id
AND relationship_code LIKE 'CONTACT'
AND status = 'A');
2)
select *
from fnd_user where user_id in(
SELECT
distinct f.user_id
FROM oe_order_headers_all oh,
hz_cust_accounts
ca,
hz_cust_account_roles
car,
hz_parties
p,
hz_relationships
prel ,
fnd_user f ,
jtf_um_usertype_reg jutr
WHERE
ca.account_number=1000158
AND
oh.sold_to_org_id=ca.cust_account_id
AND
ca.party_id=p.party_id
AND
p.party_type='ORGANIZATION'
AND car.cust_account_role_id=oh.sold_to_contact_id
AND car.status='A'
AND
prel.party_id=car.party_id
AND prel.status='A'
AND
f.customer_id=car.party_id
AND jutr.user_id=f.user_id(+)
AND jutr.status_code<>'REJECTED'
Customer relationship between a Party and
party_contact in oracle:
=> select header_id,sold_to_org_id,sold_to_contact_id
into l_header_id,l_sold_to_org_id,l_sold_to_contact_id from
oe_order_headers_all where order_number='p_order_number';
=> select party_id into l_contact_party_id
from HZ_CUST_ACCOUNT_ROLES where cust_account_role_id=l_sold_to_contact_id and
cust_account_id=l_sold_to_org_id;
No comments:
Post a Comment