Generate Unique Number For A Field (Doc ID 2195125.1)

Last updated on NOVEMBER 03, 2016

Applies to:

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

Goal

How is the following code generating numbers ?

def opty = newView('OpportunityVO');

def count = nvl(opty.getEstimatedRowCount(),0);
def newCount = count+1;
def yr = year(new Date());

def id = OptyId;
def id1 = right(id.toString(),3);

String input = newCount;
StringBuffer buf = new StringBuffer(input);

while (buf.length() < 5) {
 buf.insert(0, '0');
}

String output = buf.toString();

setAttribute('BidQuote_c',yr+'-'+output+''+id1);
 

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