Save history of state transitions for WF state machine - workflow-foundation-4.5

I'm investigating using .NET 4.5 Workflow Foundation to implement state machines for certain objects. I wondering how I can save the history of transitions between states. I would be using persistence, but my understanding is that this just tracks the current state, not the history of transitions and it is removed when the terminal state is reached.
Specifically I'm looking for something like the following:
Sequence Date Original State Action New State Actor
-------- ----------- --------------- ---------- ----------- ---------
1 12/25/2013 <none> <none> Draft bsmith
2 12/27/2013 Draft Submit Pending cjones
3 1/2/2014 Pending Approve Published dkelly
The exact format is to be determined, but as is shown, this shows how the object moved from one state to another, by whom and when.
How can this be done with WF?

I suggest you read on MSDN about Workflow Tracking and Tracing in particular you will want to read about Tracking Participants and custom Tracking Participants. The default participant is the windows event log I believe.
Here is the MSDN sample for a custom SQL tracking participant: SQL Tracking Sample

Related

BPM Human Task scheduling

We use Camunda to run business processes but my question is more about general BPM patterns than a specific tool that implement it.
Let suppose the following very simple use case and a homemade application on top of it that use BPM engine API to query tasks and complete them.
Let suppose that Action 1 will be auto assigned to John and Action 2 to Bob. From my comprehension of BPM, when the process start, Action 1 is created and assigned to John. When John complete the Action 1, the Action 2 is created and assigned to Bob. And that's what we want because Bob could not start working on Action 2 if Action 1 is not yet completed. Fine...
Now suppose that as the team manager, I want to schedule activities of John and Bob. I'm thinking about introducing an initial task handled by me to configure a planning.
When the process now start, a new task is created and is assigned to me. I want in my homemade application to query the BPM engine in order to get all tasks (actives and inactives) in order to add planning information (planned start date and due date). For example, I want to specify that:
Action 1 should start on 01/01/2021 and should be closed on 03/01/2020.
Action 2 should start on 04/01/2021 and should be closed on 05/01/2020.
With this kind of information, John and Bob could connect to the task list and see that a "not yet started" task is waiting for them on a specific time range. The main goal of this is to manage a team calendar of activities.
I don't see how to implement that in BPM due to the fact that, in my comprehension, tasks are created when the process reach them so we could not have information about "Not Yet Started" tasks.
Any ideas? Suggestions? Bests practices?
Tx
I asked a question above, but if the answer is "Action 2 still requires Action 1, and I don't want people to see the tasks before their start date." Then the model would look like this -
The timers would be set to the start dates the manager picked. I have a strong opinion that the tasks shouldn't be in the list if the user can't work them. So if they should not work it before the start date, we shouldn't have it in their task list. This is different than say, a report on the status of the process, which certainly can show that we are waiting until date X to issue Action 1. There is also a way to model it so that someone can say "Yeah, you know what, I want to start this now" and trigger the action early from that dashboard.
To have the tasks for John and Bob active at the same time, you could use a parallel gateway ... and then filter the tasks in a custom task list based on the configurations you made ...
If you want to keep the sequence of tasks (which is the better option imho) you can still set variables in your planning task up front and then read these values when the second task is started by registering a TaskListener on your model.

Field seems to be missing in some responses in Active Collab 4 API

I am looking for fields in task called is_completed and completed_on.
When I do the /projects/#PROJECT-ID#/tasks API call I see is_completed but I do not see completed_on.
We are using the Cloud based version of Active Collab 4.
Any reason why I am not seeing completed_on?
In Active Collab 4, there is a difference between "brief" API responses (used when returning large lists of objects), and detailed responses (used when a single object is returned via API).
When you are listing a list of tasks, you will get all individual tasks in brief format, but when you fetch details of each task, you'll get a detailed response.
In brief task responses, completed_on timestamp is not included, only whether tasks is completed or not (is_completed). To get the timestamp of completed tasks, make an additional call to task API for each task that is completed:
https://activecollab.com/help-classic/books/api/tasks#s-task-id
PS: In Active Collab 5, we removed brief and detailed concept, so each object always returns a single set of properties.

