0

My HTML table which I created in a workflow in Flow.microsoft.com is working perfectly fine but when I enter the choice items it outputs a code in the file. for example for: - coloumn: Change Outcome

choices: Success Open Cancelled Rescheduled Issue Chosen value: Open

The output instead of a single chosen value it gives like this: {"@odata.type":"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference","Id":1,"Value":"Open"}

But for the normal column fields the output is normal. Does anyone know how to fix it?

6
  • 1
    Are your columns set to "Automatic", or "Custom"?
    – willman
    Feb 27, 2020 at 12:09
  • 1
    It you are already using "Custom" column definitions, you should be able to reference item()["Change Outcome"]["Value"] instead of referencing item()["Change Outcome"]. If you are trying to stick with Automatic columns, that will be a bit trickier.
    – willman
    Feb 27, 2020 at 12:15
  • I am using custom columns, Willman. However exactly with your method it says "The expression is invalid".
    – Noman
    Feb 27, 2020 at 13:00
  • 2
    Sorry, my fault, need to use single quotes: item()['Change Outcome']['Value']
    – willman
    Feb 27, 2020 at 13:01
  • Hi Willman, It worked perfectly this time. Thank you very much man.
    – Noman
    Feb 27, 2020 at 13:05

1 Answer 1

1

Recapping our discussion: If you are using the Advanced -> Column Options -> Custom, your can set the expression for that item to point to the Value in the JSON sub-object rather than directly at the column object. For a choice column named Change Outcome, that expression would look like:

item()['Change Outcome']['Value']

User fields are a similar case of having a subject with multiple values, but the properties are different. A User field from SharePoint will look like this in your results:

"User1": {
    "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
    "Claims": "i:0#.f|membership|[email protected]",
    "DisplayName": "Somebody Whologgedin",
    "Email": "[email protected]",
    "Picture": "https://mytenant.sharepoint.com/sites/mytestsite/_layouts/15/UserPhoto.aspx?Size=L&[email protected]",
    "Department": "Human Resources",
    "JobTitle": "Learning and Development Specialist"
  }

So, if you wanted to just show the user's email in your table, you would reference:

item()['MyUserField']['Email']
13
  • 1
    I added info about User columns to the answer. Note, once your workflow has run at least once, you can always go into the history instance and review the body output of most actions to figure out what the JSON structure of its data is. It is a shame this is documented better, but at least the run history gives us a way to figure it out.
    – willman
    Feb 27, 2020 at 14:38
  • 1
    I assume you are getting values from a filtered array or a Get Items action -- in the flow run history, take a look at the output body from that action to confirm that the JSON has the Change_x0020_Originator, it may not be named in the JSON what you think it is.
    – willman
    Feb 27, 2020 at 15:27
  • 1
    that JSON looks good for what your are trying to do. This may just be a cut /paste mistake, but your error message appear to have an extra space 'Change_x0020_Originator ' -- if you accidentally included an extra space inside the single quote after the word Originator, that would cause it to fail.
    – willman
    Feb 27, 2020 at 15:34
  • 1
    Yes, this still looks like you should be able to successfully get the value in your table with item()['Change_x0020_Originator']['DisplayName']. As mentioned in the previous comment, double check your column expression to make sure you didn't accidentally put an extra space in there.
    – willman
    Feb 27, 2020 at 15:48
  • 1
    I think we need more eyes on this, I would say post a new question specific to this column problem. Post the JSON that you included in the comments here, the expression you are using and the full error message (the comment is cutting off the rest of the "available properties are ...", but you could include the whole thing in a question post).
    – willman
    Feb 27, 2020 at 16:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.