Integrate Salesforce Marketing Cloud using basic authentication
Integrate your ServiceNow instance with Salesforce Marketing Cloud by using basic authentication.
Important: Minimize security risks and protect information by granting access only to the necessary user or API permissions.
| Process | Required user role in the Salesforce Marketing Cloud application | Authentication scopes |
|---|---|---|
| Download subscriptions | - Email > Admin > API Access > WebService API - Administration > Users > View | None |
| Pull user activity | - Email > Admin > API Access > WebService API - Administration > Users > View | None |
| Reclaim subscription | - Email > Admin > API Access > WebService API - Administration > Users > View - Administration > Users > Update | None |
| Download consumptions | - Email > Admin > API Access > WebService API - Email > Subscribers > Data Extension > View - Email > Subscribers > Data Extension > Manage Data | None |
Create a user for accessing the Salesforce Marketing Cloud SOAP API
Create a user with which you can access the Salesforce Marketing Cloud SOAP API. The SOAP API enables you to retrieve records from your Salesforce Marketing Cloud data extensions and get information about your Salesforce Marketing Cloud users.
Before you begin
Salesforce Marketing Cloud Role required: admin user with privileges to create users and roles
About this task
Note:
To use the web services, navigate to Setup Home > Settings > Security > Security Settings. In the Username and Logins section, select the Enable Username and Password for Web Services check box.
For accessing user licenses and data extension, the API user must be created within the parent business unit. If the API user is created in a child business unit, it might not have access to the parent business unit's data.
Procedure
From a web browser, go to your Salesforce Marketing Cloud instance.
Log in using your admin credentials.
On the page header of your instance, select your profile icon and then select Setup.
Create a Salesforce Marketing Cloud user.
Navigate to Administration > Users > Users.
Select Create.
On the form, fill in the fields.
| Field | Description |
|---|---|
| Name | Name of the user. |
| Reply Email Address | Email address that you want to send and reply to email messages from. Salesforce Marketing Cloud also sends forgotten password requests to this email address. After you enter an email address, select Verify to verify the email address. |
| Add to From Name Dropdown | Option to send the reply email address through a domain verification process before the email address populates in an email. |
| Notification Email Address | The email address that you want to send Salesforce Marketing Cloud notifications to. |
| Username | User name for the user. |
| External Key | Key that uniquely identifies the user during API calls. |
| Time Zone | Time zone in which the user is located. |
| Culture Code | Language that is used on the Salesforce Marketing Cloud user interface for this user. |
| API User | The option indicating whether the user can access the Salesforce Marketing Cloud SOAP API. Select the check box to enable this option. |
| Temporary Password | A temporary password with which you can log in for the first time. You’re prompted to change this password on the first login. |
| Verify Password | Field to verify the temporary password. |
4. Select **Save**.
Create a user role that enables assigned users to access the Salesforce Marketing Cloud SOAP API and also manage users and data extensions.
Navigate to Administration > Users > Roles.
Select Create.
On the form, fill in the fields.
Field Description Name Name of the user role. External Key Key that uniquely identifies the user role. Description Description of the user role. In the Permissions form section, expand the Email > Subscribers > Data Extension permission category and then select the Allow check box for the View and Manage Data access permissions.
Expand the Email > Admin > API Access permission category and then select the Allow check box for the WebService API access permission.
Expand the Administration > Users permission category and then select the Allow check box for the following access permissions:
- View
- Update
- Disable
- Select Save.
Assign the user role to your Salesforce Marketing Cloud user.
Navigate to Administration > Users > Users.
From the list of available users, select the check box for the user that you created in step 4.
Select Manage Roles.
The Roles form for the selected user opens.
In the Roles form section, select Edit Roles.
When the list of available roles appears, select the check box for the user role that you created in step 5.
Select Save.
Create a Contacts Counts report in Salesforce Marketing Cloud
Create a Contacts Counts report to retrieve and display the total number of billable contacts in your Salesforce Marketing Cloud account.
Before you begin
Salesforce Marketing Cloud Role required: admin
Procedure
From a web browser, go to your Salesforce Marketing Cloud instance.
Log in using your admin credentials.
On the page header of your instance, select the business unit profile icon and then select the top-level parent business unit so that your Contacts Counts report includes data for both the parent business unit and all corresponding child business units.
From the list of available Salesforce Marketing Cloud applications, select the Analytics Builder app icon and then select Reports.
The Reports app overview opens.
In the Report Catalog section, select View Catalog.
From the Reports Catalog, search for Contacts Counts and then select Create.
The Create Report dialog box opens.
In the dialog box, select the time period that you want to retrieve and display data for from the Date Range list.
The default value is Last 30 Days.
Tip: To avoid performance issues during report generation, you should set this value to Last 7 Days.
Select Submit.
Your Salesforce Marketing Cloud instance generates the report and displays the results on the Results: Contacts Counts page.
On the Results: Contacts Counts page, select Save.
The Save Report dialog box opens.
In the dialog box, fill in the fields.
Field Description Report Name Name of the report. Report Source Source of the report. This field is automatically set to Contacts Counts. Description Description of the report. Select Save.
Create a schedule to run the Contacts Counts report automatically.
On the page header of the Reports app, select the Overview tab to return to the Reports app overview.
From your list of reports, open your newly created Contacts Counts report.
In the Schedule Options section, select Edit.
In the dialog box, fill in the fields.
| Field | Description |
|---|---|
| Schedule Options | |
| Start | The date and time from which you want to start running the report. |
| Time Zone | Time zone in which the report is being scheduled. |
| Repeat | Frequency at which you want to run the report. Configure the report to run once every week on Sundays. |
| End | Date on which you want to stop running the report. |
| Delivery Options | |
| Format | File type and file extension in which you want to receive the report results. Select Data File (.csv). |
| Location | Location in which you want to save or share the report. Set this field to Save report for FTP and then fill in the corresponding fields:- Report Name: The file name of the report, excluding the file extension. If you want to include date and time in the report name, add it in the Note: Take note of this file name for later use.
Note: You can set up an SFTP user account in Salesforce Marketing Cloud to view the saved files at a specific FTP location. For more information, see Setting up an SFTP user account in Salesforce Marketing Cloud. |
5. Select **Save**.
Create a data extension for your Contacts Counts report
Create a data extension to store your Contacts Counts report data on your Salesforce Marketing Cloud instance.
Before you begin
Salesforce Marketing Cloud Role required: admin
About this task
Data extensions are tables that contain attributes representing your report data. When your ServiceNow instance connects with the Salesforce Marketing Cloud service, it retrieves data from this data extension.
Procedure
On the page header of your Salesforce Marketing Cloud instance, hover the Salesforce icon to display the list of available Salesforce Marketing Cloud applications.
Select the Audience Builder app icon and then select Contact Builder.
The Contact Builder app opens.
Select the Data Extensions tab.
In the pop-up dialog box, select Get started and then select Create.
The Create New Data Extension dialog box opens.
In the Properties step, fill in the fields.
| Field | Description |
|---|---|
| Creation Method | Method in which you want to create the data extension. Select Create from New. |
| Name | Name of the data extension. |
| External Key | Optional key that uniquely identifies the data extension. You can enter a key of your choice. |
| Description | Description of the data extension. |
| Type | Type of data extension. This field is automatically set to Standard. |
| Location | Location in which you want to store the data extension. This field is automatically set to Data Extensions. Select Change Location to select a different location. |
| Is Sendable? | Option to indicate whether the data extension can be sent to your subscribers. |
Select Next.
In the Data Retention Policy step, set the Retention Setting field to Off.
Select Next.
In the Attributes step, add the attributes that you want to include in the data extension.
Attributes are used to map and import data from a report to a data extension. You must create an attribute for each report column that you want to import data from. Each attribute name must exactly match the corresponding report column name.
For the Salesforce Marketing Cloud integration, attributes for the following Contacts Counts report columns are required:
| Field | Description |
|---|---|
| Primary Key | Option for the attribute to include a unique identifier for all records in the data extension.This option must be enabled for the Count_Date attribute. |
| Name | Name of the attribute. This name must exactly match the corresponding report column name. |
| Data Type | Data type of the attribute. |
| Required | Option that indicates whether the attribute requires a value for each record in the data extension. |
| Length | Maximum number of characters allowed in the attribute value. |
| Default Value | Optional default value for the attribute.For the Flag attribute, set the default value to Note: Don’t enter a default value for any attributes that are assigned as a primary key. |
|Name|Data Type|
|----|---------|
|Count\_Date|Text|
|Total\_Distinct\_Contacts\_Count|Text|
|Total\_Distinct\_Email\_Addresses1|Text|
|Total\_Distinct\_Mobile\_Addresses\_Count|Text|
|Flag|Text|
**Note:** You can add additional attributes and the name must be the same as the Integration Attributes. For more information, see [Create a Salesforce Marketing Cloud integration profile using basic authentication](integrate-sfmc-basicauth.md) or [Create a Salesforce Marketing Cloud integration profile using OAuth 2.0](integrate-sfmc-oauth.md).
Attributes for all other Contacts Counts report columns are optional. Fill in the fields for each attribute that you want to add.
Select Complete.
In the Data Extension Created dialog box, select OK.
Build an automation to import Contacts Counts report data in your data extension
Create an automation to automatically import Contacts Counts report data into your data extension after the report is generated.
Before you begin
Salesforce Marketing Cloud Role required: admin
Procedure
On the page header of your Salesforce Marketing Cloud instance, hover the Salesforce icon to display the list of available Salesforce Marketing Cloud applications.
Select the Journey Builder app icon and then select Automation Studio.
The Automation Studio app overview opens.
Select New Automation.
The workflow for the new automation opens.
Create an automation schedule by dragging the Schedule icon from the Starting Sources section of the left menu pane to the Starting Source section of the workflow canvas.
Define a schedule for the automation.
In the Starting Source section of the workflow canvas, select Configure.
In the dialog box, fill in the fields.
| Field | Description |
|---|---|
| Start Date | The date from which you want to start running the automation. |
| Start Time | The time from which you want to start running the automation. |
| Time Zone | Time zone in which the automation is being scheduled. |
| Repeat | The frequency at which you want to run the automation. Configure the automation to run after the Contacts Counts report is generated. Select the same frequency that you had selected while creating a Contacts Counts report in Salesforce Marketing Cloud. Tip: If you configure the automation to run on the same day that the report is generated, select a start time that gives enough time for the report to finish generating. ServiceNow recommends a start time of at least two hours after the report start time. |
| End | Number of times that the automation can run until the automation schedule ends.If you don’t want the automation schedule to end, set this field to Never. This field doesn't appear only when None (run once) is selected from Repeat. |
3. Select **Done**.
Add a script activity to execute the Server-Side JavaScript for all activities that require it.
In the Activities section of the left menu pane, drag the Script icon into the workflow canvas.
The script activity becomes the first step of the automation workflow.
Select Choose on the script activity step.
The Choose Script Activity dialog box opens.
Select Create New Script Activity.
The Create New Script Activity dialog box opens.
In the Properties step, fill in the fields.
| Field | Description |
|---|---|
| Name | Name of the script activity. |
| External Key | Optional key that uniquely identifies the script activity. You can enter a key of your choice. |
| Folder Location | The location in which you want to store your scripts. Select Choose... to select a different location.This field is automatically set to Scripts. |
| Description | Description of the script activity. |
5. Copy and paste the following Server-Side JavaScript into the Server-Side JavaScript text box:
```
<script runat="server">
var rows = Platform.Function.DeleteData('*<data-extension-name>*',['Flag'],['1']);
</script>
```
The **\*<data-extension-name>\*** must exactly match the file name of the Data Extension that you created in [Create a data extension for your Contacts Counts report](integrate-sfmc-oauth.md).
6. Select **Validate Syntax** to verify that the Server-Side JavaScript syntax is valid.
7. Select **Next**.
8. In the Summary step, verify that the script activity configuration is correct and then select **Finish**.
Add a data extract activity to copy the Contacts Counts report from the SFTP Reports folder to the SFTP Import folder.
The Salesforce Marketing Cloud instance uses the SFTP Import folder to locate and import report data into your data extensions. To enable your instance to import data from the Contacts Counts report into the corresponding data extension, you must copy the report to the SFTP Import folder.
In the Activities section of the left menu pane, drag the Data Extract icon into the workflow canvas.
The data extract activity becomes the second step of the automation workflow.
Select Choose on the data extract activity step.
The Choose Data Extract Activity dialog box opens.
Select Create New Data Extract Activity.
The Create New Data Extract Activity dialog box opens.
In the Properties step, fill in the fields.
| Field | Description |
|---|---|
| Name | Name of the data extract activity. |
| External Key | Optional key that uniquely identifies the data extract activity. You can enter a key of your choice. |
| File Naming Pattern | The file name of the Contacts Counts report that you want to extract data from.This name must exactly match the file name of the Contacts Counts report that you created in Create a Contacts Counts report in Salesforce Marketing Cloud, including the file extension. |
| Extract Type | Data extract method. Set this field to Enhanced FTP File Move and Copy. |
| Description | Description of the data extract activity. |
5. Select **Next**.
6. In the Configuration step, fill in the fields.
|Field|Description|
|-----|-----------|
|Input Folder|Location in which you’ve saved the Contacts Counts report. Enter `\reports\`.|
|Output Folder|Location that you want to copy the report to. Enter `\Import\`.|
|Copy To Folder|Option to copy instead of move the report from the input folder to the output folder. This option enables you to keep the report in both locations. Select the check box to enable this option.|
7. Select **Next**.
8. In the Summary step, verify that the data extract activity configuration is correct and then select **Finish**.
Add an import file activity to import the Contacts Counts report data into the data extension.
In the Activities section of the left menu pane, drag the Data Copy or Import icon into the workflow canvas.
The Data Copy or Import activity becomes the third step of the automation workflow.
Select Choose on the Data Copy or Import activity step.
The Choose Data Copy or Import dialog box opens.
Select Create New Copy or Import Definition.
The Create New Copy or Import Definition dialog box opens.
In the Activity Info step, fill in the fields.
| Field | Description |
|---|---|
| Name | Name of the import file activity. |
| Description | Description of the import file activity. |
| External Key | Optional key that uniquely identifies the import file activity. You can enter a key of your choice. |
| Send notification email to | The email address to which you want to send notifications when an import completes.If you specify an email address, a notification email that contains the number of inserted and updated rows is sent to that address on successful import. Important: The notification email contains an |
5. Select **Next**.
6. In the Source step, select **File Location** in the Data Source header and fill in the fields.
| Field | Description |
|---|---|
| File Location | Location of the Contacts Counts report that you want to import data from. Select ExactTarget Enhanced FTP. |
| File Naming Pattern | The file name of the Contacts Counts report that you want to import data from. If you want to include date and time in the report name, add it in the This name must exactly match the file name of the Contacts Counts report that you created in Create a Contacts Counts report in Salesforce Marketing Cloud, including the file extension. |
| Date Format | Format in which you want to display the date and time of the report data. |
| Delimiter | Format in which you want to separate each report record. Select comma to separate each record with a comma.If you want to enable the use of double quotes to separate each record, enable the Respect double quotes (") as a text delimiter option. |
| Bad Data Behavior | Option to skip rows with bad data. Select the check box to enable this option. |
7. Select **Next**.
8. In the Destination step, search for and select the data extension that you created in [Create a data extension for your Contacts Counts report](integrate-sfmc-basicauth.md).
9. Select **Next**.
10. In the Mapping step, select the options **Add and Update** and **Map by Ordinal** in the Data Action header.
11. When prompted, enable the **Import file has column headers** option and then map each data extension attribute to the corresponding column number in the Contacts Counts report.
**Note:** Leave the **Flag** attribute unmapped.
12. Select **Next**.
13. In the Review step, verify that the import file activity configuration is correct and then select **Finish**.
Select Save.
In the dialog box, fill in the fields.
Field Description Name Name of the automation. Description Description of the automation. External Key Optional key that uniquely identifies the automation. Location Location in which you want to save the automation. Select Save.
In the Starting Source section of the workflow canvas, select Active.
In the Activate Schedule Confirmation dialog box, select Activate to activate the automation schedule.
Retrieve Contacts Counts report data manually
After you create the Contacts Counts report, data extension, and automation, you can retrieve report data between your scheduled report and automation jobs by running these jobs manually.
Before you begin
Salesforce Marketing Cloud Role required: admin
About this task
Your Salesforce Marketing Cloud instance runs the report and automation jobs automatically based on the schedules that you define. If you want to retrieve Contacts Counts report data before the next scheduled report and automation jobs, you can run these jobs manually.
Procedure
Run your Contacts Counts report.
On the page header of your Salesforce Marketing Cloud instance, hover the Salesforce icon to display the list of available Salesforce Marketing Cloud applications.
Select the Analytics Builder app icon and then select Reports.
The Reports app overview opens.
From your list of reports, select the Contacts Counts report that you created in Create a Contacts Counts report in Salesforce Marketing Cloud.
Select Run.
Your Salesforce Marketing Cloud instance generates the report and displays the results on the Results: <report-name> page.
On the Results: <report-name> page, select the Download Results icon (
Download icon\).
6. In the dialog box, fill in the fields.
|Field|Description|
|-----|-----------|
|Filename|The file name of the report, excluding the file extension.|
|Report Source|Source of the report. This field is automatically set to **Contacts Counts**.|
|Format|File type and file extension in which you want to receive the report results. Select **Data File \(.csv\)**.|
7. Select **Save**.
8. Save the file in your system.
Import the file in your Data Extension.
On the page header of your Salesforce Marketing Cloud instance, hover the Salesforce icon to display the list of available Salesforce Marketing Cloud applications.
Select the Audience Builder app icon and then select Contact Builder.
Open the recently created Data Extension that you created while creating a data extension for your Contacts Counts report.
Select Import.
In the Import Data Confirmation dialog box, select Import into Data Extension and then select Ok.
In the Import into Data Extension step, choose the file that you downloaded in the previous Step 1.
Select Delimiter as comma.
Select Import Type as Add and Update.
Select Import options as Skip rows in the import file with bad data.
Select Next.
In the Configure mapping dialog box, select Map Manually.
Match the available data extension columns with the imported report columns and leave the Flag column empty.
Select Next.
In the Review and create dialog box, enter the email id on which you want notification when import completes and select Finish.
In the Run Confirmation dialog box, select Done.
Result
The latest Contacts Counts report data is imported into the data extension.
Create a Salesforce Marketing Cloud integration profile using basic authentication
Create an integration profile by using basic authentication to track software subscriptions and optimize stale licenses for the Salesforce Marketing Cloud service.
Before you begin
To create a Salesforce Marketing Cloud integration profile, request the Software Asset Management - SaaS License Management plugin (sn_sam_saas_int) from the ServiceNow Store.
Tip: To avoid incurring additional subscription costs, install the plugin and build the integration on a non-production instance.
ServiceNow Role required: sam_integrator
Important: You must select the Software Asset Management integration with Salesforce Marketing Cloud check box for this integration while installing optional features on the Application Manager page. For more information about choosing the required SaaS applications, see Request SaaS License Management.
About this task
If you’re using Software Asset Workspace, the option to create the Salesforce Marketing Cloud integration profile in Core UI is inactive.
Procedure
- Navigate to the integration profile.
| Interface | Action |
|---|---|
| Core UI |
|
| Software Asset Workspace |
|
- On the form, fill in the fields.
| Field | Description |
|---|---|
| Display name | Name of the integration profile. For example, `Salesforce Marketing Cloud integration profile`. |
| Authentication type | Type of authentication to access Salesforce Marketing Cloud APIs.- Basic Auth: Select this value. - OAuth 2.0 Note: For a new Salesforce Marketing Cloud profile, the authentication type is set to Basic Auth by default. |
| Status | Status of the integration profile.- If you have not published the integration profile, this field is automatically set to Draft. - If you have already published the integration profile, this field is automatically set to Published. |
| Profile type | Type of integration profile. This value is automatically set to Salesforce Marketing Cloud Subscription. |
Review the required user roles or API permissions specified in the Vendor configuration field for each process to minimize security risks and optimize SaaS licenses.
Note: For more information, see Minimal user permissions table.
In the Download Subscription Subflow section, verify that the Subflow field is set to Salesforce Marketing Cloud Download Subscriptions.
Note: The Download subscriptions check box is selected by default and you can't clear it.
In the Reclaim Subscription Subflow section, verify that the Subflow field is set to Salesforce Marketing Cloud Reclaim Subscription.
Note: The Reclaim subscriptions check box is selected by default. If you don't want to reclaim subscriptions, you can clear this check box. If you clear it, the removal candidates are created but the reclaim subscription subflow isn't triggered or the reclamation process isn't initiated.
In the Download Consumption Subflow section, verify that the Subflow field is set to Salesforce Marketing Cloud Download Contacts Consumption.
The Download Consumption check box is selected by default. If you don't want to download the license consumptions, clear this check box.
In the Integration Attributes section, add or remove the attributes based on your requirements.
The name-value attributes such as Count Date, Contacts, Email Contacts, and Mobile Contacts are automatically populated for the integration profile.
Note: The attribute name must match the report column header in Salesforce Marketing Cloud instance. For more information, see Create a data extension for your Contacts Counts report.
Select Save.
Your ServiceNow instance creates a draft integration profile.
The Connection & Credential field appears and is automatically set to sn_sforce_mc_spoke.SalesforceMarketingCloud.
Open the connection & credential aliases record by selecting the preview icon
No alternative text supplied
next to the Connection & Credential field and then selecting Open Record in the record preview.
On the Connection & Credential Aliases form, select the Create New Connection & Credential related link.
In the dialog box, fill in the fields.
Field Description Please Enter the Connection Information Connection Name Name of the connection. SOAP Connection URL URL of your SOAP Connection endpoint. Enter https://<*subdomain*>.soap.marketingcloudapis.com/Service.asmx, where <subdomain> is your Salesforce Marketing Cloud subdomain.Please Enter the Credential Information Username Profile Name Name of your credentials. Username User name of the user that you can access the Salesforce Marketing Cloud SOAP API with. Enter the user name of the user that you created in Create a user for accessing the Salesforce Marketing Cloud SOAP API. Password Password of the user that you can access the Salesforce Marketing Cloud SOAP API with. Enter the password of the user that you created in Create a user for accessing the Salesforce Marketing Cloud SOAP API. Please enter additional information used for post processing Contacts Counts Data Extension Name of the data extension that you want to retrieve Contacts Counts report data from. This name must exactly match the name of the data extension that you created in Create a data extension for your Contacts Counts report. Select Create.
On the Connection & Credential Aliases form header, select the Back button to return to the Integration Profile form.
Note: You must update the Connection Alias field to its pre-upgrade value for the respective Data Extension record in the Configurations [sn_sforce_mc_spoke_configurations] table. Access the Configurations table by navigating to All > Salesforce Marketing Cloud > Configurations.
On the integration profile form, select Validate Connection to verify the connection and credential details of this integration.
Validating the connection verifies the Download Subscriptions and Download Consumption APIs, but not the Reclaim Subscriptions APIs.
After the connection is verified, select Publish.
In the Publish Confirmation dialog box, select OK.
What to do next
After the integration connects, your ServiceNow instance automatically creates software models, reclamation rules, and software subscriptions that are refreshed daily.
After creating an integration profile, view information about the profile in the Software Asset Workspace by navigating to License operations > User subscription > Direct integration profiles. You can select an integration profile to view the following related lists. If all of the following related lists aren't visible for an integration profile in the default view, you can select the custom integration view from the Details tab:
- Software Models
- Unrecognized Subscription Identifiers
- Scheduled Jobs
- Scheduled Job Results
- Software Subscriptions
- Subscription Identifier Exclusion Rule
- Subscription User Exclusion Rule
After creating an integration profile, you can define subscription exclusion rules to keep certain subscriptions from license cost calculations. For more information, see Subscription exclusions for SaaS and SSO applications.
If you want to set up multiple integration profiles with unique connections, create child aliases to manage different configurations and settings for each integration profile. For more information, see Create a child alias to set up multiple integration profiles.
Review all automatically generated reclamation rules to reclaim user subscriptions. For more information, see Review a software reclamation rule.
Create software entitlements for the automatically generated software models to track used software against owned software.
- For more information on creating software entitlements in the Software Asset Management Core UI, see Create entitlements in Software Asset Management Core UI.
- For more information on creating software entitlements in the Software Asset Workspace, see Create entitlements in workspace.
- For more information on creating software entitlements using the Software Asset Management Playbook, see Create entitlements using the guided walk-through.
Reconciliation also runs on your subscriptions as a scheduled job or on-demand. You can view your reconciliation results in the License Workbench (Software Asset Management classic application) or the License usage view (Software Asset Workspace). Use these results to determine your license compliance position and to remediate any non-compliance.
- For more information on running reconciliation in the Software Asset Management classic application, see Run software reconciliation in Software Asset Management classic.
- For more information on running reconciliation in the Software Asset Workspace, see Run software reconciliation in the workspace.