Record sync error handling

Certified Lead Developer

Hi,

I have a record type configured to sync data sourced by a web service with a scheduled sync that runs once a day. Everything works seamlessly as long as the webservice returns data as expected.

IF in case the daily sync fails for some reason (for example: a connection timeout when calling the webservice) then all the record data is removed from Appian causing errors in the rules and interfaces that use this record type. Ideally, I would expect Appian sync to fail BUT retain the last synced data instead of cleaning it up and causing the record type to be inaccessible.

Is there a way to work around this issue other than by writing additional logic in the record source expression to backup data before calling the integration and then restore if something goes wrong?

Would love to hear your suggestions/ideas.

Regards,

Sunil Zacharia

  Discussion posts and replies are publicly visible

  • One work around you could try if it fails intermittently:

    You could set up your service so that if the web service call returns an error, it just drops the batch that failed. one way to do this is to add logic in your expression to insert a dummy row that has information about the failed item like this:

    a!localVariables(
      local!results: rule!APP_GetSyncedData(),
      if(
        local!results.success,
        rule!APP_FormatResults(local!results),
        if(
          ri!batchNumber > 100,
          {},
          a!map(
            id: "999999" & ri!batchNumber,
            summary: "Batch Failed",
            description: tostring(local!results)
          )
        )
      )
    )


    I'm curious - how often do you expect this issue to occur? Is it likely that only a single batch would fail intermittently or is it likely that the entire web service would be unavailable for an extended time? If it's the latter and you expect the service to come up later, you could also set up logic using a!queryRecordType() that could directly query from the source if the query failed, something like this:

    a!localVariables(
      local!query: a!queryRecordType(),
      if(
        local!query.success,
        local!query.data,
        rule!APP_GetSyncedData()
      )
    )

  • 0
    Certified Lead Developer
    in reply to Peter Lewis

    Hi Peter, 

    Thanks for looking into this. In this particular business case we do not sync in batches because the dataset is not that huge. 

    And for your question on how often this can occur - I don't have a definite answer for that but I can say that if it does occur then we have an unstable application the entire business day until someone manually starts another sync or the next scheduled sync runs automatically. 

    I really like the workaround that you suggested where we set up logic to query the source if the a!queryReordType() fails. I did not notice that a!queryRecordType() had a "success" parameter that indicates a sync failure. 

    By the way, one option that was in my mind was to backup the recordData in a local variable and restore it if the sync fails. But I noticed that Appian does not allow running smart service functions like a!queryRecordType() in a "Record Source" expression. Maybe something to keep in mind for others following this discussion!

    Thanks for suggesting a solution, I think this workaround will fit our design.

    Regards,

    Sunil Zacharia 

  • 0
    Certified Lead Developer
    in reply to Sunil Zacharia

    I think that we should be able to define the sync expression in a way that the data in cache is not deleted in case something goes wrong. I happens all the time that the other systems are not available.