You need to sign in to do that
Don't have an account?
Cesar Ramirez Vasquez005391619375684564
How can i assign a different value to a string dynamically so everytime the user insert a record the value change +1 ?
I need to do this by apex code if it is possible i know you can just change the fiel type to auto number in SF, im just curious about a string field
I have a VF page to insert invoices, every invoice have multiple lines (a list fill with products by the user) if the invoiceID field is an autonumber, how can i get this value to insert the lines in the object line ? My method first insert an invoice then i create a loop to insert every line but i dont know how to get that number. My method looks is the following :
current_factura.Descuento__c = STR_DESC;
current_factura.Efectivo__c = false;
current_factura.Estado__c = 'Pagado';
current_factura.Fecha_y_Hora_de_Factura__c = system.now().addHours(-6);
current_factura.Forma_de_Pago__c = 'Tarjeta';
current_factura.Porcentaje__c = 0;
current_factura.Subtotal__c = total_str;
current_factura.Tarjeta__c = true;
current_factura.Total__c = total_final;
current_factura.Vuelto__c = 0;
insert(current_factura);
try{
for ( Producto__c C : CARRITO) {
Linea.Cantidad__c = C.CantidadExistencia__c;
//Linea.Descripcion__c = C.Descripcion__c;
Linea.Factura__c = current_factura.Consecutivo__c;
Linea.Monto_Colones__c = C.Precio__c;
Linea.Monto_Dolares__c = 0;
Linea.Producto__c = C.Codigo__c;
insert(Linea);
}
Thanks for your time !