我正在尝试与潜在客户联系。我正在执行此查询
$queryProspects = new SugarQuery();
$queryProspects->from(BeanFactory::getBean('Prospects'));
$leads = $queryProspects->joinTable('leads');
$queryProspects->select("prospects.id","prospects.lead_id");
$queryProspects->where()->equals("lead_id","117c3d5d-07d9-0ae7-5610-573ac87c9a35");
在执行此操作之前。
$queryProspects->execute();
我正在编译我的查询,如
$queryProspects->compileSql();
此查询在执行后无效。编译后的查询结果是
SELECT prospects.id id, prospects.lead_id lead_id FROM prospects JOIN leads ON () WHERE prospects.deleted = 0 AND prospects.lead_id = '117c3d5d-07d9-0ae7-5610-573ac87c9a35'
我知道错误是()WHERE 我需要删除,但无法对糖查询进行更改以删除这些括号和where子句(在sql生成的查询中显示)
答案 0 :(得分:1)
从这里改变并加入声明。
$queryProspects->from(BeanFactory::getBean('Prospects'), array('team_security' => false));
$leads = $queryProspects->join('lead')->joinName();
加入中的潜在客户是您的潜在客户中的链接(名称字段)> vardefs.php如下所示。
'lead' => array(
'name' => 'lead',
'type' => 'link',
'relationship' => 'lead_prospect',
'module' => 'Leads',
'source' => 'non-db',
'vname' => 'LBL_LEAD',
),
答案 1 :(得分:0)