New in this release is also an awesome feature called Shared lists. With this feature we want to solve a challenge that frequently pop up when building solutions in Zervicepoint, and that is how to store organizational data and build solutions around this. With the new cmdLets in Zervicepoint PowerShell Management and the new workflow activities, we are shipping with this version, we are hoping to make these types of solutions easier to build.
New CmdLets in Zervicepoint PowerShell Management
- Get-ZPList
- New-ZPList
- Remove-ZPList
- Set-ZPList
- New-ZPListColumn
- New-ZPListItem
- Remove-ZPListItem
- Set-ZPListItem
New workflow Activities
- Add shared list item
- Update shared list item
A great example
In this example we will build a solution for bulk orders per retailer to avoid additional shipping costs. This is a basic example, in a real life scenario you would probably extend the solution so that separate orders wait for bulk order to be sent before they are completed. This can be achieved by adding tasks to the services that are updated by the bulk order scheduled task.
Step 1 – Create a shared list via Zervicepoint PowerShell Management
New-ZPList
New-ZPList -Name "myOrders" -Column @((New-ZPListColumn -Name "Product" -ColumnType string); (New-ZPListColumn -Name "Retailer" -ColumnType String); (New-ZPListColumn -Name "Date" -ColumnType DateTime); (New-ZPListColumn -Name "Status" -ColumnType String))
Step 2 – Create a shared process
Create a shared process which will add the ordered service to the shared list we created above. For this we use the new Add-ListItem activity. The status column is set to “processing”. Below picture shows the workflow.
Product and Retailer will be configurable in the setup form when creating the actual service.
Step 3 – Create services for bulk order
Now you can create services based on this new shared process that will, upon order, add items to the shared list. Specify Product and Retailer in the setup form for example “Computer” and “Retailer AB”.
We also create a new service “BulkOrder” that will be used for sending the actual order to the retailer. This service contains two text fields that we later will populate with order data and email to the correct retailer and a mail activity that will send the order to the retailer.
Step 4 – Create a schedule task the sends bulk order to “Retailer AB”
The schedule task runs a script which collects all items in the shared list myOrders which has status, “Processing” and retailer, “Retailer AB” and sets the items status to ordered. Next we trigger an order of the service “BulkOrder” and populate it with order data.
Schedule Task
$listItems = Get-ZPList -Name "myOrders" | Get-ZPListItem | Where-Object {($_.Data["Status"] -eq "Processing") -and ($_.Data["Retailer"] -eq "Retailer AB")} $orders = $listItems | ForEach-Object { $_.Data["Product"]; $_.Data["Status"] = "Ordered"; $_ | Set-ZPListItem } New-ZPOrder -ServiceUniqueId 02ba1493-9e4f-4267-80