Create Contact Address Using Groovy (Doc ID 1905068.1)

Last updated on FEBRUARY 26, 2016

Applies to:

Oracle Fusion Customer Center Cloud Service - Version 11.1.8.0.0 to 11.1.9.2.0 [Release 1.0]
Information in this document applies to any platform.

Goal

How to Create Contact Address Using Groovy?

Below script is erroring out to save Account address on Contact after save.

Script
if(PrimaryCustomerId!=null){
def account = newView('SalesAccountVO')
def vc = account.createViewCriteria()
def vcr = vc.createRow()
def vci1 = vcr.ensureCriteriaItem('PartyId')
vci1.setOperator('=')
vci1.setValue(PrimaryCustomerId)
vc.insertRow(vcr)
account.appendViewCriteria(vc)
account.executeQuery()
while(account.hasNext()){
def accRecords1 = account?.next()

def pname1=accRecords1?.ParentParty?.PartyUniqueName

setAttribute('PrimaryAddressLine1',accRecords1?.Address1)
setAttribute('PrimaryAddressLine2',accRecords1?.Address2)
setAttribute('PrimaryAddressCity',accRecords1?.City)
setAttribute('PrimaryAddressState',accRecords1?.State)
setAttribute('PrimaryAddressPostalCode',accRecords1?.PostalCode)
}
}


Error Message:
Exception in expression "PersonDEO" trigger "BU_UpdateContactAddress" : oracle.jbo.ReadOnlyAttrException JBO-27008: Attribute PrimaryAddressLine1 in view object PersonDVO cannot be set.
 

 

Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms