In the previous post, we have used REST API to create a Customer Organization that would create Party, Party Site, Party Site Usage and Location for an Organization. That post can be found here: https://oraclelabs.phaniadivi.com/2022/01/creating-a-party-or-organization-using-rest-api-oracle-fusion/
Note: An Organization / Party can be created using a REST API and a Customer account and Sites are created using SOAP Webservices.
In this Post, we will use a SOAP webservice to create Customer for an existing Party.
Of the Existing Party – Get the Party ID, Party Site ID from the BI Catalog by running the following queries:
select party_id from hz_parties where party_name = 'Oracle Learnings';
select party_site_id
from hz_party_sites
where party_id = (select party_id from hz_parties where party_name = 'Oracle Learning')
Using SOAP UI or other application run the following code:
WSDL: https://ehkm-test.fa.us6.oraclecloud.com/crmService/CustomerAccountService?WSDL
Payload:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://xmlns.oracle.com/apps/cdm/foundation/parties/customerAccountService/applicationModule/types/" xmlns:cus="http://xmlns.oracle.com/apps/cdm/foundation/parties/customerAccountService/" xmlns:cus1="http://xmlns.oracle.com/apps/cdm/foundation/parties/flex/custAccountContactRole/" xmlns:par="http://xmlns.oracle.com/apps/cdm/foundation/parties/partyService/" xmlns:sour="http://xmlns.oracle.com/apps/cdm/foundation/parties/flex/sourceSystemRef/" xmlns:cus2="http://xmlns.oracle.com/apps/cdm/foundation/parties/flex/custAccountContact/" xmlns:cus3="http://xmlns.oracle.com/apps/cdm/foundation/parties/flex/custAccountRel/" xmlns:cus4="http://xmlns.oracle.com/apps/cdm/foundation/parties/flex/custAccountSiteUse/" xmlns:cus5="http://xmlns.oracle.com/apps/cdm/foundation/parties/flex/custAccountSite/" xmlns:cus6="http://xmlns.oracle.com/apps/cdm/foundation/parties/flex/custAccount/">
<soapenv:Header/>
<soapenv:Body>
<typ:createCustomerAccount>
<typ:customerAccount>
<cus:PartyId>-- enter party id</cus:PartyId>
<cus:AccountName>Customer Account Name</cus:AccountName>
<cus:AccountNumber>123456</cus:AccountNumber>
<cus:CustomerType>R</cus:CustomerType>
<cus:AccountEstablishedDate>2022-01-09</cus:AccountEstablishedDate>
<cus:CreatedByModule>HZ_WS</cus:CreatedByModule>
<cus:CustomerAccountSite>
<cus:PartySiteId>-- enter party site id --</cus:PartySiteId>
<cus:CreatedByModule>HZ_WS</cus:CreatedByModule>
<cus:SetId>-- derive set id from configurations --</cus:SetId>
<cus:StartDate>2022-01-09</cus:StartDate>
<cus:CustomerAccountSiteUse>
<cus:SiteUseCode>BILL_TO</cus:SiteUseCode>
<cus:CreatedByModule>HZ_WS</cus:CreatedByModule>
</cus:CustomerAccountSiteUse>
</cus:CustomerAccountSite>
</typ:customerAccount>
</typ:createCustomerAccount>
</soapenv:Body>
</soapenv:Envelope>
After the above code is run – check to see if the customer is created in the system or not using the following queries:
select * from hz_cust_accounts -- get the account_number
select *
from hz_cust_acct_sites_all
where cust_account_id = (select cust_account_id
from hz_cust_accounts
where account_number = <account number>)
select *
from hz_cust_site_uses_all
where CUST_ACCT_SITE_ID = (select CUST_ACCT_SITE_ID
from hz_cust_acct_sites_all
where cust_account_id = (select cust_account_id
from hz_cust_accounts
where account_number = <account number>))