I need to figure out if something is possible or if there is a better solution to my issue. Below is a scenario that I have. Inside of the activity's Execute method, I need to be able to run 3 different methods. The first will present a UI (either HTML or VXML) and wait for user input. At this stage, I'm anticipating having the workflow persist (if possible). The second method will take the data input by user and validate it. If the input is valid, the next method will run, which will process the data. If the input is invalid, the UI will need to be presented again. Is this something that is possible within the execute method or is there a better solution to this scenario?
protected override void Execute(NativeActivityContext context)
{
// Present UI and get user's input
// IRTFunctions.PresentUI(itemRefName);
// Input validation
// IRTFunctions.ValidateInput(itemRefName);
开发者_Go百科 // Additional logic, like setting additional fields
// IRTFunctions.ProcessAdditionalLogic(itemRefName);
}
You should never block the Execute() method of an activity. Doing so will actively harm the workflow and prevent it from being persisted and possibly unloaded.
Instead you should create a bookmark using the NativeActivityContext and redirect the user to some UI page asynchronously with the bookmark name. Later, when the user has completed the UI, the user resumes the bookmark and passes the data entered. Now this could be days or even weeks later. When a bookmark is resumed the workflow is reloaded and an bookmark resumption handler is invoked and you get to validate the input and decide what to do. You can create multiple resumption bookmarks what you need to explicitly close when you accept the input as valid.
精彩评论