Netsuite Timsheet feature not enabled error even though it should be enabled

I'm trying to create a timesheet in Netsuite programmatically through API calls but I get "Timesheet featured is not enabled" error even though I checked possibly all timesheet related checkbox features under Setup-->Company-->Enable feature are checked. Anyone has seen this before?
Thanks.
Process of enabling Timesheets feature
Published 04/22/2014 11:20 AM | Updated 01/29/2015 12:41 PM | Answer Id: 38014
1) Customer requests enabling of Timesheets feature via technical support ('Two Administrators' or an 'Administrator and a Primary contact' or an 'Administrator and a Decision Maker' should sign off in writing that they understood the repercussion of enabling this feature. And they would want this feature to be enabled on their account.)
2) Checkbox for Timesheets is available on Enable features page
3) Customer (Admin) enables the feature
- Notification appears with checking of the box:
4) Customer saves the preferences
5) While migration takes place, Time Tracking box is checked
- It is not possible to change feature setup during migration, following notification pops up if someone tries to do so:
6) When migration is complete
a) Timesheets box is checked
b) E-mail is delivered once migration is successfully complete
Subject: The Timesheet feature has been enabled
Body: The Timesheet feature has been enabled and the system has finished updating your Time Tracking custom fields and time transactions.
- if migration fails, e-mail is also sent, notifying admin about failure
As for the estimated time, it depends on amount of data that are migrated. To give you at least some rough estimate, we are talking about hours here. Small customers can be migrated within hour, larger ones couple of hours. If the process of enabling/disabling the feature takes 2 days or more, please contact NetSuite Support.

What kind of data exposed from linkedin API

Wanted to know what kind of info is exposed with linked-in api?. Particularly I want to know how may levels of connection info it exposes (I mean first, second ...etc)?. Are there any ready made test tools or web page which does this (to see what data being exposed)?
Whatever level of information the user has specified for show.
But in most cases, it will be name, location, job title, company, past companies, education. You can also drill in to information such as your contacts.
I would checkout https://developer.linkedin.com/
you can get 1st and 2nd degree network (connections)

