Create a number sequence in a custom field on the lead
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;
Tagged:
0