My Oracle Support Banner

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

Last updated on DECEMBER 22, 2020

Applies to:

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


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.

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)
revnLine =
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')



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

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


To view full details, sign in with your My Oracle Support account.

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

In this Document

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.