|
问题:如何设置跟进记录模块的下次回访日期必须大于联系日期
解决方法:在CRM数据库中执行该脚本,执行脚本后需要清除软件缓存刷新。
-- 跟进记录的下次回访日期必须大于联系日期
SET @module='ContactRecords'; -- 指定参数:模块
SET @fieldname='nextcontactdate'; -- 指定参数:列名
SET @comparator='h'; -- 比较关系:h表示必须大于等于
SET @relatefieldname='contactdate'; -- 被比较的字段:列名
SET @tabid=(SELECT tabid FROM ld_tab WHERE `name`=@module);
INSERT INTO ld_validatasave(module,relatedtable,fieldname,comparator)
SELECT @module,'ld_field',@fieldname,@comparator FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM ld_validatasave WHERE module=@module AND relatedtable='ld_field' AND fieldname=@fieldname AND comparator=@comparator);
SET @validatasave_id=(SELECT id FROM ld_validatasave WHERE module=@module AND relatedtable='ld_field' AND fieldname=@fieldname AND comparator=@comparator);
SET @seq=IFNULL((SELECT MAX(sequence) FROM ld_validatasavedetail WHERE relateid=@validatasave_id),0);
INSERT INTO ld_validatasavedetail(relateid,relatefieldname,sequence)
SELECT @validatasave_id,@relatefieldname,@seq+1 FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM ld_validatasavedetail WHERE relateid=@validatasave_id AND relatefieldname=@relatefieldname);
delimiter;
|
|