A Forum reader recently asked:
“I want to create a workorder that depends on some event or condition, and have this workorder be processed. I started with a loopback driver that creates the DirXML-WorkOrder object. So far, so good. Then I want the work order driver to pick up this object to do some work.
Where in the WorkOrder object can I define the task to be done? I have the nwoContent attribute but in my example this holds the DN of the object on which something should happen, but not the action. The other attributes like DoItNow or Due Date trigger the action. It might be possible to have the action in some policy of the workorder driver – is that the way to do it?
I thought the DirXML-WorkOrder object would be processed by the workorder driver, but the workorder driver obviously expects a DirXML-WorkToDo object. So do I have to make a transfer? I think one object class should be sufficient.”
And here’s the response from Perrin Blanchard …
Place the information you need to process the work in the DirXML-nwoContent attribute, together with DirXML-Other1 and DirXML-Other2. For example, I recently implemented a workorder to schedule setting Login Enabled at a particular time and I used the following:
DirXML-DueDate = <time workorder must be processed> DirXML-nwoStatus = 'pending' DirXML-nwoContext = 'enable-new-employee-account' DirXML-Other1 = <GUID of object to operate on> (I used GUID rather than a DN in case of moves and renames)
When the Workorder Driver processes the DirXML-WorkOrder object it sends commands to create a DirXML-WorkToDo object on its publisher channel. The workorder driver copies the values of DirXML-nwoContext, DirXML-Other1 and DirXML-Other2 from the workorder object to the
work-to-do-object, and sets DirXML-nwoDN to point to the DirXML-WorkOrder object that caused the DirXML-WorkToDo object to be created.
You can either perform the work needed on the workorder driver publisher channel, or allow the DirXML-WorkToDo object to be created and then do the work elsewhere.
In my example, I used a Null Driver to create the workorder objects, and the same Null Driver processes the work-to-do objects and deletes the original workorder objects.