SharePoint Workflow completes prematurely when reaches the onWorkflowItemChanged event - sharepoint

I have a workflow running on a forms list. The workflow has an OnWorkflowItemChanged activity sitting within a While activity. I know that the workflow enters the While loop and checks the while condition that has the value 'true', but it does not enter into the OnWorkflowItemChanged activity to execute its code. Once it enters the while activity it stop the workflow execution and sets the workflow status as 'Completed' in spite the fact that after the while activity there are several more activities.
What could cause the workflow completion when it reaches the onWorkflowItemChanged activity???

If there are any unhandled exceptions in your activity, the workflow will move to complete status. Please debug your code and see if you can handle the exception.
Thanks!

Related

How to handle cancel activity event in SharePoint custom activity?

I am trying to replicate the activity "Assign a task" by building a "Workflow Custom Activity" that does the same but with some customizations I need for my requirements, the only problem I have encounter so far is that if the workflow is being canceled or the activity is being canceled (by going out from a parallel block without finishing), the "Assign a task" activity sends a notification email saying that the task is canceled, I would like to do that as well in my custom activity but I do not find a way to capture the "cancel event" in order to send the email in my custom activity.
I have tried the following:
Create an event receiver: I haven't find in "Workflow events" an event to capture cancel event.
Using the activity "WaitForCustomEvent": I do not find over the internet what is the name of the activity cancelation event to capture it in here.
Try/catch block: I have seen that the workflow is "Terminated" it finished with the following exception: System.Activities.Statements.WorkflowTerminatedException, however if I tried to capture that in the activity it do not compile. I've tried with ust System.Exception, but it doesn't go to the Catch block, also when the workflow is canceled I do not see that it thrown any exception.
I'm building the Workflow Custom Activity in Visual Studio 2017 for SharePoint 2013.
Thank you in advance.

SharePoint Designer 2013 Workflow Lookup for SP Online

I'm having issues with my SP Online Workflow. Setting up a custom list for Time-off requests. Person puts in request, task is assigned to their manager, then manager either approves or denies request, then informs the requester of the outcome. That whole part works great.
I've added an option for the requester to cancel the request. If the request has already been approved by the manager then it sends an email to the Manager, HR, & requester saying the request was cancelled. This part works fine.
The part that I'm having issues with is if the request hasn't been approved/rejected by manager and requester cancels. It's not sending out the email to manager and changing the Workflow Status.
I have it configured exactly like the cancel workflow if it's been approved. What am I missing here? Any help would be greatly appreciated.
Here are some images of the entire workflow and the Workflow lookup in question:
Entire Workflow
Workflow Lookup in Question
Thanks
I think if one of your condition complete, it should just go the next stage in your case which is end of workflow. When you condition is satisfied, you don't need to go through all other if anymore.
If request cancel equal no
If outcome equal approved
Go to next stage
If outcome equal rejected
Go to next stage
Else
If taskStatus equal not started
Go to next stage
If taskStatus equal completed
Go to next stage
I switched not started and completed. Because logically speaking you should go not started first.

User event not firing on create event

I'm having a strange problem, where a user event, made to fire for sales orders on the Create event type, is not starting at all for some of them.
Trigger on: BEFORE SUBMIT FUNCTION
STATUS - Released
EVENT TYPE - Create
LOG LEVEL- Error
EXECUTE AS ROLE - Full Access
All access boxes are checked.
The only pattern I've found so far is that all failures are being created by a Script (Scheduled), which makes little sense to me...
Has anyone found a similar issue??
Do you want the scheduled script to trigger the user event script? Do you have the "All Roles" checkbox checked? I believe you need this to be checked for the UE script to be execute when the scheduled script creates a record.
You might want to check your scheduled script if it is error free. One possible reason why the user event script is not running is because the scheduled script has an error. Run your scheduled script first from the script debugger to see if there are errors.

SharePoint Expiration Policy does not fire ItemDeleting Event Receiver

We have attached an ItemDeleting event receiver to a list that requires certain maintenance to be performed in other lists whenever an item is deleted. It works fine when an item is manually deleted by a user. However, if an item is deleted as a result of the Information Management Policy we have defined to delete expired items, the ItemDeleting handler is not executing. Is this standard MOSS behavior? If so, are there any suggested workarounds?
I would run a custom workflow using the policy, there you can define your own logic, which is what you probably try to achieve

Sharepoint Workflow Modification is not disabled

I am working on a Sharepoint Server 2007 State machine Workflow. Until now I have a few states and a custom Association/InitiationForm which I created with InfoPath 2007. In Addition I have a few modification forms. I have a Problem with the removing of the modification link in the state-page of my workflow.
I have a state and in the initialize block of this state my EnableWorkflowModification Activity appears. So at the beginning of the state the modification is active. In the same state I have an OnWorkflowModification activity, which catches the event raised by the EnableWorkflowModification activity. After this state my modification is over and the link should disappear in the state-page. But this is not the case.
Both activities have the same correlation token (modification) and the same owner (the owning state).
Has anybody an idea why the link is not removed and how to remove the modification link?
Thank you in advance, Stefan!
Have you checked the OnWorkflowModification event handler is actually firing? Try debugging or adding some eventlog traces to make sure it is. I've run into similar issues with OnWorkflowItemChanged event handler.
Make sure you have the enableWorkflowModification and onWorkflowModified inside an eventHandlingScopeActivity, and set that as the OwnerActivityName for each.

Resources