Drejt modelet SharePoint teknik të projektimit: SharePoint Designer Workflow + Marresit Event Koktej = High potencë

Një nga modelet e reja që unë të gjeni në përpilimin e zgjidhjeve thekson SharePoint SharePoint Designer punës dhe një marrës ngjarje.

Këtu është një skenar i biznesit për ta vënë atë në kontekstin e:

  • Unë ngarkoj një dokument me një lib doc.
  • Unë kick off multi-hap workflow krijuar duke përdorur SharePoint Designer.
  • Në një moment gjatë këtij procesi, workflow assigns a task to someone (via collect data from user or assign a task).
  • 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.
  • Here’s the kicker: I want the date that drives that KPI to be holiday-aware.

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. Megjithatë, 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".
  • Initialize it to false.
  • At the appropriate time in the workflow (e.g. just before the "collect data" veprim), assign that value to True.
  • An ItemUpdate() event receiver looks to see if "DoCalculateDueDate" is true. Since the event receiver runs on every update, "DoCalculateDueDate" is normally false.
  • When workflow assigns DoCalculateDueDate to true, the event receiver calculates the holiday-aware due date.
  • When the event receiver does this calculation, it sets the DoCalculateDueDate flag to false.

Në fund, 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.

</fund>

Abonohen në blogun tim.

Lini një Përgjigju

Adresa juaj e emailit nuk do të publikohet. Fusha e kërkuar janë shënuar *