<div dir="ltr"><div dir="ltr"><div>Its correct, but at that moment I dont have a invoice_id. My concern is that with vtiger 8.3 it works fine. And the difference between 8.3 and 8.4 in the code is that.</div><br></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">El vie, 18 jul 2025 a las 20:07, Rubén A. Estrada Orozco (<<a href="mailto:rulotec1@gmail.com">rulotec1@gmail.com</a>>) escribió:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">You should do a print_r of the whole $data array to see the actual contents. You have a $productos variable in the LineItems element. Since the error is here "Stack trace: #0 /vtiger/include/Webservices/LineItem/VtigerInventoryOperation.php(469)" I suspect it's one of your line items that's causing the problem. <br><div><br></div><div>You could also do a print_r of the $element parameter in VtigerInventoryOperation::constructFocusObject($element)</div><div><br></div><div><img src="cid:ii_md9lufkb0" alt="image.png" width="562" height="271"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jul 18, 2025 at 6:02 PM Alexander Allen <<a href="mailto:alexander.allenz@gmail.com" target="_blank">alexander.allenz@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">Is in line_items. Id is the invoice id but in invoice creation there is not an id until its created. <br clear="all"><br clear="all"><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><img width="420" height="117" src="https://ci3.googleusercontent.com/mail-sig/AIorK4yBdmjOS3mPpyoN3v1oMNsorQHB14uqYh2SXudDQ3eKNI4wf_M5lw2YMsnrgDY4mPzddZ_rHNM6Ldxf"><br></div></div></div></div><div><br></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 18 Jul 2025 at 5:57 PM Rubén A. Estrada Orozco <<a href="mailto:rulotec1@gmail.com" target="_blank">rulotec1@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I presume that the id you are passing as a parameter might be empty.<div><br></div><div>It seems the change in code aimed at validating the input parameter passed to the function. I would change the exception message to:</div><div><br></div><div><span style="color:rgb(255,0,0)">throw new WebServiceException(</span><span style="color:rgb(255,0,0)">WebServiceErrorCode::$</span><span style="color:rgb(255,0,0)">INVALIDID,"Id specified is incorrect ->" . print_r($elementid, true) . "<-");</span></div><div><span style="color:rgb(255,0,0)"><br></span></div><div>and see what gets printed out. But my guess would be an empty $elementid.<span style="color:rgb(255,0,0)"></span></div></div><br><div class="gmail_quote"></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jul 18, 2025 at 11:52 AM Alexander Allen <<a href="mailto:alexander.allenz@gmail.com" target="_blank">alexander.allenz@gmail.com</a>> wrote:<br></div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"></blockquote></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>I'm trying to create an Invoice from webservice. I can create as example products but the error is when it loads lineitems. This is part of my code:</div><div><span style="color:rgb(255,0,0)"><br></span></div><div><span style="color:rgb(255,0,0)">include_once 'include/Webservices/Create.php';</span></div><div><span style="color:rgb(255,0,0)"> $data = array (<br> 'subject' => 'Pedido',<br> 'productid' => '14x23683',<br> 'ship_street' => $direccion,<br> 'ship_state' => $cliente,<br> 'currency_id' => $moneda,<br> 'account_id' => $clientId,<br> 'invoicestatus' => 'Cancel',<br> 'assigned_user_id' => $propietario, // 19=Users Module ID, 1=First user Entity ID <br> 'LineItems'=>$productos,<br><br> );<br>vtws_create('Invoice', $data, $current_user);</span><br><br></div><div>I get this error </div><div>
<b>Fatal error</b>: Uncaught WebServiceException: Id specified is
incorrect in
/vtiger/include/Webservices/Utils.php:127
Stack trace:
#0
/vtiger/include/Webservices/LineItem/VtigerInventoryOperation.php(469):
vtws_getIdComponents('')
#1 <br><br></div><div>I found that vtiger changes function vtws_getIdComponents in include/Webservice/Utils.php from this:</div><div><br></div><div><span style="background-color:rgb(255,255,255);color:rgb(255,0,0)">function vtws_getIdComponents($elementid){<br> return explode("x",$elementid);<br>}</span></div><div><span style="background-color:rgb(255,255,255);color:rgb(255,0,0)"><br></span></div><div><span style="background-color:rgb(255,255,255);color:rgb(0,0,0)">to this: </span><span style="background-color:rgb(255,255,255);color:rgb(0,0,0)"><br></span></div><div><br><span style="color:rgb(255,0,0)">function vtws_getIdComponents($elementid){<br> $elementid = (string)$elementid;<br></span><span style="color:rgb(255,0,0)"><br> if ($elementid && is_numeric($elementid)) return array($elementid); // during (UserId permission check)<br><br><br> if (!$elementid || !preg_match("/[0-9]+x[0-9]+/", $elementid)) {<br> throw new WebServiceException(WebServiceErrorCode::$INVALIDID,"Id specified is incorrect");<br> }<br></span> <span style="color:rgb(255,0,0)"><br> return explode("x",$elementid);<br>}</span></div><div><span style="color:rgb(255,0,0)"><br></span></div><div><font color="#000000">Does someone know why this change has made or is an error?</font></div></div></blockquote></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
_______________________________________________<br>
<a href="http://www.vtiger.com/" rel="noreferrer" target="_blank">http://www.vtiger.com/</a></blockquote></div>
_______________________________________________<br>
<a href="http://www.vtiger.com/" rel="noreferrer" target="_blank">http://www.vtiger.com/</a></blockquote></div></div>
_______________________________________________<br>
<a href="http://www.vtiger.com/" rel="noreferrer" target="_blank">http://www.vtiger.com/</a></blockquote></div>
_______________________________________________<br>
<a href="http://www.vtiger.com/" rel="noreferrer" target="_blank">http://www.vtiger.com/</a></blockquote></div></div>