Updating a single SharePoint 2010 list item through multiple instances of a workflow - sharepoint-2010

I have a list called "Tasks"with a number column called "Count".
On the "Workflow Tasks" list, I have a workflow that gets triggered on item added or item changed. When a workflow task is created/edited, the workflow checks the status of the task and either adds 1 or minuses 1 to the "Tasks" "Count" column.
If I add a single task to the workflow task list, the workflow picks it up and adds 1 to the "Count" field perfectly. However, if i add two tasks to the workflow task list, one after the other, the second task's workflow results in an error.
It's almost like i'm unable to update the "Count" field multiple times. I assumed that the row was somehow "locked" while the first instance of the workflow was updating it, so I added a pause, which didn't help. (I guess because the 2 instances pause at the same time.) I then added another column to the "Tasks" list called "Busy" and set this to "Yes" while the first instance updated the row. When the second instance runs, it first checks if "Busy" is "Yes" and if so, it pauses for a duration and then carries on. This still does not work.
Is my assumption of row locking correct? Or what am I missing?
TIA!
Edit: I don't have access to the error logs and the error simply states "An error has occurred in [Workflow Name]".

do you have many workflows and only one task to change? workflow runs, when task is changed or workflow list is changed?

Related

Unique ID for TaskItem in Outlook

I'm importing all the tasks from outlook into a database.
To flag those that are different since the last import I need a unique ID for each task item object that does not change.
I've looked at TaskItem.EntryID. The microsoft documentation says it's only unique to each storage location which is fine as these tasks won't be moved.
The trouble is with recurrences:
I make a recurrent task due on 28/05/2019 which has an ID of ..D890000
I complete the task and outlook creates the new task for the next scheduled day.
The original task for 28/05/2019 now has a DIFFERENT ID of ..D8A0000
The new task for 29/05/2019 has the original ID of ..D890000
I have also tried using PR_SEARCH_KEY which is the same across these tasks.
Would anyone be able to tell me how to get a unique ID for each TaskItem that persists.
Or would you be able to confirm that the only time it will change is in the event of recursive tasks?
Many Thanks
It works as expected - when an instance of a recurring task is completed, Outlook creates a completed task for the current date and advances the existing recurring task to the next day while decrementing the recurrence count.

Using Linq to bind dependent SQL rows

enter image description here
I'm trying to find an efficient way to select all dependencies. The idea behind this table is:
Each taskID is a task that will be display to the user.
When taskid 22180 is selected by the user and completed it will
automatically enable the other tasks (activateTaskId = 22180) to
become available to the user hence inactive = 0. Up to that point
everything is fine.
What i need help at is when you have subsequent tasks.
So when taskid (22180) is selected and completed by the user the following tasks become available (22181,22182,22185 and 22186). As you can see if the user selects 22182 then the task dependent on it is 22183 and subsequently 22184 will .
how would i efficiently select all the task that branch off the initial one (22182) no matter how many may exist ?
Thank you

Looping Sharepoint Workflow - update column throws error

I am working on a sharepoint 2010 application where I need to "trick" SharePoint into updating a bunch of child list items when the parent is updated. What I have works some of the time to update some of the items in the child list. Most of the time I get an error for the workflow that updates the child list items.
The workflow could not update the item, possibly because one or more columns for the item require a different type of information.
There are three lists and related columns:
Project - Name (single line of text)
Project Tasks -Project Name (lookup field connecting to project), Project Name 2 (single line of text)
WorkFlowControl - This is used to create the looping
Here is a description of the logic:
When a Project Lead is assigned to that project a workflow fires to update the projects tasks with the project leader's name (updates a person field). It finds the first task that has the same Project Name 2 as the Project that was just updated. Once it sets the project lead it updates the Project Name 2 field by appending a number to the end of the Project Name. This is makes sure this item is not found and updated on the next loop.
When the task is updated it triggers a workflow that creates an item in the workflowcontrol list that holds both the project name and project lead
When an item is created in the workflow control list it triggers a workflow that updates the first matching item in the project task list that has the Project Name in the Project Name 2 field. When it finds one it sets the Project Lead and updates the Project Name in the Project Name 2 field.
The problem is the workflow that fires when an item is created in the workflow control list tends to error with the above error and sometimes the Task is updated with the project lead and other times it does nothing. I suspect the problem has to do with the fact that I am using the project name 2 value to find a list item and also updating that value to make sure it is not found on the next loop. Like I said it sometimes works (updates all tasks with project leads name) other times it only does a few. Which makes me think it is a timing thing but I don't know.
Here is a screen of what the workflow that updates the project tasks when an item is created in the workflow control list. It first sets a workflow variable to hold the project name, then updates the project lead with data found in the workflow control list. Next it should 'log' that the Project Lead was updated. Next it updates the project name 2 value where the project name 2 value matches the project name (see next image)

SSRS Data-Driven Subscription [based on static Subscription table] Not Picking Up Changes Made to Subscription Table

I have a .RDL report which I designed in BIDS and have deployed to my report server. The report asks for three parameters before viewing report: Year, Month and Customer ID. The report works great and does exactly what it is supposed to.
While I used to run each report individually because there were 2-3 customers, now there are 30+ customers who receive the report, so I wanted to switch to a more automated fulfillment method to get the reports generated. After doing some research it appears that a using Report Manager to create a "Data Driven Subscription" (DDS) using the "Windows File Share" option gives me the capabilities I need.
As part of creating the DDS, I created a table called [Subscription] which is a table containing one row for each customer receiving the report and has the following columns:
Year
Month
CustomerID
FileName
FileLocation
Overwrite
Format
...so through using the DDS Wizard in Report Manager, I was able to successfully set up a Data Driven Subscription (which is linked to various columns in the [Subscription] table) which creates a new report for each customer in the [Subscription] table, saves [and overwrites, if necessary] it in a location of my choosing as a PDF (specified in [Subscription].[FileLocation], or the FileLocation column of my table for each row), and runs every minute (I plan on changing frequency to once a week, eventually).
This works flawlessly, giving me a new set of 30 reports in the directory of my choosing, with each report having a name I assigned in the FileName column of my table. Exactly what I was looking for.
HERE'S THE PROBLEM: When I update the FileLocation or FileName (or anything, really) in the [Subscription] table - it doesn't pick up the changes right away. Sometimes it doesn't even pick it up at all (for example I updated the [ReportName] column for one customer from Report_711622 to SpecialReport_711622, so that the output file for that customer should be named SpecialReport_711622 while all of the other reports should be called Report_XXXXX [no Special prefix]. But the file name of report for Customer 711622 remains the same!
It's almost like the job only see's what it needs to do once a day, and then does not go back and reference the [Subscription] table until I leave for the night, then when I come back in the morning it picks up the change.
Since I am about to scale this process out to a large customer-base using a different report, I need to be able to make edits to the [Subscription] table and have them get picked up by the Data Driven Subscription immediately (and if not immediately, at least a fixed interval of time that I can adjust, so that I can know 100% when the change will get picked up).
Does anyone know what's causing my lag? How do I change it so that updates to the Subscription table get picked up regularly? I'm also having issues with creating new DDS on other reports (following the exact process outlined above) - I've created the subscriptions, for every minute, and it says they are running and the number of outputs match the number of customers with 0 errors, but there are no files in the drive I specified (or anywhere else I've looked, for that matter).
Any help would be greatly appreciated!
I think the answer lies in the mechanism SSRS uses. There are a few places "lag" can occur.
The subscription is in fact an SQL Agent job which creates a record in the Event table. This table is a queue that SSRS checks to do scheduled tasks.
There is a small amount of time between the moment the subscription creates the Event record and the moment SQL reads it and starts creating the dataset for your DDS. The creation of the DDS dataset takes some time, too. In this time, the subscription will be in the Pending state. If you change anything in the data during this time, The subscription will still use the old data as report parameters. So obviously you will not notice your change until the next scheduled run.
Which brings me to the following: if a subscription is still being run and the next schedule kicks in (chances are, because yours runs every minute), the engine will not execute it, but wait for the next subscription schedule, and so on. So that's another possibility of lag - and cause of missing reports for a certain schedule minute. The subscription processes reports sequentially, one row from your DDS recordset at a time. Again, this takes some time. You can also see that in the subscription window when it says: # of # processed.
I suggest you look at the Event table in the database ReportServer during an execution. Also the ExecutionHistory views (there are 3) may be interesting. A scheduled run shows up as a RequestType = 1 and generates one record for each report. You can see the exact timing and parameters of each report that is run in the subscription. You may be able to extract the data you need to resolve your other issues.
EDIT: Here is a more elaborate guide to DDS data and events
http://blogs.msdn.com/b/deanka/archive/2009/01/13/diagnosing-and-troubleshooting-subscriptions.aspx
http://blogs.msdn.com/b/deanka/archive/2010/02/16/troubleshooting-subscriptions-part-ii-using-the-report-services-trace-log-file.aspx
Could this "Double-Hop" problem be the source of my issues? I'm so stuck on this one!
The Double-Hop Problem - MSDN Knowledgecast

How to create a simple "Expires" workflow to repeat in Sharepoint 2010

I noticed that the "Announcements" web part has the "Expires" feature, but any other links web part I create does not have it. I wanted to add the "Expires" to my custom links web part. So far I got it to delete itself with a simple
If Current Item:Expires is less than Today
Delete item in Current Item
then Pause for 0 days, 0 hours, 1 minutes
But realized it does not repeat itself, only runs when the item is created. How would I get this workflow to run everyday as a background process?
Update: Workflow I'm trying
Step 1
If Current Item:Expires is less than Today
Delete item in Current Item
Step 2
Pause until Current Item:Expires
then Pause for 1 days, 0 hours, 0 minutes
then Delete item in Current Item
for this, I think you could just place it where workflow runs on item creation. Since you have a field that would represent when this item should be deleted, you could do this in the workflow:
if expire date
I'm not sure if the condition is a best practice though, i do this so that it goes to the action every time
in the "this time" value, place in the field "expire"
then it would proceed to deleting the item
What happens here is that the item is left pending until the date you specified in your "expire" field, then it automatically deletes the item.