Zoho CRM自定义功能Deluge脚本使用具有不同日期字段的年份更新日期字段

问题描述 投票:0回答:1

我正在尝试在Zoho CRM中创建一个自定义函数,该函数将获取发票记录,查看订阅时间段(开始日期和结束日期),并将小计划分为订阅月份。 (4月,5月,6月等)我正在尝试创建一个日期,该日期的常数为04/30,并从开始日期的年份或结束日期的年份开始添加年份,但是我在语法上遇到了麻烦。我认为if语句也可能有问题。抱歉,这完全是菜鸟。如果有人可以提供指导,将不胜感激。

这里是我到目前为止的代码

invoice_record = zoho.crm.getRecordById("Invoices", invoice_id);
start_date = invoice_record.get("Service Start Date");
end_date = invoice_record.get("Service End Date");
invoice_date = invoice_record.get("Invoice Date");
start_date_month = start_date.getMonth();
start_date_year = start_date.getyear ();
end_date_year = end_date.getyear();

// calculate how many months in the service period

service_length = start_date.monthsBetween(end_date);

//April Revenue Recognition

april_date_start_year_datestring = "04/30/" + start_date_year;

april_date_start_year = april_date_start_year_datestring.todate( "MM/dd/yyyy") ;

april_date_end_year_datestring = "04/30/" + end_date_year;

april_date_end_year = april_date_end_year_datestring.todate( "mm/dd/yyyy") ;

if (april_date_start_year >= start_date || april_date_end_year < = april_date_end_year ) 
{ rev_rec_april = "Sub Total" / service_length }
else
{rev_rec_april = 0}

invoice_record.put("April Revenue", rev_rec_april);

update_resp = zoho.crm.updateRecord("invoices", invoice_id.toString(), invoice_record);
crm zoho custom-function deluge
1个回答
0
投票
如果以后发现有人有用,这就是最终的结果:
© www.soinside.com 2019 - 2024. All rights reserved.