web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Copilot Studio / How to add DisplayName...
Copilot Studio
Answered

How to add DisplayName to a JSONResponse to display choices

(0) ShareShare
ReportReport
Posted on by 6

Hello,

 

In a custom plugin i'm calling an API to retrieve a list of items, and i would like those items to be displayed as choices for the user in a DynamicClosedListEntity.

 

The items are in a table type variable, and i know that to be displayed as choices, each item must have a DisplayName property.

 

So i want to add this property for each item and to set its value to a concatenation of some of its properties.

 

I suppose the best way to achieve this is to rebuild a new variable in a SetVariable block, but i'm struggling in vain with FX functions. 

 

Is there anyone to help me?

 

Thank you

 

 

 

 

 

I have the same question (0)
  • HenryJammes Profile Picture
    on at

    Yes, I think so. Although I don't know if there's a better way to rename a table property in Power Fx?

  • MiguelMeloOP Profile Picture
    6 on at

    The JSON comes from this mocked API and it looks like this:

    [
     {
     "id": 1,
     "name": "Pizza Heaven",
     "address1": "Kungsgatan 1",
     "address2": "111 43 Stockholm",
     "latitude": 59.336078,
     "longitude": 18.071807
     },
     {
     "id": 2,
     "name": "Pizzeria Apan",
     "address1": "Långholmsgatan 34",
     "address2": "117 33 Stockholm",
     "latitude": 59.315709,
     "longitude": 18.033507
     }
    ]

     

    So does it mean that i have to manually re-assign each known property?

  • Verified answer
    HenryJammes Profile Picture
    on at

    Hi @MiguelMeloOP 

     

    What does your JSON look like?

    In the set variable node, using Power Fx, you could use a variation of this formula:

     

    ForAll(
     Topic.MyTable,
     {
     DisplayName: name,
     OtherProperty: property,
     ID: id
     }
    )

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Copilot Studio

#1
Valantis Profile Picture

Valantis 414

#2
chiaraalina Profile Picture

chiaraalina 130

#3
S-Venkadesh Profile Picture

S-Venkadesh 84 Moderator

Last 30 days Overall leaderboard