有没有办法检查下一个事件是否包含标题中的术语?
我制作了一个脚本,该脚本在用户提交表单之后,根据此条件更新事件标题:
for(var j=0; j<events.length;j++){
var ev = events[j];
if(!ev.getTitle().includes("Returned"){ ...
我希望脚本检查是否有一个或多个事件包括“返回”一词,但仅在下一个事件中。
例如,如果事件标题不包括“返回”,则条件应为错误,而下一个事件标题都不包括“返回”。
有可能吗?我尝试创建一个变量evnext =事件[J+1]
,但是一旦到达最后一个事件,我当然会出现错误。
谢谢您的帮助,我觉得这很可行,但是我对循环的理解太低了...
编辑:我的目标的详细信息
实际上我的脚本将电子邮件发送给所有借用设备的人但没有确认他们还退还了它。
现在的问题是,我想向这些人发送一封电子邮件,除非其他人之后将其返回。
这确实意味着,即使是第一个借款人也没有确认他将其归还,这一事实是,接下来将其标记为回报的人证明了第一个人实际上返回了设备。
否则,下一个家伙将不可能退还它。
I have made a script that updates events title after an user submits a form, based on this condition:
for(var j=0; j<events.length;j++){
var ev = events[j];
if(!ev.getTitle().includes("Returned"){ ...
I want the script to check if there is one or many events that include the term "Returned", but only among the next events.
For example, the condition should be false if an event title does not include "Returned" AND none of the next events titles include "Returned".
Is that possible? I tried with creating a variable evnext = events[j+1]
but of course I get an error once it gets to the last event.
Thank you for your help, I feel it is very doable but my understanding of loops is sadly too low ...
Edit: details on my goal
Actually my script sends an email to all people who borrowed an equipment but did not confirm they returned it.
The problem now is that I would like to send an email to these people EXCEPT IF someone else returned it afterwards.
It would indeed mean that even the first borrower did not confirm he returned it, the fact that someone who took it next and marked it as returns proves that the first person actually returned the equipment.
Otherwise it would not have been possible for the next guy to return it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
怎么样:
How about this:
您可以尝试以下脚本:
在此示例中,脚本为当前日期,如果事件在其标题上“返回”并返回false,则在即将到来的30天的特定日历的日常检查。
让我知道这是否有帮助。如果需要,我也可以修改脚本。您可以修改30天的限制,并根据您的需求而定。不要忘记将日历ID更改为您当前正在使用的保存事件的ID。
参考:
You can try the following script:
In this example the script takes the current date and starts checking day by day of a specific calendar for the upcoming 30 days if an event has the word "Returned" on its title and returns False if not.
Let me know if this helps. I can also modify the script if needed. You can modify the 30 days limit, and the initial date depending on your needs. Do not forget to change the calendar ID to the one you are currently using to save the events.
References: