-
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Request]: Complete-PSWorkItem include original task id with archived task #7
Comments
This makes sense and is something I should have looked at harder when I started this. Currently, I'm using the |
One thing I could do that wouldn't be that hard is to add a property to the The biggest issue would be updating the database and table structure. |
I like that idea. For now it's not really something I need, it's just nice to see when I'm choosing a task. So, my wrapper works perfectly for me. |
I've been trying a few things, and maybe writing things out will help clarify the situation. The task object has a hidden property called taskID which is a GUID. The ID number of a PSWorkItem is the row number from the tasks table. When a task is completed, it is copied to the Archive table. At this point, when I get a completed task the ID number is a different row number because it is a different table. I've been testing code where the archive table has an additional column called The problem is that when I create a new task, it will have a row number identical to the last completed item. This means when I get completed items, I will have duplicate items with the same original id. To me, this makes this new table column meaningless. Getting a completed item by its original ID could return multiple entries. I wonder if I could create a new PSWorkitem property and table column called |
The code I have now that seems to work copies the original ID to the ID for the archived item. I think I have this working in the current release. |
I think I have this resolved. If not, we can re-open the issue. |
Describe the request
I ended up using the following in my own wrapper for Complete-PSWorkItem so that I could see both the new and old Task ID's when closing a task.
if ($ID) { "Completing Task(s)" | Write-Verbose $completed_tasks = { foreach ($taskid in $ID) { "Complete Task: $taskid" | Write-Debug Complete-PSWorkItem -ID $taskid @parameters | Select-Object -Property @{Name = 'OriginalTaskID'; Expression = { "$taskid" } }, Name, Description, Category, CompletedDate, @{Name = 'ClosedTaskID'; Expression = { "$($PSItem.ID)" } } } }
PowerShell version
7.2
Platform
Windows 11 Home
The text was updated successfully, but these errors were encountered: