在RubyZoho中,如何设置Task.related_to Lead.id?
|
我在
RubyZoho的论坛上写了这个问题,但它在那里萎靡不振,这是一个非常简单的问题,值得更多的观众.
我已经使用RubyZoho将新的Lead记录上传到Zoho CRM API,现在我想上传一个任务,其中“相关”字段设置为该Lead. 配置RubyZoho: RubyZoho.configure do |config|
config.api_key = Setting.plugin_redmine_tigase['zoho_authorization_token']
config.crm_modules = [
'Leads','Tasks'
]
config.ignore_fields_with_bad_names = true
config.cache_fields = true
end
创造领先优势: lead = RubyZoho::Crm::Lead.new lead.first_name = splut.first lead.last_name = splut.last lead.full_name = params[:name] lead.company = params[:company] lead.email = params[:mail] lead.description = description lead.save 创建任务: found = RubyZoho::Crm::Lead.find_by_email(params[:mail]) lead = found.first task = RubyZoho::Crm::Task.new task.related_to = lead.id task.subject = params[:subject] task.description = description task.save 我尝试了task.related_to = lead.leadid,并在Zoho网站上获得了一个空白的“相关内容”的任务记录.当我尝试task.related_to =’Lead’; task.relatedtoid = lead.leadid,我得到一个未定义的方法relatedtoid =,当然因为变量没有setter. 那我错过了什么?我该怎么做这个简单的事情? 解决方法
如果你查看文档,它有一个关于此的部分
https://www.zoho.com/creator/help/script/creating-a-record-in-zoho-crm.html#create-lead taskInfo = {
"Task Owner" : input.Owner_Name,"SMOWNERID" : input.Owner_ID,"Subject" : input.Subject,"Description" : input.Description,"SEMODULE" : "Accounts","SEID" : input.Account_ID,"CONTACTID" : input.Contact_ID};
crmResp = zoho.crm.create("Tasks",taskInfo);
另外,如果你看一下ruby_zoho_rspec来创建新任务 https://github.com/amalc/rubyzoho/blob/950ffe369252f8fad3e7ae67ebddec859c84e19b/spec/ruby_zoho_spec.rb it 'should save an task record related to an account' do
VCR.use_cassette 'zoho/task_related_to_account' do
a = RubyZoho::Crm::Account.all.first
e = RubyZoho::Crm::Task.new(
:task_owner => a.account_owner,:subject => "Task should be related to #{a.account_name} #{Time.now}",:description => 'Nothing',:smownerid => "#{a.smownerid}",:status => 'Not Started',:priority => 'High',:send_notification_email => 'False',:due_date => '2014-02-16 16:00:00',:start_datetime => Time.now.to_s[1,19],:end_datetime => '2014-02-16 16:00:00',:related_to => "#{a.account_name}",:seid => "#{a.accountid}",:semodule => 'Accounts'
)
r_expected = e.save
r = RubyZoho::Crm::Task.find_by_activityid(r_expected.id)
r.first.subject[0..20].should eq(r_expected.subject[0..20])
end
所以这应该通过指定SEMODULE和SEID帮助您链接它 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
