I am developing an Android application to create a new quote in the vTiger server (ver. 5.4) CRM.
I managed to create a new quote, but the product_id and the quantity that I sent to add the quote to the details were not added to it. Other details are shown in the new quote, except for the list of products, their quantity and price.
I also studied the vtiger webservices tutorial , but in this case it did not help.
I found the accepted answer of a similar question , but it is phpnot in Android/JAVA.
Here's how I post the details needed to create a new quote on the vTiger server .: -
try {
objectJson.put("subject", subject);
objectJson.put("account_id", accountId);
objectJson.put("bill_street", address);
objectJson.put("assigned_user_id", "19x1");
objectJson.put("conversion_rate", "1.000");
objectJson.put("currency_id", "21x1");
objectJson.put("hdnTaxType", "group");
objectJson.put("productid", productId);
objectJson.put("quantity", quantity);
}
catch (JSONException e) {
e.printStackTrace();
}
String data = null;
try {
data = URLEncoder.encode("sessionName", "UTF-8")
+ "=" + URLEncoder.encode(sessionId, "UTF-8");
data += "&" + URLEncoder.encode("element", "UTF-8") + "="
+ URLEncoder.encode(objectJson.toString(), "ISO-8859-1");
data += "&" + URLEncoder.encode("elementType", "UTF-8") + "="
+ URLEncoder.encode(moduleName, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
String text = "";
BufferedReader reader=null;
try
{
URL url = new URL("http://vtiger_url/webservice.php?operation=create");
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
wr.write( data );
wr.flush();
}
catch(Exception ex)
{
}
The code above helps me generate a quote without product details.
php URL-, : http://vtiger_url/webservice.php?total=23000&operation=create. , .