如何在 SugarCRM CE 中创建潜在客户和自定义模块之间的关系?

发布于 2024-11-15 13:49:17 字数 1204 浏览 3 评论 0原文

function createPJOpportunityRelationship($pj_id, $op_id) {
    echo "creating relationship";

    $set_relationship_value = array(
        'module1' => 'geral_pessoa_juridica', 'module1_id' => $pj_id,
        'module2' => 'Opportunities', 'module2_id' => $op_id
    );

    $set_relationship_params = array(
        'session' => $this->ses,
        'set_relationship_value' => $set_relationship_value
    );

    $set_relationship_result = $this->soap->call('set_relationship', array(
        'session' => $this->ses,
        'set_relationship_value' => $set_relationship_value));

    var_dump($set_relationship_result);
}

根据大多数糖教程,这是我用来创建关系的代码。当我使用 2 个基本模块(如潜在客户/联系人)时,该代码可以工作,但当我尝试使用自定义构建的模块时,该代码会失败。

在本例中,geral_pessoa_juridica 模块是自定义模块,geral 是包,pessoa_juridica 是名称。我确信这个名字是正确的,它适用于其他功能。

这个函数返回给我这个

5ec9ca75-e09d-e2d8-0c2b-4df7ac377dcf 建立关系 数组(3){ [“已创建”]=>整数(0) [“失败”]=>整数(1) [“已删除”]=>整数(0) 我不确定

为什么它会失败 - 研究 Sugarcrm.log,我发现它甚至没有尝试创建关系。

我重新制作了模块两次,尝试按照我在其他关系中看到的 Sugar 标准手动创建表,刷新 MySQL 权限,在 Sugar 中进行所有可能的修复。我无法重新安装它,因为它正在生产中。

关于如何修复它有什么想法吗?

function createPJOpportunityRelationship($pj_id, $op_id) {
    echo "creating relationship";

    $set_relationship_value = array(
        'module1' => 'geral_pessoa_juridica', 'module1_id' => $pj_id,
        'module2' => 'Opportunities', 'module2_id' => $op_id
    );

    $set_relationship_params = array(
        'session' => $this->ses,
        'set_relationship_value' => $set_relationship_value
    );

    $set_relationship_result = $this->soap->call('set_relationship', array(
        'session' => $this->ses,
        'set_relationship_value' => $set_relationship_value));

    var_dump($set_relationship_result);
}

This is the code I'm using to create a relationship, according to most sugar tutorials. The code works when I'm using 2 basic modules (Like Leads/Contacts) but it fails when I try it with custom built modules.

In this case, the geral_pessoa_juridica module is a custom one, geral being the package and pessoa_juridica the name. I'm sure the name is correct, it works for other functions.

This function returns to me this

5ec9ca75-e09d-e2d8-0c2b-4df7ac377dcf
creating relationship
array(3) {
["created"]=> int(0)
["failed"]=> int(1)
["deleted"]=> int(0)
}

I'm not sure WHY it fails - studying sugarcrm.log, I see it didn't even tried to create the relationship.

I remade the module twice, tried to create the tables manually following the Sugar standard I saw in other relationships, flushed MySQL privileges, did all the repairs possible in Sugar. I can't reinstall it because it's on production.

Any ideas on how to fix it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

澜川若宁 2024-11-22 13:49:17

第 5 行有错误:

'module1' => 'geral_pessoa_juridica', 'module1_id', $pj_id,

应该是:

'module1' => 'geral_pessoa_juridica', 'module1_id' => $pj_id,

There's an error on line 5:

'module1' => 'geral_pessoa_juridica', 'module1_id', $pj_id,

should instead be:

'module1' => 'geral_pessoa_juridica', 'module1_id' => $pj_id,
风苍溪 2024-11-22 13:49:17

解决了,或者有点。

    $set_relationship_params = array(
        'session' => $this->ses,
        'module_name' => 'custom_module', /* custom module, where the relationship was created, "primary module" */
        'module_id' => $custom_id, /* id of site, get from set_entry call */
        'link_field_name' => 'module', /* the LINK field type name, from Step 5  */
        'related_ids' => array($module_id) /* id of Account you want to relate to */
    );

    print_r($result = $this->soap->call('set_relationship',$set_relationship_params)); //nuSoap
}

Solved, or kinda of.

    $set_relationship_params = array(
        'session' => $this->ses,
        'module_name' => 'custom_module', /* custom module, where the relationship was created, "primary module" */
        'module_id' => $custom_id, /* id of site, get from set_entry call */
        'link_field_name' => 'module', /* the LINK field type name, from Step 5  */
        'related_ids' => array($module_id) /* id of Account you want to relate to */
    );

    print_r($result = $this->soap->call('set_relationship',$set_relationship_params)); //nuSoap
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文