refreshData(context)

Example

          function refreshData(context) {
  var configurationId = context.pluginConfiguration.getConfigurationFieldValue({fieldName: "configuration_id"});
  var configuration = loadConfiguration(configurationId);
  const accounts = JSON.parse(context.accountRequestsJSON);

  accounts.forEach(account => {
    const accountMappingKey = account.accountMappingKey;
    if (accountMappingKey === '123456') {
      context.addAccountError({
        accountMappingKey: accountMappingKey,
        errorCode: '2000001200'
      });
    }
  });
  // For Corporate Card Expenses only
  context.setRefreshRequestId({ refreshRequestId: '1' });
} 

        
Note:

addAccountError marks an individual account as failed to refresh.

setRefreshRequestId should be called only when the provider successfully returns an ID. Otherwise, omit the call.

Related Topics

General Notices