Yes I think you are right. I'm going to talk to the person who asked me to run in the onBeforeLock.
Also, if you notice, I can't use "this", I have to do a "get", lines 6 to 9, even though I have the data on the screen. This happens to me sometimes. Because either I receive a null value, or it tells me "Not a single Item"
In the end, for now, what I did was create a property in the itemType "skipOnBeforeLock" and I used the code that you proposed. It works perfectly. it's like a fake property, but with the created property.
2 days fighting with ARAS, for 40 lines of code, OMG!!!
Thank you very much for your help!!! Thank you!!
[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:c76eba03-8854-4078-b6b0-911c9bd67ccb:type=xml&text=Innovator%20innovator%20%3D%20this.getInnovator%28%29%3B%0A%0Avar%20ID%20%3D%20this.getID%28%29%3B%0A%0A%2F%2F%20cogemos%20los%20datos%20de%20cantidad%20y%20el%20PN.%20No%20puedo%20usar%20un%20this%2C%20es%20el%20lado%20del%20servidor%2C%20Es%20por%20el%20tipo%20de%20evento%20desde%20donde%20es%20llamado%0Avar%20Datos_MAT_SUM%20%3D%20innovator.applyAML%28%22%3CAML%3E%3CItem%20type%3D%27MP_MAT_SUM%27%20action%3D%27get%27%3E%3Cid%3E%22%2BID%2B%22%3C%2Fid%3E%3C%2FItem%3E%3C%2FAML%3E%22%29%3B%20%0Avar%20Cantidad%20%3D%20Datos_MAT_SUM.getProperty%28%22mp_matsum_quant%22%2C%22NO%20CANTIDAD%22%29%3B%0Avar%20Origen%20%3D%20Datos_MAT_SUM.getProperty%28%22mp_matsum_orig%22%2C%22NO%20ORIGEN%22%29%3B%0Avar%20skipOnBeforeLock%20%3D%20Datos_MAT_SUM.getProperty%28%22skiponbeforelock%22%2C%22%22%29%3B%20%0A%0Aif%20%28skipOnBeforeLock%20%3D%3D%20%221%22%29%20return%20this%3B%0A%0A%2F%2F%20primero%20comprobamos%20que%20no%20exista%20ya%20un%20RM%20para%20este%20MAT.%20SUM.%0Avar%20codigoAML%20%3D%20%22%3CAML%3E%3CItem%20type%3D%27MT%20ProdRef%27%20action%3D%27get%27%20select%3D%27mp_prodref_mat%27%3E%3Cmp_prodref_mat%3E%22%2BID%2B%22%3C%2Fmp_prodref_mat%3E%3C%2FItem%3E%3C%2FAML%3E%22%3B%0Avar%20SentenciaRM%20%3D%20%20innovator.applyAML%28codigoAML%29%3B%0A%0Aif%20%28SentenciaRM.getItemCount%28%29%20%3E%200%20%29%20return%20this%3B%0A%0A%2F%2F%20si%20no%20existe%2C%20continuamos%20con%20el%20proceso.%0A%0A%2F%2F%20cogemos%20el%20indice%20del%20PART%0Avar%20DatosPART%20%3D%20innovator.applyAML%28%22%3CAML%3E%3CItem%20type%3D%27Part%27%20action%3D%27get%27%20select%20%3D%27mt_par_index%27%3E%3Cid%3E%22%2BOrigen%2B%22%3C%2Fid%3E%3C%2FItem%3E%3C%2FAML%3E%22%29%3B%20%0Avar%20Indice%20%3D%20DatosPART.getProperty%28%22mt_par_index%22%2C%220%22%29%3B%0A%0A%2F%2FCreamos%20el%20RM%20y%20le%20asociamos%20el%20MAT.%20SUM.%0AcodigoAML%20%3D%20%22%3CAML%3E%3CItem%20type%3D%27MT%20ProdRef%27%20action%3D%27add%27%3E%3Cmp_prodref_mat%3E%22%2BID%2B%22%3C%2Fmp_prodref_mat%3E%3Cmt_proref_pn%3E%22%2BOrigen%2B%22%3C%2Fmt_proref_pn%3E%3Cmt_proref_index%3E%22%2BIndice%2B%22%3C%2Fmt_proref_index%3E%3Cmt_proref_qinit%3E%22%2BCantidad%2B%22%3C%2Fmt_proref_qinit%3E%3Cmt_proref_quant%3E0%3C%2Fmt_proref_quant%3E%3Cmt_proref_qused%3E0%3C%2Fmt_proref_qused%3E%3Cmt_proref_qfree%3E%22%2BCantidad%2B%22%3C%2Fmt_proref_qfree%3E%3C%2FItem%3E%3C%2FAML%3E%22%3B%0Avar%20SentenciaAML%20%3D%20%20innovator.applyAML%28codigoAML%29%3B%0A%0A%2F%2F%20le%20asignamos%20al%20MAT.%20SUM.%20el%20RM%20creado%0Avar%20id_RM%20%3D%20SentenciaAML.getProperty%28%22id%22%2C%22NO%20ID%22%29%3B%0A%0A%2F%2FA%C3%B1adimos%20el%20codigo%20del%20RM%20y%20su%20estado%20en%20MAT%20SUM%0AcodigoAML%20%3D%20%22%3CAML%3E%3CItem%20type%3D%27MP_MAT_SUM%27%20action%3D%27edit%27%20id%3D%27%22%2BID%2B%22%27%3E%3Cmp_matsum_rm%3E%22%2Bid_RM%2B%22%3C%2Fmp_matsum_rm%3E%3Cskiponbeforelock%3E1%3C%2Fskiponbeforelock%3E%3C%2FItem%3E%3C%2FAML%3E%22%3B%0ASentenciaAML%20%3D%20%20innovator.applyAML%28codigoAML%29%3B%0A%0A%2F%2Freturn%20innovator.newError%28%22ERROR%3A%20Ya%20existe%20un%20RM%20para%20este%20Material%20Suministrado.%20%22%2B%20SentenciaRM%29%3B%0Areturn%20this%3B%0A%0A%0A%0A%0A]