Groovy On Partner Edit Giving Error (Doc ID 2163010.1)

Last updated on JULY 20, 2016

Applies to:

Oracle Fusion Sales Cloud Service - Version 11.1.11.1.0 and later
Information in this document applies to any platform.

Symptoms

On : 11.1.11.1.0 version, Partner Management

the following script works when a partner record is created. but when partner name is updated, this fails to write (value to a custom field) and shows error.

BeforeUpdate trigger
*********************************

def sFieldName = ''
def sNewValue = ''
def sOldValue = ''
if(isAttributeChanged('OrganizationName'))
{
sFieldName = 'Partner Name'
sNewValue = OrganizationName
sOldValue = getOriginalAttributeValue('OrganizationName')
CreateRequestHistory(sNewValue,sOldValue,sFieldName)
}

Function CreateRequestHistory
**************************

def StatusAction
if(getPrimaryRowState().isNew()==true)
{
StatusAction='INSERT'
}
else
{
StatusAction='UPDATE'
}
def requestHistory = PartnerAuditTrailCollection_c
def requestHistoryRow = requestHistory.createRow()
requestHistoryRow.setAttribute('Action_c',StatusAction)
requestHistoryRow.setAttribute('NewValue_c',NewValue)
requestHistoryRow.setAttribute('OldValue_c',OldValue)
requestHistoryRow.setAttribute('FieldName_c',FieldName)
requestHistoryRow.setAttribute('EmailID_c',adf.context.getSecurityContext()?.getUserProfile()?.getBusinessEmail())

requestHistory.insertRow(requestHistoryRow)

tried inserting println and reproduced again

def sFieldName = ''
def sNewValue = ''
def sOldValue = ''
def sTestVal = getPrimaryRowState().isNew()
println(sTestVal);
println('HariTest OrgName');
if (sTestVal == false)
{
println('Inside Primary equal to fals OrgName');
if(isAttributeChanged('OrganizationName'))
{
println('Inside Partyname attribute condition OrgName');
sFieldName = 'Partner Name'
println('Inside Partyname after FieldName');
sNewValue = OrganizationName
println('Inside Partyname after NewValue');
println(sNewValue);
sOldValue = getOriginalAttributeValue('PartyName')
println('Inside Partyname after getoriginal');
println(sOldValue);
CreateRequestHistory(sNewValue,sOldValue,sFieldName)
println('after create history');
}
}



Cause

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