RE: Workflow is not running as a background process.
Hello,
Recently, we also had this similar type of issue. The reason was, we were getting the entity from Workflow Context and trying to retrieve the field's values which were not presented in the context.
For Example - I have a workflow, which was triggering on Case Status change, in this case, I can only get the value of status from workflow context not the other fields of case entity. So to cater that, I will have to write service.Retrieve query in order to retrieve the values of other fields.
Now the question is, how it was working fine when I ran it On-Demand?
The answer is, while running the workflow on-demand, it does not actually know on which trigger the workflow is register to, that's why by default you get all the fields presented on the form in Workflow Context.
If my answer helped to resolve your issue, kindly verify it by clicking 'Yes'. It would be helpful to the other community members seeking to resolve a similar issue.
Cheers
Arpit
https://arpitmscrmhunt.blogspot.in