Een van die opkomende patrone Ek vind in die knutselen SharePoint oplossings maak gebruik van SharePoint Designer workflow en 'n gebeurtenis ontvanger.
Hier is 'n besigheid scenario om dit in konteks te plaas:
- Ek laai 'n dokument aan 'n doc lib.
- Ek skop af multi-stap workflow wat geskep is met behulp van SharePoint Designer.
- Op 'n stadium tydens die proses, Die workflow ken 'n taak aan iemand (deur middel van data in te samel van die gebruiker of 'n taak te ken).
- 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.
- Hier is die skopper: Ek wil die datum wat dryf dat KPI vakansie-bewus te wees.
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. Egter, 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".
- Inisialiseer aan die valse.
- Op die regte tyd in die workflow (bijv. just before the "collect data" aksie), wys dat die waarde aan True.
- 'N ItemUpdate() event receiver looks to see if "DoCalculateDueDate" is true. Since the event receiver runs on every update, "DoCalculateDueDate" is gewoonlik vals.
- Wanneer workflow ken DoCalculateDueDate na ware, die geval ontvanger bereken die vakansie-bewus vervaldatum.
- Wanneer die geval ontvanger hierdie berekening, dit stel die DoCalculateDueDate vlag op 'n bedrieglike.
Op die ou end, 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.
</einde>