Follow these steps to synchronize scores via Score Designer ot Sales or Service Cloud. You can use the Lead or Contact object depending on the entity that is scored. In the example below we are using the Contact object.
Step 1: create a data extension to store contacts and scores
- Create a new data extension
- Create two fields:
- SubscriberKey (text)
- AS_Score (number)
- Run SQL activity
- Create automation to to automate calculation
- Create a ErrorLog DE
- Id (text)
- Message (text 240 characters)
- Description (text 240 characters)

Step 2: create a SQL activity to get contacts that have a score
In the SQL below we also check for scores that changed, so you won’t unnecessarily sync scores that haven’t changed.
select
a.SubscriberKey,
a.Score as [AS_Score]
from [Contact_Salesforce] l
left join [AS_Combined_Scores] a
on a.SubscriberKey = l.Id
where
l.Lead_Score__c != a.Score
and a.Score > 0
Step 3: create Script Activity
- Navigate to Automation Studio >> Activities
- Create a new Script Activity
- Copy the code below
- Change vars:
- targetDE = ENTER_EXTERNAL_KEY_DE
- logDE = ENTER_EXTERNAL_KEY_LOG_DE
- sfObj = Contact or Lead
- Change the API name of the field where you want to store the score (in our example ‘Lead_Score__c’)
<script type="javascript" runat="server">
Platform.Load("core","1");
var sfUpdateString;
var targetDE = DataExtension.Init('ENTER_EXTERNAL_KEY_DE').Rows.Retrieve();
for (var i = 0; i < targetDE.length; i++) {
var errorId;
try {
var Field1 = targetDE[i]["SubscriberKey"];
var Field2 = targetDE[i]["AS_Score"];
errorId = targetDE[i]["SubscriberKey"];
var sfObj = "Contact";
sfUpdateString = '';
sfUpdateString = '%'+'%[SET @uso = UpdateSingleSalesforceObject("'+ sfObj +'","'+Field1+'"';
sfUpdateString += ',"Lead_Score__c","'+Field2+'")]%'+'%';
Platform.Function.TreatAsContent(sfUpdateString);
Write(Variable.GetValue("@uso"));
}
catch(e) {
var logDE = DataExtension.Init("ENTER_EXTERNAL_KEY_LOG_DE");
var errorMsg = Stringify(e.message);
var errorDsp = Stringify(e);
logDE.Rows.Add({Id:errorId,Message:errorMsg, Description:errorDsp});
}
}
</script>
Step 4: create an automation
Create an automation to tun the SQL en Script Activity.