Let's Reconnect, thank you for making 2022 our best year yet.

Look Back
Create a number sequence in a custom field on the lead — Cloud Customer Connect
You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Create a number sequence in a custom field on the lead

Received Response
11
Views
1
Comments
in Sales 1 comment

How to generate a number sequence every time the user creates a new lead?

In Opportunities, create a trigger to have the following sequence: last two digits of the current year + Numerical sequence

def currYear = year(today());

def vo = newView('OpportunityVO');

def vc = newViewCriteria(vo);

def vcr = vc.createRow(); NDeProyecto_c

def vci1 = vcr.ensureCriteriaItem('NDeProyecto_c');

vci1.setOperator('>');

vci1.setValue(0);


def vci2 = vcr.ensureCriteriaItem('OptyCreationDate');

vci2.setOperator('AFTER');

vci2.setValue(dateTime(currYear,01,01,01,01));

vc.insertRow(vcr);

vo.setSortBy('OptyCreationDate desc');

vc.insertRow(vcr);

vo.appendViewCriteria(vc);

vo.executeQuery();


def linha = vo.first();

println(linha);

if(linha != null){

 def id = linha.NDeProyecto_c;

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!