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.
Use These The SFCreate and SFUpdate PSL actions push changes |
direct 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
Value: Pulsar Settings Language
Code Block |
---|
DEFAULT{
Action=SetVar;
VarName=LastSync;
VarValue=@@LastSyncTime;
|
Action=Alert;
Message=Last successful sync time: %%LastSync%%;
} |
|
Here is a bit more complicated example that displays updates the sync date/time upon user record with sync details on a successful sync, and creates an error record and attaches logs if the sync fails:
Code Block |
---|
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= |
|
NoActionCreateError;
}
UpdateUser{
Action=SFUpdate;
ObjectType=User;
Id=%%CurrentUserId%%;
LastSuccessfulPulsarSync__c=%%LastSync%%;
}
|
|
NoActionCreateError{
Action=SFCreate;
ObjectType=Sync_Error__c;
AffectedUser=%%CurrentUserId%%;
AppVersion__c=%%AppVersion%%;
SyncFailureDateTime__c=%%LastSync%%;
AttachLogs=TRUE;
} |
|
Full List of Sync Stat Values
@@AppVersion
@@PreviousSyncTime
@@LastSyncSuccess
@@LastSyncTime
@@LastSyncDuration
@@LastFailedSyncTime
@@LastFailedSyncDuration
@@LastFailedSyncErrorCode
@@LastFailedSyncCurlErrorCode
@@LastFailedSyncCurlErrorMessage
@@LastFailedSyncSfErrorCode
@@LastFailedSyncSfErrorMessage
@@LastFailedSyncHttpResponseCode
@@LocalCreatedCount
@@LocalDeletedCount
@@LocalUpdatedCount
@@LocalUpdatedUniqueCount
@@ServerProcessedCount
@@ServerProcessedObjectCountMap
@@ServerIntegratedCount
@@SyncDomainType
@@SyncWindowType
@@SyncResumed
@@SyncPassCount
@@SchemaChanged
@@SyncGeneration
@@MetadataSyncPerformed
@@MetadataSyncDuration
@@ReachabilitySyncPerformed
@@ReachabilitySyncDuration
@@RefreshPerformed
@@RefreshDuration
Panel |
---|
panelIconId | atlassian-info |
---|
panelIcon | :info: |
---|
panelIconText | :info: |
---|
bgColor | #F4F5F7 |
---|
|
Visit the following related pages for more information about this topic: |