# do\_sync\_flag

*do\_sync\_flag explains various synchronization statuses between Source and Database and helps in database-to-source Replication.*

*do\_sync\_flag* helps update existing data and insert new data into **Source.**  The value of *do\_sync\_flag* & the description is shown in the below table.

<table><thead><tr><th width="100">Value</th><th>Description </th></tr></thead><tbody><tr><td>Y</td><td>When Source to Database replication is successfully completed, <em>do_sync_flag</em> for all the records in the database will be ‘Y’</td></tr><tr><td>S</td><td>If the data is edited/updated in database, it is required to edit / update the same in Sourcetoo. To do this <em>do_sync_flag</em> value must be changed to ‘S’ </td></tr><tr><td>D</td><td>If the data is deleted in Source after replication (Source to DB), when the replication (Source to DB) is run for the next time, the <em>do_sync_flag</em> value changes to ‘D’. </td></tr><tr><td>X</td><td>If the data needs to be purged in Source after replication (DB to Source ), the <em>do_sync_flag</em> value needs to be changed to "X"</td></tr><tr><td>F</td><td>When Source to Database replication is not completed successfully, the <em>do_sync_flag</em> for all the records in the database will be ‘F’</td></tr><tr><td>B</td><td>When the <em><code>do_sync_flag</code></em> is set to "B," it will block data from being transformed/ Updated on the database if any changes are made on the source and the source to db command is run</td></tr></tbody></table>

* When Source to Database replication is successfully completed, *do\_sync\_flag* for all the records in the database will be ‘Y’.

![](https://help.mydbsync.com/docs/download/attachments/53903441/29.png?version=1\&modificationDate=1619726203000\&api=v2)

* To do this, the do\_sync\_flag value must be changed to ‘S’ along with the necessary changes to the records in the database.If the data is edited/updated in the database, it is also required to edit/update the same in Source. To do this, the do\_sync\_flag value must be changed to ‘S’ along with the necessary changes to the records in the database. After the replication (DB to Source) all these changes will reflect in Salesforce.  \
  Example: Account sForce in Salesforce does not have Type, which is already replicated in the database. If the type is updated as ‘Customer – Channel’ in the database, Salesforce must also be updated. In order to update in Salesforce, the do\_sync\_flag value must be changed to ‘S’, which must be saved before running the replication DB to Source. After successful run, Account sForce will have Type ‘Customer - Channel’

  1. Account sForce does not have Type in Salesforce

  ![](https://help.mydbsync.com/docs/download/attachments/53903441/30.png?version=1\&modificationDate=1619726203000\&api=v2)

  1. After replication (SF to DB), *do\_sync\_flag* value for sForce Account is ‘Y’ and sfType is ‘NULL’.\
     ![](https://help.mydbsync.com/docs/download/attachments/53903441/31.png?version=1\&modificationDate=1619726203000\&api=v2)
  2. sfType for sForce is manually updated as ‘Customer – Channel’ in database and then *do\_sync\_flag* is manually updated as ‘S’.\
     ![](https://help.mydbsync.com/docs/download/attachments/53903441/32.png?version=1\&modificationDate=1619726203000\&api=v2)
  3. After running Replication (DB to Source), sForce Account in Salesforce is updated with the Type ‘Customer – Channel’.\
     ![](https://help.mydbsync.com/docs/download/attachments/53903441/33.png?version=1\&modificationDate=1619726203000\&api=v2)
* If the data is deleted in Sourceafter replication (Source to DB), when the replication (Source to DB) is run for the next time, *do\_sync\_flag* value changes to ‘D’. \
  Example: Account ‘Pyramid Construction Inc.’ is deleted in Salesforce which is already replicated in database.  Account Pyramid Construction Inc. data is already available in database with *do\_sync\_flag* value ‘Y’. When the Source to DB replication is done for the next time, *do\_sync\_flag* value changes to ‘D’ by itself. This signifies that Account ‘Pyramid Construction Inc.’ does not exist in Salesforce
  1. After Replication (Source to DB), *do\_sync\_flag* value is ‘Y’ for the account ‘Pyramid Construction Inc.’\
     ![](https://help.mydbsync.com/docs/download/attachments/53903441/34.png?version=1\&modificationDate=1619726203000\&api=v2)
  2. Account ‘Pyramid Construction Inc.’ is deleted in Salesforce. \
     ![](https://help.mydbsync.com/docs/download/attachments/53903441/Picture16.png?version=1\&modificationDate=1619726203000\&api=v2)
  3. After Replication (Source to DB), *do\_sync\_flag* value changes to ‘D’.\
     ![](https://help.mydbsync.com/docs/download/attachments/53903441/36.png?version=1\&modificationDate=1619726203000\&api=v2)
