After Sync Trigger

Pulsar currently supports running custom Pulsar Settings Language upon completion of a sync. This can be useful for recording the sync time, counting records, or alerting the user to new information. NOTE:  This trigger is tied to sync, and any data changes during this setting execution will be pushed to the Salesforce server, even if the user is forced offline permanently via settings.

If you are using forced offline permanently setting, you may want to use the following actions to send the sync stats to Salesforce.

NOTE: The SFCreate and SFUpdate PSL actions push changes directly to Salesforce and will NOT update the local Pulsar database. Any creates and updates using these actions will need to be synced to Pulsar at a later time.

Otherwise, you can use these PSL actions that write to the local database as well.

 

Here is a trivial example that displays the sync date/time upon a successful sync:

Name:  After Sync Trigger 
Key:     pulsar.sync.AfterSyncTrigger
ValuePulsar Settings Language

DEFAULT{ Action=SetVar; VarName=LastSync; VarValue=@@LastSyncTime; | Action=Alert; Message=Last successful sync time: %%LastSync%%; }

Here is a bit more complicated example that displays the sync date/time upon a successful sync:

DEFAULT{ Action=SetVar; VarName=LastSync; VarValue=@@LastSyncTime; | Action=SetVar; VarName=CurrentUserId; VarValue=@@CurrentUserId; | Action=SetVar; VarName=AppVersion; VarValue=@@AppVersion; | Action=SetVar; VarName=LastSyncSuccess; VarValue=@@LastSyncSuccess; | Action=SqlQuery; QueryString=SELECT CASE WHEN '%%LastSyncSuccess%%' = 'TRUE' THEN 1 ELSE 0 END AS SyncSuccess; QueryReturnFields=SyncSuccess; QueryTest=%%SyncSuccess%%=1; QueryTestTrue=UpdateUser; QueryTestFalse=NoAction; } UpdateUser{ Action=SFUpdate; ObjectType=User; Id=%%CurrentUserId%%; LastSuccessfulPulsarSync__c=%%LastSync%%; } NoAction{ }

Full List of Sync Stat Values

@@AppVersion
@@PreviousSyncTime
@@LastSyncSuccess
@@LastSyncTime
@@LastSyncDuration
@@LastFailedSyncTime
@@LastFailedSyncDuration
@@LastFailedSyncErrorCode
@@LastFailedSyncCurlErrorCode
@@LastFailedSyncCurlErrorMessage
@@LastFailedSyncSfErrorCode
@@LastFailedSyncSfErrorMessage
@@LastFailedSyncHttpResponseCode
@@LocalCreatedCount
@@LocalDeletedCount
@@LocalUpdatedCount
@@LocalUpdatedUniqueCount
@@ServerProcessedCount
@@ServerIntegratedCount
@@SyncDomainType
@@SyncWindowType
@@SyncResumed
@@SyncPassCount
@@SchemaChanged
@@SyncGeneration
@@MetadataSyncPerformed
@@MetadataSyncDuration
@@ReachabilitySyncPerformed
@@ReachabilitySyncDuration
@@RefreshPerformed
@@RefreshDuration

Visit the following related pages for more information about this topic: