Error In Loop Revenue Line Records - Groovy Script (Doc ID 2248282.1)

Last updated on JULY 28, 2017

Applies to:

Oracle Fusion Sales Cloud Service - Version 11.1.10.0.0 to 11.1.11.1.0 [Release 1.0]
Information in this document applies to any platform.

Symptoms

Error in Loop Revenue Line Records - Groovy Script

Added an object trigger that checks Revenue Line's status and updates the Oppty Header status

Logic: Loop all revenue lines, if all revenue line status is "LOST", Opportunity Sales Stage should be set to Closed.
Object Trigger Created (Opportunity), Before Update in Database

What is working:
1. The script works if there's only 1 Revenue Line. Loops all parent and child revenue lines as expected.

STEPS
-----------------------
The issue can be reproduced at will with the following steps:

Login to OSC --> Application composer --> server scripts --> create a grooy script

Script Used:

def revnLine=null
def revnId=null
def status=null
def RecurType=null
def SalesStageId=null
def SalesStage=null
def Counter = 0
def revenueLines=nvl(ChildRevenue,null)
if(revenueLines != null)
{
revenueLines.reset()
while(revenueLines.hasNext())
{
revnLine = revenueLines.next()
revnId = revnLine.getAttribute('RevnId')
status = revnLine.getAttribute('StatusCode')
  RecurType = revnLine.getAttribute('RecurTypeCode')
SalesStageId = getAttribute('SalesStageId')
SalesStage = getAttribute('SalesStage')
//count if revenue line has status not equal to LOST and Recurring Type = PARENTRECUR
if(status!='LOST' && RecurType=='PARENTRECUR')
{
Counter = Counter + 1
}
}

if(Counter == 0)
{
//sets Opportunity SalesStage to 07 - Closed.
setAttribute('SalesStageId', '300000003169030')
}
}



 

ERROR
-----------------------

An application error had encountered, please see the incident log for more details


BUSINESS IMPACT
-----------------------
The issue has the following business impact:
Due to this issue, users cannot save the opportunities with multiple revenue items

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