当前位置:网站首页>Zohocrm deluge function application time verification
Zohocrm deluge function application time verification
2022-07-03 07:56:00 【hjm2046】
About Deluge
Zoho Proprietary scripting languages can handle any task that developers may have to perform . With the built-in wrapper and powerful execution engine , It has developed into the fastest , One of the most flexible scripting languages .( Official introduction of automatic translation results )
What am I going to do this time
Use ZohoCRM Less than 3 Months , I want to configure a field validation rule , Ensure that the end time must be greater than the start time .
Implementation steps
Find a feasible way
Chinese service providers suggest that I use function verification to realize , They charge for their services , So you can only tell me how to achieve , I want to study and realize by myself .
I'm best at drumming scripts , Then start tapping into the document , Of course, before knocking, I still thought about the logic of implementation repeatedly , Although this is not complicated .
The logic of function implementation
When saving and editing forms , Verify the relationship between start time and end time .
- The verification end time must be greater than the start time .
- The validation start time must be less than the end time .
Assign the above function verification to the verification logic of the end time and the start time respectively .
Implemented code
Zoho deluge
entityMap = crmAPIRequest.toMap().get("record");
// field17,field16 Refer to the following figure for confirmation of
endTime = entityMap.get("field17").toTime("yyyy-MM-dd'T'HH:mm:ss");
startTime = entityMap.get("field16").toTime("yyyy-MM-dd'T'HH:mm:ss");
response = Map();
if(endTime > startTime)
{
response.put('status','success');
}
else
{
response.put('status','failure');
response.put('message',' The service start time cannot be later than the end time .');
}
return response;
The name of the confirmation field needs to be in the developer space API Look inside .
The pit I stepped on
It can be done by itself , As a result, it took a lot of time to find zoho Official customer service , Official customers can contact online directly , Very convenient , Timely service , Enthusiasm , Have a craigslist , Help write code , The function code provided by them is attached at the end of the article .
Why did it take so much time ? The code is so simple .
At first, my code was written like this , No addition “yyyy-MM-dd’T’HH:mm:ss”, The instructions didn't say to add .
The only time to get the result is the date , Time is 00:00:00
endTime = entityMap.get("field17").toDateTime();
startTime = entityMap.get("field16").toDateTime();
The official customer service is very friendly , But I haven't seen this problem , Gave me a verification code with more complex logic , Let me test , It was not solved until the second time , You must also use it when you are remote zoho join, That's called a card , Often say can't control .
TeamViewer Already done so well , Can't it be compatible ?
Zoho Official function verification code
entityMap = crmAPIRequest.toMap().get("record");
d2 = entityMap.get("field16").toDateTime();
d1 = entityMap.get("field6").toDateTime();
response = Map();
diff = d1.daysBetween(d2);
if(diff > 0)
{
response.put('status','success');
}
else if(diff == 0)
{
hdiff = d1.hoursbetween(d2);
if(hdiff == 0)
{
m1 = d1.getMinutes();
m2 = d2.getMinutes();
h1 = d1.getHour();
h2 = d2.getHour();
if(h1 < h2)
{
response.put('status','success');
}
else if(h1 == h2)
{
m = m1 - m2;
if(m >= 0)
{
response.put('status','failure');
response.put('message','end Time should earlier then start time.');
}
}
}
else
{
response.put('status','success');
}
}
else if(diff < 0)
{
response.put('status','failure');
response.put('message','end Time should earlier then start time.');
}
return response;
My proposal
Write the document clearly , Hello , I am good. , Hello everyone , Self help problem solving , How much time is saved .
In line with the principle of benefiting future generations , I'll give it to zoho Made some comments , I hope to strengthen the instructions , But the reply is that this is because CRM The time is ISO Time , Format must be specified , There's no next problem .
Then I'll write it down and share it , I hope it can save you a little time .
The official reply is as follows , For your reference :
Please find the below clarifications from the deluge team
toTime() and toTime(yyyy-MM-dd’T’HH:mm:ss); and toDateTime(yyyy-MM-dd’T’HH:mm:ss); -->These are same, but will differ for the from format.On conversion of the format, ie From which format to which format , it will be differ.
zoho.currenttime.toTime();
from CRM field, we will display fields in ISO format so have to use the below format.
endTime = entityMap.get(“field16”).toDateTime(yyyy-MM-dd’T’HH:mm:ss);
边栏推荐
- JS regular case-
- OSPF protocol summary
- [at] ABC 258g - Triangle triples reachable - violence
- Huawei switch: configure Telnet, SSH and web access
- Worldview satellite remote sensing image data / meter resolution remote sensing image
- Go language foundation ------ 12 ------ JSON
- Microsoft Security Response Center
- 什么是数据类型?数据类型有什么用?
- Go language foundation ----- 08 ----- interface
- Go language - loop statement
猜你喜欢

What to do after the browser enters the URL

Ventuz Foundation Series "one step at the door"

Go language foundation ----- 19 ----- context usage principle, interface, derived context (the multiplexing of select can be better understood here)

创业团队如何落地敏捷测试,提升质量效能?丨声网开发者创业讲堂 Vol.03
![[cocos creator] Click the button to switch the interface](/img/b8/f0fd54a2a197cbfd788990e2806b52.png)
[cocos creator] Click the button to switch the interface

haproxy+keepalived集群搭建02

Pat class a 1032 sharing

Pat grade a 1029 median

【LeetCode】4. Best time to buy and sell stock

【LeetCode】3. Merge two sorted lists · merge two ordered linked lists
随机推荐
华为交换机配置ssh登录远程管理交换机
regular expression
Huawei switch: configure Telnet, SSH and web access
优质博客——
Idea unreference Display Effect
What is definition? What is a statement? What is the difference between them?
An article for you to understand - Manchester code
Go language foundation ----- 03 ----- process control, function, value transfer, reference transfer, defer function
Ventuz Foundation Series "one step at the door"
JS to implement publish and subscribe
How does yarn link help developers debug NPM packages?
一个实习生的CnosDB之旅
Go language foundation ----- 15 ----- reflection
华为交换机Console密码重置、设备初始化、默认密码
【cocos creator】点击按钮切换界面
PDO and SDO concepts
[MySQL 12] MySQL 8.0.18 reinitialization
Huawei switch basic configuration (telnet/ssh login)
Redis profile
华为交换机基础配置(telnet/ssh登录)