Best practice consuming web services

Hi

Iv’e been comsuming a lot of webservices from Microsoft Business Central, but I often gets the response " Sorry, we just updated this page. Reopen it, and try again. " - how do get around this error in the best way?

Normally if I make the call again the expected response is received and the robot can continue. Iv’e tried with → If response contains " Sorry, we just updated this page. Reopen it, and try again. → make the call again, but this doesn’t seem to quite solve the issue at hand unless I use several if’s in a row as one i not enough.

Iv’e put in a short delay and tried calling again but that is not stable enough.

Could something like a Retry Scope be used? if so, how would the boolean look like?

looking forward to your ideas

KR
Michael

Often the Retry Scope condition is set using the Element Exists activity. If the element does not exist, the Retry Scope will run again. Therefore, have the Element Exists activity look for something that only exists if the page does not say “Sorry, we just updated this page…etc.”.

The response from the API is a text string, so element exists wont work in this case. My second thougt could be a do while with an if checking if the response is as expected alongside with a counter so it would only try x amount of times.

You can use any logic or activity that you want to define so long as it equates to true or false.

Take a look at the Workflow Manager Activities / Microsoft.Activities packages published by Microsoft. I believe you’ll find an Is True activity that you can build a condition around.

1 Like

There is a package called Workflow Manager Activities which has an activity “Is True”. You can use that to check any boolean to see if it is set to true. You can then set your boolean based on what text value you get from the API.