根据 Sugar CRM 中的主要电子邮件地址获取帐户 ID

发布于 2024-11-27 12:12:40 字数 1455 浏览 2 评论 0原文

我们有一个网站,当插入/更新记录时,我们运行一个脚本来更新 Sugar CRM 帐户模块。

帐户模块有一个字段 website_id_c 。当数据库发生插入时,我们将最后一个插入 ID 设置为 Sugar CRM 的 website_id_c ,并将其余值设置为插入。

插入脚本如下所示。

$name_value_field=array(
    array('name' => 'name','value' => $name),
    array('name' => 'primary_contactperson_c','value' => $ownername),
    array('name' => 'billing_address_street','value' => $address),
    array('name' => 'billing_address_postalcode','value' => $postalcode),
    array('name' => 'email1','value' => $email),
    array('name' => 'website_id_c','value' => $id_retrieved),
);
if(!empty($sessn_id))
{
    $result=$soap->set_entry("Accounts",$name_value_field); 

}

这使用 SOAP nusoap 客户端与 Sugar CRM 云进行通信。插入工作正常并且更新也很好。

$response = $soap->get_entry_list('Accounts', 
                array('id'), 
                "website_id_c='$websiteID'");
$account_id = $response['entry_list'][0]['id'];

但目前我想检索account_id以根据电子邮件更新记录。我用 email 更改了字段。但我觉得它存储在其他地方,主地址密钥存储在帐户模块中。因此,首先我们要从电子邮件模块中获取该 ID,然后根据该电子邮件地址 ID 查询帐户模块以获取帐户值。

 $response = $soap->get_entry_list('Accounts', 
                array('id'), 
                "email1='[email protected]'");

存储电子邮件地址的模块是什么?我以前没有从事过 Sugar 的工作。如果您没有完全理解我的意思,请随时问我。

谢谢

We have a website and when a record is inserted / updated we runs a script to update the sugar CRM Accounts module.

The Accounts module have a field website_id_c . When an insert occurs to DB we set the last insert ID to website_id_c of Sugar CRM and the remaining values to get inserted.

Insert script is something like below .

$name_value_field=array(
    array('name' => 'name','value' => $name),
    array('name' => 'primary_contactperson_c','value' => $ownername),
    array('name' => 'billing_address_street','value' => $address),
    array('name' => 'billing_address_postalcode','value' => $postalcode),
    array('name' => 'email1','value' => $email),
    array('name' => 'website_id_c','value' => $id_retrieved),
);
if(!empty($sessn_id))
{
    $result=$soap->set_entry("Accounts",$name_value_field); 

}

This uses the SOAP nusoap client to communicate with Sugar CRM cloud. Insertion works fine and update also.

$response = $soap->get_entry_list('Accounts', 
                array('id'), 
                "website_id_c='$websiteID'");
$account_id = $response['entry_list'][0]['id'];

But currently I want to retrieve the account_id to update the record on the basis on Email. I changed the fields with email . But I feel its stored in some other place and the primary address key is stored in the Accounts module. So first we want to fetch that id from the Email module, and then query the Accounts module on the basis of this Email address id to get the Account Values.

 $response = $soap->get_entry_list('Accounts', 
                array('id'), 
                "email1='[email protected]'");

Which is the module that stores the Email address ? I have not worked on Sugar before. So feel free to ask me if you didn't get me exactly.

Thanks

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

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

发布评论

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

评论(1

心不设防 2024-12-04 12:12:40

电子邮件字段及其与帐户的关系存储在另外两个表中,因此您需要使用子选择来检索帐户。

$response = $soap->get_entry_list(
    $module = 'Accounts',
    $fields = array('id'),
    $query = "accounts.id IN (
        SELECT eabr.bean_id
        FROM email_addr_bean_rel eabr 
            JOIN email_addresses ea ON (ea.id = eabr.email_address_id)
        WHERE 
            eabr.bean_module = 'Accounts' 
            AND eabr.deleted = 0 
            AND ea.email_address = '[email protected]'
    )",
    $orderBy = "accounts.name", 
    $offset = 0, 
    $max = 10
);

我的肥皂客户端 get_entry_list 方法是

get_entry_list($module, 
    $fields = array(), 
    $query='', 
    $order_by='', 
    $offset=0, 
    $limit = 1000)

相应地进行必要的更改。

The email field and its relation to accounts is stored in two other tables, so you need to retrieve the accounts with a sub select.

$response = $soap->get_entry_list(
    $module = 'Accounts',
    $fields = array('id'),
    $query = "accounts.id IN (
        SELECT eabr.bean_id
        FROM email_addr_bean_rel eabr 
            JOIN email_addresses ea ON (ea.id = eabr.email_address_id)
        WHERE 
            eabr.bean_module = 'Accounts' 
            AND eabr.deleted = 0 
            AND ea.email_address = '[email protected]'
    )",
    $orderBy = "accounts.name", 
    $offset = 0, 
    $max = 10
);

My soap clients get_entry_list method is as

get_entry_list($module, 
    $fields = array(), 
    $query='', 
    $order_by='', 
    $offset=0, 
    $limit = 1000)

Make the necessary changes accordingly .

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文