Skip to content

Place an order

This article describes how to fill out the order form and placing an order using ZervicePoint PowerShell Management.

  1. Set the ZervicePoint Powershell environment variables

    (ZPAPIURL, ZPAPIADFSHOST and ZPAPIAUDIENCEURI) if not already set

    $env:ZPAPIURL = "https://zervicepoint.dev.local:30000/Store"
    $env:ZPAPIADFSHOST = "authx.dev.zipper.se"
    $env:ZPAPIAUDIENCEURI = "https://zervicepoint.dev.local/"
    
  2. Import the ZervicePoint Powershell module

    Import-Module "C:\Program Files\Zipper\ZervicePoint\PowerShell\ZervicePoint.WebApi.PowerShell"
    
  3. Acquire a security token from your ADFS server

    Not required if you are using an API Key

    Get-ZPSecurityToken | Set-ZPSecurityToken
    
  4. Get a reference to the service you want to order

    $services = Get-ZPService
    $multiFieldService = $services | Where Name -eq "MultiFieldService"
    $dynamicDropdownService = $services | Where Name -eq "DynamicDropdownService"
    $serviceSelectorService = $services | Where Name -eq "ServiceSelectorService"
    $selectedService1 = $services | Where Name -eq "SelectedService1"
    $selectedService2 = $services | Where Name -eq "SelectedService2"
    

Check out the latest examples for New-ZPOrder

Get-Help New-ZPOrder -Examples

Multi field service

Fill out the order form for a service with a text field, a check box and a restricted multi-select dropdown and place the order

New-ZPOrder -ServiceUniqueId $multiFieldService.UniqueId -FieldValue @{
    TextField1="Value1";
    Checkbox1=$true;
    DropDown1="Value1;Value2"
}

Dynamic drop down service

Get the id and text for the dynamic dropdown from an existing order

Get-ZPOrder -ServiceName "DynamicDropdownService").Parameters | Format-List

Fill out the order form for a service with a dynamic dropdown for the Dropdown.ADUser data source and place the order

New-ZPOrder -ServiceUniqueId $dynamicDropdownService.UniqueId -FieldValue @{
    OwnerField=@{id="13afff80-97a3-408f-a8f7-6078dc967e16"; text="John Smith (johsmi)"}
}

Make sure you provide both id and text to the field value, otherwise you will get an error

Service selector service

Fill out the order form for a service with a service selector, add two services to it and place the order

New-ZPOrder -ServiceUniqueId $serviceSelectorService.UniqueId -FieldValue @{
    ServiceSelectorField=@(
        @{id=$selectedService1.id; text=$selectedService1.displayName["en-US"]},
        @{id=$selectedService2.id; text=$selectedService2.displayName["en-US"]}
    )
}

Make sure you provide both id and text to the field value, otherwise the id will be shown for the user in the order details view