I wrote this question up at RubyZoho's forum, but it's languishing there, and it's such a simple question it deserves a wider audience.
I have used RubyZoho to upload a new Lead record to the Zoho CRM API, and now I want to upload a Task with its "related to" field set to that Lead.
Configuring 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
Creating the lead:
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
Creating the Task:
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
I tried task.related_to = lead.leadid
, and got a Task record with a blank "related to" in the Zoho website. And when I try task.related_to = 'Lead'; task.relatedtoid = lead.leadid
, I get a undefined method relatedtoid=
, naturally because the variable has no setter.
So what am I missing? how do I do this simple thing?