当前位置:网站首页>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);
边栏推荐
- 【LeetCode】3. Merge two sorted lists · merge two ordered linked lists
- Worldview satellite remote sensing image data / meter resolution remote sensing image
- register关键字
- How does yarn link help developers debug NPM packages?
- OSPF experiment
- 超限黑客认知
- VMware virtual machine configuration static IP
- 【cocos creator】点击按钮切换界面
- Go language foundation ----- 04 ----- closure, array slice, map, package
- PHP common sorting algorithm
猜你喜欢
EtherCAT state machine transition (ESM)
[MySQL 12] MySQL 8.0.18 reinitialization
Iterm2 setting
Getting started with minicom
【LeetCode】2. Valid parentheses · valid parentheses
MAE
My touch screen production "brief history" 1
Unity XR realizes interaction (grasping, moving, rotating, transmitting, shooting) -pico
HDMI2.1与HDMI2.0的区别以及转换PD信号。
【cocos creator】点击按钮切换界面
随机推荐
[at] ABC 258g - triple Reach - violence
一篇文章让你读懂-曼彻斯特编码
jsutlis
Harmonyos third training notes
How does yarn link help developers debug NPM packages?
OSPF protocol summary
Pycharm remote ssh pyenv error: pydev debugger: warning: trying to add breakpoint to file that does
Pat grade a 1029 median
Huawei switches are configured with SSH login remote management switches
oracle 插入单引号
Usage of requests module
什么是数据类型?数据类型有什么用?
Oracle queries grouped by time
idea取消引用顯示效果
Redis查看客户端连接
Worldview satellite remote sensing image data / meter resolution remote sensing image
Redis profile
The difference between hdmi2.1 and hdmi2.0 and the conversion of PD signals.
Huawei switch: configure Telnet, SSH and web access
JS to implement publish and subscribe