vtiger 0.6.6 → 0.6.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/vtiger/commands.rb +23 -0
- metadata +3 -3
data/lib/vtiger/commands.rb
CHANGED
@@ -149,6 +149,29 @@ module Vtiger
|
|
149
149
|
|
150
150
|
return success,self.object_id
|
151
151
|
end
|
152
|
+
def query_element_by_field(element,field,name)
|
153
|
+
puts "in query element by field"
|
154
|
+
action_string=ERB::Util.url_encode("select id from #{element} where #{field} like '#{name}';")
|
155
|
+
# puts "action string:" +action_string
|
156
|
+
res = http_ask_get(self.endpoint_url+"operation=query&sessionName=#{self.session_name}&query="+action_string)
|
157
|
+
values=res["result"][0] if res["success"]==true #comes back as array
|
158
|
+
success = false
|
159
|
+
#puts values.inspect
|
160
|
+
# return the account id
|
161
|
+
self.object_id = 'failed'
|
162
|
+
if values!= nil
|
163
|
+
self.object_id=values["id"]
|
164
|
+
success=true
|
165
|
+
# self.account_name=values["accountname"]
|
166
|
+
end
|
167
|
+
return success,self.object_id
|
168
|
+
end
|
169
|
+
def query_account_by_name(name)
|
170
|
+
puts "in query account by name"
|
171
|
+
element='Accounts'
|
172
|
+
field='accountname'
|
173
|
+
query_element_by_field(element,field,name)
|
174
|
+
end
|
152
175
|
def find_tt_by_contact(contact)
|
153
176
|
puts "in query tt by contact"
|
154
177
|
action_string=ERB::Util.url_encode("select id,ticket_no from HelpDesk where parent_id = '#{contact}';")
|
metadata
CHANGED