【问题标题】:SugarCRM validate fields before_save in Logic HookSugarCRM 在 Logic Hook 中验证字段 before_save
【发布时间】:2022-06-15 07:19:11
【问题描述】:

SugarCRM 版本:7.6

在模块案例中,我有两个自定义字段 原因和次原因。

我想当 Reason = Returns 时,Subreason 必须是必需的。

在 Javascript 的编辑页面中,验证有效,但在列表情况下,在编辑行中无效。

我正在尝试使用 Logic Hook,但没有任何效果

echo "Hi";
die();

控制台返回

SyntaxError: Unexpected token H in JSON at position 0

SugarApplication::appendErrorMessage,不返回任何内容并保存

SugarApplication::redirect,返回错误

SyntaxError: Unexpected token < in JSON at position 0

有什么办法吗?

谢谢

【问题讨论】:

  • 如果你想签入一个 LogicHook,作为最后的手段,使用 1throw new Exception("Error message goes here");. I don't think Sugar will show the message in all cases though. If you just want a nice and clean frontend solution that should work across all views, look into SetRequired` Dependency Actions。您可以使用 SugarLogic 公式使用 PHP assoc 数组定义它们,它们应该会影响所有视图(尽管不确定 BWC 模块)。请参阅support.sugarcrm.com/files/… 第 313 页“使用元数据创建自定义依赖项”

标签: php sugarcrm


【解决方案1】:

你需要使用列表视图逻辑钩子。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-29
    • 2022-06-23
    • 1970-01-01
    • 2021-05-25
    • 2020-07-07
    相关资源
    最近更新 更多