/// <summary> /// Gets the automation state and move contact to previous step. Called when the "Move to previous step" button is pressed. /// Expects the CreateAutomationState method to be run first. /// </summary> private bool MoveContactToPreviousStep() { // Get dataset of contacts string where = "ContactLastName LIKE N'My New Contact%'"; int topN = 1; var contacts = ContactInfoProvider.GetContacts().Where(where).TopN(topN); // Get the process WorkflowInfo process = WorkflowInfoProvider.GetWorkflowInfo("MyNewProcess", WorkflowTypeEnum.Automation); if (!DataHelper.DataSourceIsEmpty(contacts) && (process != null)) { // Get the contact from dataset ContactInfo contact = contacts.First <ContactInfo>(); // Get the instance of automation manager AutomationManager manager = AutomationManager.GetInstance(CurrentUser); // Get the process state AutomationStateInfo state = contact.Processes.FirstItem as AutomationStateInfo; if (state != null) { // Move contact to next step manager.MoveToPreviousStep(contact, state, "Move to previous step"); return(true); } } return(false); }