Update triggers

2877
3
Jump to solution
05-06-2012 03:08 PM
FraserHand
Occasional Contributor III
Hi Guys,

Has anyone done / seen / know if there is an update trigger mechanism in JTX? Basically I want some code to run to update an extended property for a given job when it is assigned.
There is a chocolate fish in it for any answers supplied!

Thanks,
Fraser

EDIT:

I've looked at the history table as when a job is assigned is stored here - but I haven't figured out how I could link this to a specific event. Basically I want to say the job was assigned to me for site visit on date. I would have another step that says, I started my site visit on x date. Then I could query the difference between when the job was assigned for a specific task in the workflow to when that task was started. The problem as I see it with the history table is that you can't seem to associate one event with another. I need to be able to have a step that enables me to select who I what to assign the job to, and store a date with the specific phase of the job. I'm thinking another custom step. Anyone got any ideas?
F
0 Kudos
1 Solution

Accepted Solutions
TopeBello
Occasional Contributor III
The history comments/messages are configurable. For example, you can change the message that is displayed when a user assigns a job to read something different from what is default. These activities are tied to already existing events inside of Workflow Manager.

If you would like to have your own event triggered when certain things happen, you will have to write code (command/tool/custom step) that will trigger a certain activity type. Once you have created the step, you will create a new activity type inside of WMX administrator that will be triggered every time that  step is executed.


Thanks,
Tope

View solution in original post

0 Kudos
3 Replies
TopeBello
Occasional Contributor III
The history comments/messages are configurable. For example, you can change the message that is displayed when a user assigns a job to read something different from what is default. These activities are tied to already existing events inside of Workflow Manager.

If you would like to have your own event triggered when certain things happen, you will have to write code (command/tool/custom step) that will trigger a certain activity type. Once you have created the step, you will create a new activity type inside of WMX administrator that will be triggered every time that  step is executed.


Thanks,
Tope
0 Kudos
FraserHand
Occasional Contributor III
Thanks Tope,
Have you got any samples of this?
Thanks,
F

EDIT: I've been thinking a bit more about this, and was starting to think I needed to reassign a job from a picklist and stamp custom props at the same time - problematic when deploying to the web. But, when thinking a bit more about what Tope has said, I think I can actually maintain it through the AssignJob notification with the message "Job assigned to [CUR_USER] by [FULLNAMEOF([CUR_NT_USER])] on [SYS:CUR_DATE] for [JOB:STATUS_NAME]" thus moving this info from related properties into the default history table, and maintaining it through a whole heap of job status codes. And instead of having a custom step to stamp properties and reassign, I can just have a informational note in the workflow saying - reassign job now.
Thanks for getting the noodle started. The fish is in the post.




[ATTACH=CONFIG]14508[/ATTACH]
0 Kudos
RaghavendraSunku
New Contributor III
Hi Fraser,

There is a way to 'plug-in code' into Workflow Manager when various events happen. Its a bit tricky but not too complicated. It involves Workflow Manager Notifications. For each Job Activity that Workflow Manager records (as Job History), there is a corresponding Job Notification that Workflow Manager also fires. For example, assigning a Job to someone causes Workflow Manager to add a Job History/Activity record, plus we fire a corresponding Job Notification IF there are subscribers to that notification.

What you need to do is to implement your own Workflow Manager compatible notification engine. Implement some of our interfaces (IJTXNotifier, IJTXMailNotifier), register your code/class as COM, and 'register' your class with Workflow Manager as the default notifier. Once that is done, Workflow Manager invokes the IJTXNotifier.Send method on your class with an IJTXNotification object each time a corresponding event happens. The IJTXNotification object has a Type property that tells you the event was (JobAssigned, JobClosed, et cetera). Here comes the ugly part: Besides the event Type, your code would also need to know the Job that this event is happening on. The only way to know that is to include the [JOB:ID] token into the notification subject/body and then parse the subject/body that Workflow Managers sends to your custom notifier.

If your custom plugged-in code needs to do something business-specific plus send out an email, you can make use of our out-of-the-box notifier. Just invoke our notifier at the end after whatever custom stuff you needed to do.

Does this help?

Thanks,
Raghu
0 Kudos