Jedan od obrazaca u nastajanju mogu naći u crafting SharePoint rješenja utjecati SharePoint Designer tijek rada i događaj prijemnik.
Ovdje je poslovni scenarij da ga staviti u kontekst:
- Ću uploadati dokument na doc lib.
- Sam kick off multi-korak workflow izrađena pomoću SharePoint Designer.
- U nekom trenutku tijekom tog procesa, tijek rada dodjeljuje zadatak da netko (putem prikupljanja podataka iz korisnika ili dodijeliti zadatak).
- We want to use a KPI to track how long that task is awaiting completion. The KPI shows green for tasks that are completed or due more than 3 days from now. It shows yellow if the task is due tomorrow or today. It shows red if the task is past due.
- Evo buntovnik: Želim datum koji vozi da KPI biti svjesni odmor.
I can’t calculate a holiday-aware due date in SharePoint Designer workflow very easily. I would have to create a custom action or use a 3rd party tool. Međutim, it’s easy enough to calculate such a date in an event receiver. Merge those two together and we get a pattern like this:
- Define a hidden yes/no site column on the document library labeled "DoCalcualteDueDate".
- Ga inicijalizirati na False.
- Na određeno vrijeme u tijeku rada (e.g. just before the "collect data" akcija), dodijeliti tu vrijednost na True.
- ItemUpdate() event receiver looks to see if "DoCalculateDueDate" is true. Since the event receiver runs on every update, "DoCalculateDueDate" obično je lažna.
- Kada tijek rada dodjeljuje DoCalculateDueDate na true, Događaj prijemnik izračunava odmor-Aware rok.
- Kada se ovaj događaj prijemnik izračun, se postavlja DoCalculateDueDate zastavom netočno.
Na kraju, SPD workflow is communicated with an event receiver via the DoCalculateDueDate semaphore and we have holiday-aware due dates that are assigned at the exactly correct moment in the workflow’s life. SharePoint Designer controls when the due date is assigned but the event receiver performs the actual calculation and assignment.
</kraj>