Create Customer Contact Point at Account Level using SOAP Webservice- Oracle Fusion

In the last Post, we have seen ways to create Customer Account and Customer Account Site using SOAP Webservices. In this post, we shall try to continue to use SOAP Webservices to create Customer Contact Point at Account level.

One thing we have to understand is that – a Contact Point is also an object in the TCA Architecture and thus, the Contact will also have a Party ID.

It took some time for me to get to this stage to understand the actual process to create a contact, and wanted to share. In short, we will follow the below steps:

  1. Create a Contact -> This will create a Party ID for the Contact Point.
  2. Take the Party ID of the Contact from the above step, and take the Party ID of the Customer Account to which we are trying to create the Contact Point for.
  3. Create a Relationship between the two Parties. Get the RelationshipId.
  4. Take the RelationshipId from the above step, take the Customer Account ID, and run the SOAP to create the Customer Contact Point.

Explained in detail below:

Step 1: Create Contact Point: First, we create a Person or Party for the Contact using the Payload below.

WSDL: https://<yourservername>.oraclecloud.com/crmService/FoundationPartiesPersonService?WSDL

Payload:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://xmlns.oracle.com/apps/cdm/foundation/parties/personService/applicationModule/types/" xmlns:per="http://xmlns.oracle.com/apps/cdm/foundation/parties/personService/" xmlns:par="http://xmlns.oracle.com/apps/cdm/foundation/parties/partyService/" xmlns:sour="http://xmlns.oracle.com/apps/cdm/foundation/parties/flex/sourceSystemRef/" xmlns:con="http://xmlns.oracle.com/apps/cdm/foundation/parties/contactPointService/" xmlns:con1="http://xmlns.oracle.com/apps/cdm/foundation/parties/flex/contactPoint/" xmlns:par1="http://xmlns.oracle.com/apps/cdm/foundation/parties/flex/partySite/" xmlns:per1="http://xmlns.oracle.com/apps/cdm/foundation/parties/flex/person/" xmlns:rel="http://xmlns.oracle.com/apps/cdm/foundation/parties/relationshipService/" xmlns:org="http://xmlns.oracle.com/apps/cdm/foundation/parties/flex/orgContact/" xmlns:rel1="http://xmlns.oracle.com/apps/cdm/foundation/parties/flex/relationship/">
   <soapenv:Header/>
   <soapenv:Body>
      <typ:createPerson>
         <typ:personParty>
            <per:CreatedByModule>HZ_WS</per:CreatedByModule>
            <per:PersonProfile>
               <per:CreatedByModule>HZ_WS</per:CreatedByModule>
               <per:PersonFirstName>Test Contact</per:PersonFirstName>
               <per:PersonLastName>soap</per:PersonLastName>
            </per:PersonProfile>
            <per:PartyUsageAssignment>
               <par:PartyUsageCode>CONTACT</par:PartyUsageCode>
               <par:CreatedByModule>HZ_WS</par:CreatedByModule>
            </per:PartyUsageAssignment>
            <per:Phone>
               <con:OwnerTableName>HZ_PARTIES</con:OwnerTableName>
               <con:PhoneCountryCode>1</con:PhoneCountryCode>
               <con:PhoneNumber>987-654-3210</con:PhoneNumber>
               <con:PhoneLineType>GEN</con:PhoneLineType>
               <con:CreatedByModule>HZ_WS</con:CreatedByModule>
            </per:Phone>
            <per:Phone>
               <con:OwnerTableName>HZ_PARTIES</con:OwnerTableName>
               <con:PhoneCountryCode>1</con:PhoneCountryCode>
               <con:PhoneNumber>987-654-3212</con:PhoneNumber>
               <con:PhoneLineType>MOBILE</con:PhoneLineType>
               <con:CreatedByModule>HZ_WS</con:CreatedByModule>
            </per:Phone>            
         </typ:personParty>
      </typ:createPerson>
   </soapenv:Body>
</soapenv:Envelope>

After you run the payload, Copy the Party ID from the Response. Party ID = 300000030003058. This is the party ID of the Contact Point.

Step 2: Establishing a Relationship between the above created Contact and the Customer Account

First get the Party ID of the Customer to which this Contact Point is being assigned to using the following query:

select party_id from hz_cust_accounts where account_number = <account_number>     --> party_id = 100000001814997

