Public/New-SurveyResponses.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<#
    .SYNOPSIS
    Creates an survey responses object.

    .DESCRIPTION
    Creates the survey portion of the JSON message in hashtable form to send to the eCC Salesforce API to accept measurements and surveys.

    .INPUTS
    None. You cannot pipe objects to New-SurveyResponses.

    .OUTPUTS
    None.

    .PARAMETER SurveyQuestionId
    An survey question identifier.

    .PARAMETER AnswerIds
    A string array of answer ids for the question id specified
#>

function New-SurveyResponses {
    param([String]$SurveyQuestionId, [String[]]$AnswerIds)
    $aids = $AnswerIds | ForEach-Object { @{"Survey_Answer__c" = $_ } }
    @{
        "Survey_Question__c" = $SurveyQuestionId
        "Answers" = $aids
    }
}