首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Sales Force to Sales Force Connector共享主要联系人和商机

使用Sales Force to Sales Force Connector共享主要联系人和商机
EN

Stack Overflow用户
提问于 2014-02-25 05:44:45
回答 1查看 115关注 0票数 1

销售线索-转换为客户、联系人和商机

我开发了一个触发器,它与我们的另一个组织共享机会和相关帐户,而我缺少的部分是与此一起共享联系人。还需要一些共享联系人的帮助。

代码语言:javascript
复制
     Trigger autoforwardOpportunity on Opportunity(after insert) {
String UserName = UserInfo.getName();
String orgName = UserInfo.getOrganizationName(); 
List<PartnerNetworkConnection> connMap = new List<PartnerNetworkConnection>(
    [select Id, ConnectionStatus, ConnectionName from PartnerNetworkConnection where ConnectionStatus = 'Accepted']
);
System.debug('Size of connection map: '+connMap.size());
List<PartnerNetworkRecordConnection> prncList = new List<PartnerNetworkRecordConnection>();
for(Integer i =0; i< Trigger.size; i++) {
    Opportunity Opp = Trigger.new[i];
    String acId = Opp.Id;
    System.debug('Value of OpportunityId: '+acId);
    for(PartnerNetworkConnection network : connMap) {
        String cid = network.Id;
        String status = network.ConnectionStatus;
        String connName = network.ConnectionName; 
        String AssignedBusinessUnit = Opp.Assigned_Business_Unit__c;
        System.debug('Connectin Details.......Cid:::'+cid+'Status:::'+Status+'ConnName:::'+connName+','+AssignedBusinessUnit);
        if(AssignedBusinessUnit!=Null && (AssignedBusinessUnit.equalsIgnoreCase('IT') || AssignedBusinessUnit.equalsIgnoreCase('Proservia'))) {     
            // Send account to IT instance
            PartnerNetworkRecordConnection newAccount = new PartnerNetworkRecordConnection(); 
            newAccount.ConnectionId = cid;
            newAccount.LocalRecordId = Opp.AccountId;
            newAccount.SendClosedTasks = true;
            newAccount.SendOpenTasks = true;
            newAccount.SendEmails = true;
            newAccount.RelatedRecords = 'Contact';
            System.debug('Inserting New Record'+newAccount);
            insert newAccount;

            // Send opportunity to IT instance
            PartnerNetworkRecordConnection newrecord = new PartnerNetworkRecordConnection(); 
            newrecord.ConnectionId = cid;
            newrecord.LocalRecordId = acId;
            newrecord.SendClosedTasks = true;
            newrecord.SendOpenTasks = true;
            newrecord.SendEmails = true;
            //newrecord.ParentRecordId = Opp.AccountId;
            System.debug('Inserting New Record'+newrecord);
            insert newrecord;
        }
    }
    }
}
EN

回答 1

Stack Overflow用户

发布于 2015-01-26 19:04:44

newrecord.RelatedRecords =‘联系人,机会’;//等

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21999690

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档