To deal with the requirements outlined in the June Mission: Service Request I created four lists as follows:
- RequestTypes - used to hold the types of requests (currently five, but could grow):
- RequestTypeSteps - used to hold the steps required for each type of request. This list had a lookup column to the RequestTypes list above:
- Requests - used to make the request and choose the request type. It also holds information about the number of outstanding tasks and the overall status of the request (i.e. Outstanding tasks or Completed):
- RequestTasks - used to hold the tasks (or steps) required for each specific request decided by the RequestType selected. This was a task list with an additional field called RequestID used to keep a log of which tasks were assigned to which request.
I created three workflows as follows:
- Create tasks for request type steps - this workflow was on the Requests list and started on item creation. It queried the RequestTypeSteps list for all items where the RequestType was that of the current item. For each step returned I created a task with the current ID in the RequestTasks list.
- Update NoSteps on Request - this workflow was on the RequestTasks list and started automatically when an item was modified where the task status had changed. It queried the RequestTasks list where RequestID was the same as the current item and Task Status <> Completed. I then counted the returned collection to find the number of outstanding tasks associated with the RequestID. The workflow then updates NoTasks for the RequestID in the Requests list.
- Set Request Completed - this workflow was on the Requests list and started automatically when an item was modified where NoTasks = 0 where it had previously not been 0. This updated the Request status to Completed.
Very cool mission Brendan Murphy - I really enjoyed it. Now I will go and read how everyone else achieved it - I didn't want to get distracted with other people's solutions before I had found my own.