If you already know the entity and field causing the error, skip to Step 4. Otherwise, here's a process to help find the offending field. First, export the schema information from the SQL Server target database to a text file to give you an easy way to sort the fields by length. Then, compare the field lengths, one by one, to the fields in Dynamics CRM or Salesforce. Here are the detailed steps:
Step 1: Find the failed record(s), copy the field names and data to a temporary text file to use for comparison
- Login to TIBCO Scribe Online.
- Select Solutions.
- Locate the RS solution that failed.
- From the Gear menu select Execution History.
- Locate the Execution with a Fatal Error.
- From the Gear menu for that Execution select Copy Error.
- Paste the error into a text editor such as NotePad.
Step 2: Export the MSSQL Database Schema of the target DB as a .csv file, to facilitate sorting by field length
- Login to SQL Management Studio.
- Configure SQL to export headers by selecting Tools > Options > Query Results > SQl Server > Results to Text.
- Enable Include columns headers in the result set.
Note: Be sure Query Results = "Results to text".
- Restart SQL Management Studio.
- Right-click the database being used as the RS destination and select New Query.
- Enter the following text:
select * from INFORMATION_SCHEMA.COLUMNS
- Click Execute or press (F5).
- Right-click in the results section and select Save Results As.
- Save the results to a CSV file.
- Open the csv and sort by the CHARACTER_MAXIMUM_LENGTH column.
- Ignore values of -1. MSSQL uses -1 to indicate MAX_LENGTH.
Step 3: Find the offending field by comparing the database schema to the actual data from the error (in the text editor)
- Go line by line in the .csv file, starting with the field with the shortest length (ignoring -1 values).
- Search for the each field name in the text editor.
- Count the characters in the data to locate the data that is longer than the field length in the schema.
CRM
Advanced users comfortable with XML can examine the CRM schema directly, by doing the following:
- Copy the xml file located in: C:\Program Files (x86)\Scribe Software\Scribe Online Agent \Connectors\Scribe.Adapter.Crm to your desktop or personal folder to avoid corrupting the original.
- Open the XML file using a text editor or browser.
- Do a field by field comparison of the schema (XML) with the data.
SalesforceYou can log into Salesforce and locate the field lengths for each field from within their User Interface. Note that Salesforce has two different UI's Lightening and Classic. Both sets of instructions are included here:
Lightning
- Login to Salesforce as a user who has permission for Object Manager.
- Select Setup from the gear menu.
- Select the Object Manager tab.
- Select the Object which contains the field in question (i.e. Account).
- Select Fields & Relationships to display a list of all fields for the Object. The Data Type column in this view contains the length. (i.e. Text(40), URL(255) )
Classic
- Login to Salesforce as a user who has permission for Customize.
- Select Setup in the top right corner.
- Expand Customize in the Build section of the left hand navigation.
- Expand the Object which contains the field in question (i.e. Account).
- Select Fields to display a list of all fields for the Object. The Data Type column in this view contains the length. (i.e. Text(40), URL(255) )
Step 4: Fix it
Once you've identified the entity and field causing the truncation error, the fix depends on your particular situation. If you have access to the replication DB schema and are comfortable with SQL, try option 3 or 4. If you can't change the source data, consider 1 or 3. If a small number of records have bad data that you can alter, try option 2. Consult with your system administrator before making any changes. Exercise caution and take appropriate backups.
Option 1: Change the schema in CRM or Salesforce to reflect the correct field size
- Pros: Data remains unchanged in source
- Cons: May have unintended effects (reporting, allowing invalid data, etc.)
Option 2: Fix the individual record(s) in CRM or Salesforce
- Pros: Don't need to change the CRM or Salesforce schema
- Cons: Data will be truncated
Option 3: Change the schema of target MSSQL DB - Increase the size of the offending columns
- Pros: No changes to Source required
- Cons: Requires access to the target database Schema. The rules for updating the schema in the target can be reviewed in the TIBCO Scribe Online Help under:
Editing The Source Schema
Option 4: Drop the entity table (e.g. contacts) from the MSSQL db. Replication Services will do a full data sync for the entity during the next run
- Pros: No changes to Source required
- Cons: Requires access to the target database Schema. Will be time consuming re-populate a table with many records