W
Wim
Guest
Hello, Part of the cloning effort is also to get a new ordernummer through an automatic number-field. So i need to update that autonumber field, which is not possible through cloning (that is a bug as i understood). By using a mapping this is not possible (update autonumber field). And by using this mapping only a boolean is avail. I would need something like: var v_invoiceorderid = {!id}; var v_num = rbv_api.selectNumber("select ordern_ordernumber from order ORDER by createdAt DESC"); var v_num_orderline = 0; rbv_api.printArr(v_num); // We only want to be able to make a credit order if this order // has not yet been credited before if('{!orderl_iscredited}' !== true) { var v_arr = new Array(); v_arr['ordern_ordernumber'] = v_num + 1; v_arr['status'] = 109964; // aangemaakt v_arr['orderm_axstatus'] = ""; v_arr['R_order_orderline'] = 0; v_arr['R_order_ordertyre'] = 0; v_arr['R_order_orderlinedetail'] = 0; rbv_api.printArr(v_arr); rbv_api.cloneRecord("order", v_invoiceorderid, v_arr); // de huidige order krijgt een vinkje dat ie gecrediteerd is rbv_api.setFieldValue("order", v_invoiceorderid, "orderl_iscredited", true); rbv_api.setFieldValue("order", v_invoiceorderid, "ordern_creditedbyordernumber", (v_num + 1)); /* // Find the order that is the cloned one (the credit order) var v_newordernum = v_num + 1; var v_creditorderid = rbv_api.selectNumber("SELECT id FROM order where ordern_ordernumber=?", v_newordernum); rbv_api.println("De nieuwe order is: " + v_creditorderid); // now we need to have the related orderlines of the first order var v_orderlineids_invoiced = []; v_orderlineids_invoiced = rbv_api.getRelatedIds("R295312", v_invoiceorderid); //rbv_api.printArr(v_orderlineids_invoiced); //rbv_api.println(v_orderlineids_invoiced.length); var v_orderline_quantity = 0; var v_orderlineid = 0; var v_num_orderline = 0; var v_arrorderline = new Array(); for(i=0; i<v_orderlineids_invoiced.length; i++) { // The orderline that is related to the first (invoiced) order v_orderlineid = v_orderlineids_invoiced; rbv_api.println(v_orderlineid); // find the quantity of that orderline v_orderline_quantity = rbv_api.selectNumber("select orderlinea_quantity from orderline WHERE id=?", v_orderlineid); // Find the latest orderline for a numberupdate v_num_orderline = rbv_api.selectNumber("select orderlinen_linenumber from orderline ORDER by createdAt DESC"); // Set the needed variables v_arrorderline['orderlinen_linenumber'] = v_num_orderline + 1; v_arrorderline['orderlinea_quantity'] = (0 - v_orderline_quantity); v_arrorderline['orderlinen_orderid'] = v_creditorderid; rbv_api.printArr(v_arrorderline); // Clone the record rbv_api.cloneRecord("orderline", v_orderlineid, v_arrorderline); } */ } // end if({!orderl_iscredited} !== true) If possible please help. Regards, Wim Van: mpiscoso@gmail.com [mailto:bounce-mpiscosogmailcom@community.progress.com] Verzonden: maandag 21 november 2016 14:58 Aan: TU.Rollbase@community.progress.com Onderwerp: RE: [Technical Users - Rollbase] Cloning a record Update from Progress Community mpiscoso@gmail.com How are you cloning the records? I think that your requirement needs a Workflow action, a create new record trigger, and a data map. Setup the create new record trigger to use your data map then setup the workflow action to run the create new record trigger. *** Data maps support cloning of related records per your requirement. You should see the relationships that allow you to choose which should be cloned and which shouldn't at the bottom of your data map. Hope this helps. View online You received this notification because you subscribed to the forum. To unsubscribe from only this thread, go here . Flag this post as spam/abuse.
Continue reading...
Continue reading...