Hello,
I use this code:
var v_oldorder = {!id};
var v_newarr = [];
var v_newnumber =
v_newarr['status'] = 65006;
v_newarr['ordern_ordernumber'] = 0;
var v_neworderid = rbv_api.cloneRecord("order", {!id}, v_newarr);
However the newly created order should get a number based upon the sequence that is in the ordernumber field.
Can someon help?
Hi guys, anything on this question?
Hello Guys, can anyone please give an answer on this question?
Regards, Wim
Sorry. Could you please elaborate your question?
Thanks
Srinivas
Hi Wim,
First of all, can you please stop creating new posts for the same issue over and over? I now had to search to find this original post with the actual description of your problem.
Having said that, this looks like a bug. The API for cloning a record does not seem to look at the 'special abilities' of an auto-number field. I tried the following things:
- Not adding the auto-number field to my array
- Add it as a question mark
- Add it as -1
All doesn't work (since the actual value -1/? is being used as the auto-number value).
As a workaround you can probably use createRecord (assigning the cloned values manually) without sending the auto-number value, that should work.
Original post in community.progress.com/.../91220
If your auto-number field is an integer field you could also do something like this I guess, otherwise, you'd need to cut out the integer part, add +1 and then add the characters to it again:
var v_newarr = []; var arr = rbv_api.selectQuery( "select AutoNumber from Order ORDER by AutoNumber DESC", 1); var numberpart = arr[0]; var number = numberpart[0]; v_newarr['Description'] = 'Clone Order'; v_newarr['AutoNumber'] = number + 1; createNewRecord(v_newarr); function createNewRecord(recarr) { rbv_api.cloneRecord("Order", {!id}, v_newarr); }
This apart from the fact that I think the clone api should be aware of auto-numbering....
|
What do you mean with a lot of code?
I am still doing the clone of the record, just offering the 'latest' auto-numbering field value by looking up the highest value available in the order object records. The description field you can forget about.
|