Jun 05 2018 06:13 AM
How do I extend the execution time of a SharePoint workflow? Currently we are concerned with SharePoint 2016 Workflows. It appears to be running for around 20 minutes and then terminates. The events that we have associated to it are terminating at random locations. The code works outside of workflow and for shorter running processes. So, we are thinking timeout.
We have executed the following in an attempt to extend workflow to 30 minutes.
stsadm -o setproperty -pn workflow-eventdelivery-timeout -pv "30"
Is there something else that we can do, or that I am missing, to extend this? We can attempt reconfiguration to make things run shorter; however, I would like to have control over how long things can run. I don't want to limit the process, but be able to lengthen it if needed.
Thanks,
Craig
Jun 05 2018 01:28 PM
Jun 05 2018 06:56 PM
Solution@Craig Lamb SharePoint 2016 uses new workflow engine. You can check the blog post here on how to use Custom Events for Long Running External Processes.
Jun 06 2018 11:42 AM - edited Jun 06 2018 11:43 AM
Currently our workflows are quite minimal. They are essentially just a queue of Actions to be performed in a desired order.
So, is the idea to...
1. Create the event and wrap all the Action processing in it.
2. Then call it from the workflow so that it all this processes is executed outside of WF.
3. Then once completed WF advances to the next step.
Is the difference in that this will move the processing from the WF to the Service or site?
Jun 06 2018 03:53 PM
Or... have we gone about things wrong in that a Workflow Custom Activity is what we need to call from the page instead of a SharePoint workflow? Thus Workflows are small and light weight while Workflow Custom Activities are for heavy lifting and larger tasks.
Or do I need both... and a Workflow Custom Activity is something called from a Share Point Workflow to process the larger tasks.
Sorry for all the questions. I am finding that there appears to be little information on this, and that you appear to be one of the few experts. :)
Jun 06 2018 06:32 PM
@Craig Lamb If you look at the code published by @Andrew Connell here , all your questions will be cleared. I am adding a couple of screenshots for your reference. Please let me know if you still have questions. Thanks.
Jun 08 2018 08:36 AM
I went through and looked at this yesterday. I am struggling with a few things.
The example doesn't have any CS files so I am unable to following in the code.
Our workflow is fully from Visual Studio so we don't use SharePoint designer for much.
I have also looked at the following link...
I was able to create 'Workflow Custom Activity' and add a wait action; however, I was unable to determine how to call from Visual Studio or integrate with my existing SharePoint workflow in Visual Studio. I was able to determine that though the following is provided...
stsadm -o setproperty -pn workflow-eventdelivery-timeout -pv "30"
It's not honored. I changed the value to 60 and it only allowed the WF to run for about 20 minutes.
I am currently thinking that I need to create a 'Workflow Custom Activity' but I don't see how to tie it to my existing workflows. If I can't, and it's something I call from my client that's fine. However, that will result in some hefty code changes. Currently trying to just create the 'Workflow Custom Activity' place the WaitEvent on it and then call and see if it hits the break points I desire.
Jun 08 2018 09:58 AM
Is the new 2016 Workflow engine different from SP 2013 Workflow engine?
Jun 08 2018 04:33 PM
@Prasad Punneri, SharePoint 2016 uses same WF engine as SharePoint 2013.
Jun 08 2018 05:07 PM - edited Jun 08 2018 05:09 PM
Hello Craig
Here's the C# code for 2013 Workflow the fleetmanagementApp. Did you look at this one? This one shows how to tie the WaitForCustomEvent to the workflow.
https://code.msdn.microsoft.com/officeapps/SharePoint-2013-Route-25a25d87
Thanks
Jun 08 2018 05:25 PM
SharePoint 2013 or SharePoint 2016 Workflows are declarative but you can make web service calls from these workflows to execute the code.
You need to double-click on each state in the workflow to know more it. This app user association form. I am adding few screenshots for your reference.
Here you can see how the delay activity was added. The last screenshot you can see how the HTTP activity used to make a call to external web service.
You can create a custom workflow activity using visual studio and it will be available automatically in the toolbox as part of the solution. Please let me know if you still have questions. Thanks.
Jun 11 2018 07:57 AM - edited Jun 11 2018 08:00 AM
Sorry that I appear so confused. I GREATLY appreciate your desire to help.
Attached is a screenshot of our solution. The current screen represents our Workflow. As you can see, we essentially create the workflow object and then it calls our custom code. All of our workflows are from Visual Studio and are executing C# objects that we have created through this path. None are via SharePoint Designer. Our custom code block executes; however, through the workflow container it times out in 20 minutes or so. As you can see, I added an Activities folder under Workflows which is a "Workflow Custom Activity". The questions that I have are the following.
1. I see the WaitForCustomEvent in the "Workflow Custom Activity".
Do I need to move everything that is in the JEMSWorkerProcess to the NEW "Workflow Custom Activity \ ExecuteActions" and then call it differently from the client? Or, can I call this from the JEMSWorkerProcess.
I am trying to prevent myself from having to redo A LOT or work. The JEMSWorkerProcess implementation works. It just won't allow for long runs greater than 20 minutes. If I could extend that it would be great.
Currently we create the WF with...
// Retrieve sharepoint list item based on Project name / folder name for workflow instantiation
SPQuery query = new SPQuery();
query.ViewAttributes = "Scope=\"RecursiveAll\"";
query.Query = "<Where><Eq><FieldRef Name='FileLeafRef'/><Value Type='File'>" + topFolderStr + "</Value></Eq></Where>";
query.RowLimit = 1;
query.ViewFields = "";
SPListItemCollection items = taskOrderDocList.GetItems(query);
SPListItem item = items[0];
//instantiate JEMSWorkerProcess workflow based on the scenario folder
SPWorkflowAssociation workflowAssociation = taskOrderDocList.WorkflowAssociations.GetAssociationByName(Constants.Workflow.JEMSWORKERPROCESS_UNIQUENAME,
System.Globalization.CultureInfo.CurrentCulture);
//pass in the currentstepID so that the actions can be retreived by sp workflow for the step.
string eventData = string.Format("<initData>" + invokeType.ToString() + "," + taskOrderID.ToString() + "," + scenario.ToString() + "</initData>");
SPWorkflow wf = SPContext.Current.Site.WorkflowManager.StartWorkflow(item, workflowAssociation, eventData, SPWorkflowRunOptions.Asynchronous);
If I have to rewrite everything an move it to a "Workflow Custom Activity" that is a BIG effort and learning curve. So, I am trying to get a pulse on what I am up against.
If I change to a Custom Activity is it going to be something like...
SPQuery query = new SPQuery();
query.ViewAttributes = "Scope=\"RecursiveAll\"";
query.Query = "<Where><Eq><FieldRef Name='FileLeafRef'/><Value Type='File'>" + topFolderStr + "</Value></Eq></Where>";
query.RowLimit = 1;
query.ViewFields = "";
SPListItemCollection items = taskOrderDocList.GetItems(query);
SPListItem item = items[0];
string eventData = string.Format("<initData>" + invokeType.ToString() + "," + taskOrderID.ToString() + "," + scenario.ToString() + "</initData>");
ClientContext ctx = new ClientContext(SPContext.Current.Site.Url);
WorkflowServicesManager workflowServiceManager = new WorkflowServicesManager(ctx, ctx.Web);
var workflowInstanceService = workflowServiceManager.GetWorkflowInstanceService();
var workflowInstances = workflowInstanceService.EnumerateInstancesForListItem(taskOrderDocList.ID, item.ID);
ctx.Load(workflowInstances);
ctx.ExecuteQuery();
workflowInstanceService.PublishCustomEvent(workflowInstances[0], "ProcessActions", eventData);
2. Is there a way to extend the JEMSWorkerProcess execution that is just a "Workflow" instead of a "Workflow Custom Activity"?
All I really want is the easiest way for my custom code in JEMSWorkerProcess to run longer, and for me to have total control over that length.
Jun 12 2018 07:06 AM
Jun 12 2018 08:09 AM
May be am deviating from the topic. if i wanna connect to a Oracle DataSource from SPList, from my SPO site, what are the ways to achieve this?
if I use MSFlow, will it be helpful ?
if I use custom SP D WF , how to make calls to manipulate Oracle Data?
How to use BCS connectivity in SPO ? is it possible to connect Oracle DataSource using BCS in SPO using SPD 2013 ?
Jun 12 2018 09:35 AM - edited Jun 12 2018 09:38 AM
As far as i know from your WF picture, its a sequential workflow you wanna execute.
and the one Devendra is suggesting about the SP 2013 based WF engine that doesnt have any C# code.
its purely declarative. so, the WF you have created is will generate a WSP,along with DLL and deploy the wsp onto your solution store. This is the traditional approach we followed till the advent of SP 2013.
So, you can use any activity that's applicable in MOSS 2007 WF, SP 2010 WF Visual studio workflows.
Either you can use sequential or state machin WF.
SPWorkflowAssociation , SPQurey are the object thats used extensively in SSOM(Server Side Object Model).
But do not mix this with the SP 2013 declarative WF. if you try this type of combining a declarative SP 2013 WF with the old SP 2010/ MOSS 2007 Sequential WF /State machine , then it will fail.
The workflow you have created will work only in the ON-PREM environment. you cant execute code against a SPO site.
Jun 12 2018 10:22 AM
Jun 13 2018 03:00 AM - edited Jun 13 2018 03:01 AM
Let me know, whats your environment, is it ON-PREM or O 365-SPO and whats you exact requirement .
If its ON-PREM you have the freedom to play along with the rich set of SSOM APIs.you can have a look at the SharePoint's social.msdn forum that has dedicated workflow related categories and source code available . Myself too posted many answers specific to workflow,- whether its sequential or state machine.
If its SPO Env,you have to look at declarative workflows mentioned by Devendra @Devendra Velegandla .
Jun 13 2018 08:39 AM
Jun 13 2018 09:48 AM - edited Jun 13 2018 09:52 AM
@Craig Lamb whether the task list associated with your splist is crossed the threshold of 5K items ?
Do you have managed metadata columns(taxonomy) associated with workflow ?
Do you have more than 8 lookup columns or people picker columns in your SourceList?
Have you used content types in your workflow? if yes,how these content types are deployed( the best practice is to deploy the content type& workflow as a feature ) at the site level and activate it in Order ( this activation /deactivation of feature should be in a specific order else, WF will fail).
There may be many reason for your WF termination.
Did you analyse logs folder/log files through which you may get a hint, whats happening in the Env.? <p>
One more thing you can try, in the workflow, you can add a logtohistoryactivity and log all these actions,write into an text file, thus, you will be able to track the source of error. At what point , its failing. Or simply a codeactivity and inside this codeactivity, you write the values,into a text file.
it may also be important that, any of the columns in your soucelist is accidentally deleted by your teammembers and they recreated thus the internal name in the CAML query might have changed...
Jun 05 2018 06:56 PM
Solution@Craig Lamb SharePoint 2016 uses new workflow engine. You can check the blog post here on how to use Custom Events for Long Running External Processes.