WSDL: https://<yourservername>.oraclecloud.com/crmService/FoundationPartiesPersonService?WSDL

Payload:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://xmlns.oracle.com/apps/cdm/foundation/parties/personService/applicationModule/types/" xmlns:per="http://xmlns.oracle.com/apps/cdm/foundation/parties/personService/" xmlns:par="http://xmlns.oracle.com/apps/cdm/foundation/parties/partyService/" xmlns:sour="http://xmlns.oracle.com/apps/cdm/foundation/parties/flex/sourceSystemRef/" xmlns:con="http://xmlns.oracle.com/apps/cdm/foundation/parties/contactPointService/" xmlns:con1="http://xmlns.oracle.com/apps/cdm/foundation/parties/flex/contactPoint/" xmlns:par1="http://xmlns.oracle.com/apps/cdm/foundation/parties/flex/partySite/" xmlns:per1="http://xmlns.oracle.com/apps/cdm/foundation/parties/flex/person/" xmlns:rel="http://xmlns.oracle.com/apps/cdm/foundation/parties/relationshipService/" xmlns:org="http://xmlns.oracle.com/apps/cdm/foundation/parties/flex/orgContact/" xmlns:rel1="http://xmlns.oracle.com/apps/cdm/foundation/parties/flex/relationship/">
   <soapenv:Header/>
   <soapenv:Body>
      <typ:mergePerson>
         <typ:personParty>
            <!--PartyId of the Person/Contact-->
            <per:PartyId>300000030003058</per:PartyId>
            <per:Relationship>
               <rel:SubjectType>PERSON</rel:SubjectType>
               <rel:SubjectTableName>HZ_PARTIES</rel:SubjectTableName>
               <!--PartyId of the Organization/Customer to which this Contact is being assigned to-->
               <rel:ObjectId>100000001814997</rel:ObjectId>
               <rel:ObjectType>ORGANIZATION</rel:ObjectType>
               <rel:ObjectTableName>HZ_PARTIES</rel:ObjectTableName>
               <rel:RelationshipCode>CONTACT_OF</rel:RelationshipCode>
               <rel:RelationshipType>CONTACT</rel:RelationshipType>
               <rel:CreatedByModule>HZ_WS</rel:CreatedByModule>
               <rel:OrganizationContact>
                  <rel:CreatedByModule>HZ_WS</rel:CreatedByModule>
                  <rel:PrimaryCustomerFlag>true</rel:PrimaryCustomerFlag>
               </rel:OrganizationContact>
            </per:Relationship>
         </typ:personParty>
      </typ:mergePerson>
   </soapenv:Body>
</soapenv:Envelope>

From the response – copy the RelationshipId. 3000000300495. This is the RelationshipID. This establishes a relation between the Contact Party ID and the Account Party ID.

Step3: Until now – we have created a Contact (above step1). And have established a Relationship between the Customer and Contact. Now we have to assign the Contact to the Account.

Get the Cust account Id of the customer using the query below

select cust_account_id from hz_cust_accounts where account_number = <account_number> –> cust_account_id = 1000000018717

WSDL: https://<yourservername>oraclecloud.com/crmService/CustomerAccountService?WSDL

<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:mergeCustomerAccount>
         <typ:customerAccount>
            <!--CustomerAccountId for the Customer Account-->
            <cus:CustomerAccountId>1000000018717</cus:CustomerAccountId>
            <cus:CustomerAccountContact>
               <!--CustomerAccountId for the Customer Account-->
               <cus:CustomerAccountId>1000000018717</cus:CustomerAccountId>
               <cus:RoleType>CONTACT</cus:RoleType>
               <cus:CreatedByModule>HZ_WS</cus:CreatedByModule>
               <!--RelationshipId created in the first request-->
               <cus:RelationshipId>3000000300495</cus:RelationshipId>
            </cus:CustomerAccountContact>
         </typ:customerAccount>
      </typ:mergeCustomerAccount>
   </soapenv:Body>
</soapenv:Envelope>

Check the response of the webservice, and the Customer Account should have got created at the Customer Account level.

The same Customer Contact Point can also be created at the Customer Account Site Level. It needs an extra payload.

One Response to “Create Customer Contact Point at Account Level using SOAP Webservice- Oracle Fusion”

  1. <path_to_url> Guru

    Thanks for sharing. It was helpful.