Building a notification system [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Closed 4 years ago.
Locked. This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions.
I am at the start of building a Facebook style notification system for our page (social gaming type) and I'm now researching what would be the best way to design such system. I'm not interested in how to push notifications to the user or anything like that (for now even). I am researching how to build the system on the server (how to store notifications, where to store them, how to fetch them etc...).
So ... some requirements that we have:
at peak times we have about 1k concurrent logged-in users (and many more guests, but they don't matter here as they will not have notifications) that will generate many events
there will be different types of notifications (user A has added you as a friend, user B has commented on your profile, user C has liked your image, user D has beaten you on game X, ...)
most events will generate 1 notification for 1 user (user X has liked your image), but there will be cases where one event will generate many notifications (it's user Y's birthday for instance)
notifications should be grouped together; if for instance four different users like some image, the owner of that image should get one notification stating that four users have liked the image and not four separate notifications (just like FB does)
OK so what I was thinking is that I should create some sort of queue where I would store events when they happen. Then I would have a background job (gearman?) that would look at that queue and generate notifications based on those events. This job would then store notifications in the database for each user (so if an event affects 10 users, there would be 10 separate notifications). Then when user would open a page with the list of notifications I would read all those notifications for him (we ware thinking to limiting this to 100 latest notifications) and group them together and then finally display them.
Things I'm concerned about with this approach:
complex as hell :)
is database the best storage here (we are using MySQL) or should I use something else (redis seems like a good fit too)
what should I store as a notification? user ID, user ID who initiated the event, type of event (so that I can group them and display appropriate text) but then I kinda don't know how to store the actual data of the notification (for instance URL&title of the image that was liked). Should I just "bake" that info when I generate the notification, or should I store the ID of the record (image, profile, ...) being affected and pull the info out of the DB when displaying the notification.
performance should be OK here, even if I have to process 100 notifications on-the-fly when displaying the notifications page
possible performance problem on every request because I would have to display the number of unread notifications to the user (which could be a problem in its own since I would group notifications together). This could be avoided though if I generated the view of notifications (where they are grouped) in the background and not on-the-fly
So what do you think about my proposed solution and my concerns? Please comment if you think I should mention anything else that would be relevant here.
Oh, we are using PHP for our page, but that shouldn't be a big factor here I think.
A notification is about something (object = event, friendship..) being changed (verb = added, requested..) by someone (actor) and reported to the user (subject). Here is a normalized data structure (though I've used MongoDB). You need to notify certain users about changes. So it's per-user notifications.. meaning that if there were 100 users involved, you generate 100 notifications.
╔═════════════╗ ╔═══════════════════╗ ╔════════════════════╗
║notification ║ ║notification_object║ ║notification_change ║
╟─────────────╢ ╟───────────────────╢ ╟────────────────────╢
║ID ║—1:n—→║ID ║—1:n—→║ID ║
║userID ║ ║notificationID ║ ║notificationObjectID║
╚═════════════╝ ║object ║ ║verb ║
╚═══════════════════╝ ║actor ║
╚════════════════════╝
(Add time fields where you see fit)
This is basically for grouping changes per object, so that you could say "You have 3 friend requests". And grouping per actor is useful, so that you could say "User James Bond made changes in your bed". This also gives ability to translate and count notifications as you like.
But, since object is just an ID, you would need to get all extra info about object you want with separate calls, unless object actually changes and you want to show that history (so for example "user changed title of event to ...")
Since notifications are close to realtime for users on the site, I would tie them with nodejs + websockets client with php pushing update to nodejs for all listeners as change gets added.
This is really an abstract question, so I guess we are just going to have to discuss it instead of pointing out what you should or shouldn't do.
Here's what I think about your concerns:
Yes, a notification system is complex, but not as hell though. You can have many different approaches on modeling and implementing such systems, and they can have from a medium to a high-level of complexity;
Pesonally, I always try to make stuff database-driven. Why? Because I can guarantee having full control of everything that's going on - but that's just me, you can have control without a database-driven approach; trust me, you are gonna want control on that case;
Let me exemplify a real case for you, so you can start from somewhere. In the past year I've modeled and implemented a notification system in some kind of a social network (not like facebook, of course). The way I used to store notifications there? I had a notifications table, where I kept the generator_user_id (the ID of the user that is generating the notification), the target_user_id (kind of obvious, isn't it?), the notification_type_id (that referenced to a different table with notification types), and all that necessary stuff we need to fill our tables with (timestamps, flags, etc). My notification_types table used to have a relation with a notification_templates table, that stored specific templates for each type of notification. For instance, I had a POST_REPLY type, that had a template kind of like {USER} HAS REPLIED ONE OF YOUR #POSTS. From there, I just treated the {} as a variable and the # as a reference link;
Yes, performance should and must be ok. When you think of notifications you think of server pushing from head to toe. Either if you are going to do it with ajax requests or whatever, you are gonna have to worry about performance. But I think that's a second time concern;
That model that I've designed is, of course, not the only one that you can follow, neither the best as well. I hope my answer, at least, follows you into the right direction.
╔════════════════════╗
║notification ║
╟────────────────────╢
║Username ║
║Object ║
║verb ║
║actor ║
║isRead ║
╚════════════════════╝
This looks a good answer rather than having 2 collections. You can query by username, object and isRead to get new events(like 3 pending friend requests, 4 questions asked etc...)
Let me know if there is problem with this schema.
I personally don't understand very well the diagram for the accepted answer, So I'm going to attach a database diagram base on what I could learn from the accepted answer and other pages.
Improvements are well received.