Skip to main content

Search

Query Field Person or Group

Comments

8 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 Geier

    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 Geier,

    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 Geier

    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 Geier

    Hi Matthias Walter

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

     

    Kind regards

    Nicole

    0
  • Nicole Geier

    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 Geier

    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

Please sign in to leave a comment.