0

Is there any possibility that we can mass "Upsert" account team member?

We have sales reps changing from different accounts, so how do we change assignments for all sales reps as an account team member from one account to another using data loader/ integration tool?

Note: New assignments are being updated using another system (SAP) not directly in salesforce. (Talking around 80K accounts and 3-4K team members)

Additional Question:

How to assign Account team member to all Contact roles associated with Account based on account team membership without using trigger?

  • you can use dataloader .Are you hitting any issue .You will use VLOOKUPS to load data – Mohith Shrivastava Jan 15 '16 at 20:41
  • We're using Tibco integration tool and also for data loader we need external ID to insert data, here data is being loaded in to Account team object by mapping with Account object, cross object upsert function is not working. – Dave Jan 18 '16 at 15:27
1

It's a little difficult to tell what you actually want to accomplish, your question is a little vague. I will nevertheless give it a try. With Tibco I have no experience, but I'll try to give a path how you could do it using NoFrillsTransformation.

As a first action, you would need to build up an ID map from SAP IDs to Salesforce IDs; I do hope you have this, e.g. as a CSV file of some kind. Usually, you have some external ID on the User entity you can use to just extract this via SOQL from Salesforce, like so (you will need to create a sfdc_config.xml file first, the trickiest thing is creating the encrypted password bit):

<?xml version="1.0" encoding="utf-8"?>
<Transformation>

  <Source config="sfdc_config.xml">soql://Select Id, SapId__c, FirstName, LastName from User where SapId__c != ''</Source>
  <Target config="delim=';'">file://user_id_map.csv</Target>

  <Fields appendSource="true" />
</Transformation>

This will render a file user_id_map.csv which contains the SF ID and the SAP ID do that you can map back and forth to it.

Then do the same thing with the Account entity (create an account_id_map.csv), assuming you have a clear connection to your SAP entities there, too (and your external ID is called SapId__c). Use the usebulkapi=true option for this if you have that many accounts, it will speed up things (but it will work without it, too).

Then I would extract (using the bulk API) all records in the AccountTeamMember object:

<?xml version="1.0" encoding="utf-8"?>
<Transformation>

  <Source config="sfdc_config.xml">soql://Select Id, AccountAccessLevel, AccountId, TeamMemberRole, UserId from AccountTeamMember</Source>
  <Target config="delim=';'">file://account_team_members.csv</Target>

  <Fields appendSource="true" />
</Transformation>

Now, things depend on how your data looks like, and how complete your input data is. Can you actually completely delete all AccountTeamMember records and recreate it from SAP input? If so, you can use (CAUTION!!!) the following script to remove all AccountTeamMembers:

<?xml version="1.0" encoding="utf-8"?>
<Transformation>

  <Source config="delim=';'">file://account_team_members.csv</Source>
  <Target config="sfdc_config.xml">sfdc.net://AccountTeamMember.delete</Source>

  <Fields>
    <Field name="Id">$Id</Field>
  </Fields>
</Transformation>

This will take the Id field from the account_team_members.csv file (using the field $ operator) and tell Salesforce to delete them all. CAUTION! Do this only if you know what you're doing and you know how to recreate them. TEST THIS ON YOUR QA SYSTEM FIRST!

I assume your Account to User also has the following form (as a CSV file called sap_account_team_members.csv):

SAP_Account_ID;SAP_User_ID;AccessLevel;Role
0092838892;0000001229;All;Key Account Manager
0092838892;0000002112;Read;Consultant
...

This maps to AccountTeamMember, and you can create the following transformation to get things back to Salesforce:

<?xml version="1.0" encoding="utf-8"?>
<Transformation>

  <Source config="delim=';'">file://sap_account_team_members.csv</Source>
  <Target config="sfdc_config.xml">sfdc.net://AccountTeamMember.insert</Target>
  <FilterTarget config="delim=';'">file://invalid_sap_team_members.csv</FilterTarget> 

  <LookupMaps>
    <LookupMap name="AccountId" keyField="SapId__c">
      <Source config="delim=';'">file://account_id_map.csv</Source>
    </LookupMap>
    <LookupMap name="UserId" keyField="SapId__c">
      <Source config="delim=';'">file://user_id_map.csv</Source>
    </LookupMap>
  </LookupMaps>

  <SourceFilters>
    <SourceFilter>FilterLog(HasKey("AccountId", $SAP_Account_ID), "Unknown SAP Account" + $SAP_Account_ID)</SourceFilter>
    <SourceFilter>FilterLog(HasKey("UserId", $SAP_User_ID), "Unknown SAP User ID: " $SAP_User_ID)</SourceFilter>
  </SourceFilters>

  <Fields>
    <Field name="AccountId">AccountId($SAP_Account_ID, $Id)</Field>
    <Field name="UserId">UserId($SAP_User_ID, $Id)</Field>
    <Field name="TeamMemberRole">$Role</Field>
    <Field name="AccountAccessLevel">$AccessLevel</Field>
  </Fields>

  <FilterFields appendSource="true">
    <Field name="Reason">FilterLogLastMessage()</Field>
  </FilterFields>
</Transformation>

Note that you may need further mapping for the TeamMemberRole and AccountAccessLevel fields, in case you have a different domain language for SAP and Salesforce (which is rather usual). You can do that using another LookupMap with a static CSV beneath. In case you have data in sap_account_team_members.csv which you can't map to Salesforce IDs, you will end up with these with a note attached to them (in the Reason field) why they were sorted out (that's what's done in the SourceFilters section).

Hope that helps. This is how I do these kinds of things.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.