clipi / node-vtiger Goto Github PK
View Code? Open in Web Editor NEWVtiger API Connection Library for Node.js Applications
Vtiger API Connection Library for Node.js Applications
When I try to create a new user with role H1
(organization user) the callback is not fired:
vtiger.doCreate('Users', {
user_name : "johndoe",
user_password : "jnajsbchbweui",
confirm_password : "jnajsbchbweui",
last_name : "Doe",
first_name : "John",
roleid : "H1", // This is the organization role id
email1 : "[email protected]"
}, function (err, user) {
// Returns nothing because callback not run
console.log("Error:", err);
console.log("User:", user);
});
If I try with the same code changing roleid
to "H2" (CEO user), the callback is fired correctly without error and with new user object. Do you know why this happens?
Thanks in advance.
Hi there
I am trying to create a invoice with the following valueMap
{"subject":"Tax Invoice","customerno":"000102","invoicedate":"12-12-2013","account_id":"11x14","invoicestatus":"Created","assigned_user_id":"20x4","cf_701":9855,"bill_street":"Level 3, 606 St. Kilda Road","ship_street":"Level 3, 606 St. Kilda Road","bill_city":"Melbourne","ship_city":"Melbourne","bill_state":"Vic","ship_state":"Vic","bill_code":"3004","ship_code":"3004","bill_country":"AUS","ship_country":"AUS","description":"Billing Period: 032014\nDomain: ssdias\n ","terms_conditions":"Net 7","currency_id":"21x1","hdnTaxType":"group","LineItems":[{"productid":"25x133","quantity":40,"listprice":20,"tax4":10}],"productid":"25x133"}
but I get this error Unexpected token W at Object.parse(native) when I use
client.doCreate('Invoice', valueMap, response);
Any help will be appreciated.....
thanks
Rosie
Greetings,
In the main source of the node vtiger lib in the libe ~239 in the function doQuery you could change the escape() function to the query to encodeURI().
This is because the latin characters and other characters return error when you query them.
NodeVtigerWS.prototype.doQuery = function(query, callback) {
var params,
_this = this;
this.callback = callback;
this.log.trace('doQuery: ' + query);
if (!this.__checkLogin()) {
return this.__performCallback(this._lastError, false);
}
if (query.indexOf(";") === -1) {
query += ";";
}
params = '?operation=query&sessionName=' + this._wsSessionName + '&query=' + encodeURI(query);
this.log.trace(this._wsUrl + params);
request(this._wsUrl + params, function(e, r, body) {
return _this.__processResponse(e, r, body);
});
};
Is this correct? I have tested against my implementation of vtiger and it works the right way like this.
request(this._wsUrl + params, function(# e, r, body) {
var response;
if (e) {
_this.log.error("doLogin: request getChallenge -> error: " + (JSON.stringify(# error)));
_this._lastError = {
"error": {
"code": "ERROR_ON_REQUEST",
"message": "Error on request (get challenge)"
}
};
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.