none
Is there an easy way to get the value of [//Request/RequestParameter/<value>]? RRS feed

  • Question

  • Hi,

    I need a request value from an attribute named 'NewPassword' in PowerShell activity. Since it's a new request the value is not in the [//Target].

    First I passed the value [//Request/RequestParameter/NewPassword] to 'ResetPassword' variabel of the script but it was empty.

    Then I passed [//Request/RequestParameter] to 'RequestParameter'. then I have to use two lines to get the value. The first line to get the line containing the desired value because there can be several request parameters in one request. Oh yes and to convert the input to XML. Otherwise it doesn't work. The second line to get the text 

    #1. [xml]$rp = $RequestParameter | Select-String -SimpleMatch "NewPassword"
    #2. $pwd = $rp.RequestParameter.Value.'#text'

    So, is there an easier way to do it?


    GH


    • Edited by Guy Horn Wednesday, June 15, 2016 7:14 AM
    Wednesday, June 15, 2016 7:13 AM

Answers

  • You are misreading the wiki. [//Request/RequestParameter] is not a reference value that you can dereference. As you have found out it's a multi-value attribute with each value being an xml string. You can view the value in the Portal Admin view for a request (by downloading the attribute value). Irrespective of that, the wiki specifically mentions "To access the attributes populated / modified on the Target of the request, use  [//Request/RequestParameter]  in conjunction with  Parameter*  functions." which is what I summarized in my first reply. I'm still not clear how it leads to the impression that "//Request is replaced by //Request/RequestParameter"
    • Marked as answer by Guy Horn Tuesday, December 27, 2016 10:04 AM
    Wednesday, June 29, 2016 8:39 AM
    Owner

All replies

  • Have you looked at the GitHub wiki for [//Request] lookup which will redirect you to WAL Parameter* functions? e.g. ParameterValue
    Wednesday, June 15, 2016 9:59 AM
    Owner
  • In the docu is stated that //Request is replaced by //Request/RequestParameter

    GH

    Tuesday, June 21, 2016 10:03 AM
  • Where are you reading this? there is no such statement there. But I can see the wiki mentions all that I put in in my last reply.
    Tuesday, June 21, 2016 10:14 AM
    Owner
  • Here: https://github.com/Microsoft/MIMWAL/wiki/Lookups#remarks-5

    Request

    Description

    The  Request  lookup is used to access the attributes of the current request.

    Remarks

    The WAL extends the  Request  lookup by supporting any attribute on the current request, not just the  CreatedDate . The deep resolution against the multi-valued references is also supported. To access the attributes populated / modified on the Target of the request, use  [//Request/RequestParameter]  in conjunction with  Parameter*  functions.

    Examples
    • [//Request]
    • [//Request/CreatedDate]
    • [//Request/Creator/DisplayName]
    • [//Request/Creator/Manager/DisplayName]
    • [//Request/RequestParameter]


    • Edited by Guy Horn Friday, June 24, 2016 2:38 PM
    • Marked as answer by Guy Horn Tuesday, December 27, 2016 10:04 AM
    • Unmarked as answer by Guy Horn Tuesday, December 27, 2016 10:04 AM
    Friday, June 24, 2016 2:37 PM
  • You are misreading the wiki. [//Request/RequestParameter] is not a reference value that you can dereference. As you have found out it's a multi-value attribute with each value being an xml string. You can view the value in the Portal Admin view for a request (by downloading the attribute value). Irrespective of that, the wiki specifically mentions "To access the attributes populated / modified on the Target of the request, use  [//Request/RequestParameter]  in conjunction with  Parameter*  functions." which is what I summarized in my first reply. I'm still not clear how it leads to the impression that "//Request is replaced by //Request/RequestParameter"
    • Marked as answer by Guy Horn Tuesday, December 27, 2016 10:04 AM
    Wednesday, June 29, 2016 8:39 AM
    Owner