In my work on automating system center service manager, I have learned my lessons!
On my blog i want to share bits of my experiences so that hopefully you do not hit the same issues in your automation.
Always retry your actions when trying to update an item in service manager
and it is always a good idea to think about retried when connecting to any system! cloud or on-prem!
Why? you might ask
In this case it is about the dreadful service manager error message for
“The item has been changed by another user or process. Cancel your action, reopen the item and try again.”
This error happens if another user or the system has changed the item while it was open in your console/form.
but it could be any errors such as temporary network problems or similar
In any kind of automation, depending on how it is build, the item might be open for more or less time when updating.
In Orchestrator you can use the “Update Object”
This activity opens the item and changes the value.
It only use a small amount of time, so you might think that it is no problem.
but a some point you will hit the same problem because a user or a workflow tried to update the item at the exact same time!
So what do to?
In Orchestrator it is easy to do:
1. Right Click the activity and select “Looping…” (in this case i have renamed it to Update SR)
2. Enable the looping and set a delay for instance 5 seconds between the attempts
Now looping is enabled!
3. Change to the Exit Tab
By default the exit condition is “Success”.. which is great! … unless!
unless the error is a permenent error, such as servername is wrong or access denied.
Then this loop will retry for ever and ever in an infinite loop!
4. To fix this we add a condition for exiting the loop after a number of attempt.
5. Click Add
6. Click the new added condition on the “Update SR”
7. in the published data dialog check the “Show common published data” checkbox
8. Now you are able to select properties for the loop status
9. Select the “Loop: Number of Attempts”. or you could choose “Loop: Total duration” which is defined in seconds
10. Set the condition operator to Equals and the value to 10 or how many retried you want.
11. Click Finish
12. Now looping is enabled and it will retry 10 times with a delay of 5 seconds between!