Skip to main content

Search

Query Field Person or Group

Comments

9 comments

  • Matthias_Walter

    Hi Nicole,
    What you get is an object with an array of approvers.
    What exactly would you like to get? The email addresses of the approvers?
    Where do you use this function, on a button, in background actions, in list actions or on a field expression?
    Kind regards
    Matthias

    0
  • Nicole

    Hi Matthias-Walter,

    I use the expression in Skybow Modern Forms App --> field expressions--> calculated value

    Yes, this I know that I get an object with an array of approvers. But how can I extract the content of this array.

    Yes I want the email addresses of the approvers

    Thank you for your help

     

    Kind regards

    Nicole

    0
  • Matthias_Walter

    Hi Nicole,

    therefore you can get the email property out of the array of objects and join them like this:

    [[@Web.QueryList ("Catalog Approvers", "<Where><Eq><FieldRef Name='Title' /><Value Type='Text'>TestLocation</Value></Eq></Where>", "Approver")]].map(function(item){ return item.get_email(); }).join(", ")
     
    To figure out stuff like this, you could use the console.log() function in the code editor and if you hit the "Test" button having the browser developer tools (F12) open, you can see the result in the console. In some cases this is very helpful.
     
    Kind regards
    Matthias
    0
  • Nicole

    Hello Matthias-Walter

    thank for your help

    I got the error "Error occurred on evaluating expression. item.get_email is not a function"

    can you send me a screenshot, how you are doing this thing with the console.log(). I didn't get it.

     

    Kind regards

    Nicole

    0
  • Nicole

    Hi Matthias Walter

    I got it with the console.log, but the function still doesn't work for me 

     

    Kind regards

    Nicole

    0
  • Nicole

    Hi Matthias-Walter

    I still couldn't read out the object of the query  [[@Web.QueryList ("Catalog Approvers", "<Where><Eq><FieldRef Name='Title' /><Value Type='Text'>TestLocation</Value></Eq></Where>", "Approver")]]

    Kind regards

    Nicole

    0
  • Matthias_Walter

    Hi Nicole,

    do you have multiple items with one approver in the "Catalog Approvers" list or one item with multiple approvers in the person field? Maybe this was my misunderstanding.

    With the QueryList function you get multiple items otherwise you have to use our GetFirstValueForQuery function to get the approvers from one field.

    BR Matthias

    0
  • Nicole

    hi Matthias-Walter

     

    I have a person or group field with multiple approvers. Here my Query e.g. [[@Web.QueryList ("Catalog Approvers", "<Where><Eq><FieldRef Name='Title' /><Value Type='Text'>TestLocation</Value></Eq></Where>", "Approver")]] don't work I only get as result [Object object]

    Can you help me how I can retrieve the information out of this field?

     

    Kind regards

    Nicole

    0
  • Christof

    Hi Nicole

    Notice the parameters of the @Web.QueryList function: [[@Web.QueryList('ListName or relative Url', 'Caml query', MaxRowNumber, 'View Fields', 'Viewattributes')]]

    You're probably looking for the @Web.GetFirstValueForQuery function to get only one item's column value result:

    [[@Web.GetFirstValueForQuery('Catalog Approvers', '<Where><Eq><FieldRef Name="Title" /><Value Type="Text">TestLocation</Value></Eq></Where>', 'Approver')]].map(function (item) { return item.get_email(); }).join(", ")

    Sample result: "testemail1@skybow.com, testemail2@skybow.com, testemail3@skybow.com"

    0

Please sign in to leave a comment.