User wants to create a revenue line for the product group 'Sample Catalog' (for e.g) whenever customer updates the opportunity using Groovy scripting (Doc ID 1965501.1)

Last updated on AUGUST 16, 2016

Applies to:

Oracle Fusion CRM Application Composer Cloud Service - Version 11.1.10.0.0 and later
Information in this document applies to any platform.

Goal

User wants to create a revenue line for the product group 'Sample Catalog' (for e.g) whenever he updates the opportunity.


ERROR
-----------------------
 Error : java.lang.NullPointerException




Application Composer > Application : Sales > Object > Standard Object > Opportunity > Server Scripts > Triggers > BeforeUpdate

Trigger Name : OptyRev

def optyname= Name
def vo= newView('OpportunityVO')
def vc = newViewCriteria(vo)
def vcr = vc.createRow()
def vci1 = vcr.ensureCriteriaItem('Name')
vci1.setOperator('=')
vci1.setValue(optyname)
vc.insertRow(vcr)
vo.appendViewCriteria(vc)
vo.executeQuery()
def Fst = vo.first();
def voQuoteItem= Fst.ChildRevenue
def rowQuoteItem = voQuoteItem.createRow();
rowQuoteItem.setAttribute('ProdGroupName','Sample Catalog');
rowQuoteItem.setAttribute('Quantity',1);
rowQuoteItem.setAttribute('UnitPrice',20.0);


Testing
-----------------

Simplified UI > Edit Opportunity > Update any standard / custom field > Error : java.lang.NullPointerException

And in Sales Coach > Products : Record was created by Quantity and Estimated Price is coming blank
 

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