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 / Power Apps / content Get field name...
Power Apps
Unanswered

content Get field names and items

(0) ShareShare
ReportReport
Posted on by 29

Is there a way to get these two contents in the CLI?

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

    I encountered an error using this code?

  • Verified answer
    Rick Wilson Profile Picture
    160 on at

    This error is being generated due to TypeScript checking.  The Options property can be undefined so you need to account for that. Here are two possible options for you.

     

    This one uses option chaining and the logical operator to set a default value if the property for Options does not exist.

    var test: any[] = context.parameters.inputValue.attributes?.Options || [];

    The second one allows the variable to be undefined or an array.  You will need to make sure to check the variable to make sure it's not undefined before you use it though.

    var test: any[] | undefined= context.parameters.inputValue.attributes?.Options;
     
    I'm actually a little surprised you are not seeing the error before the build in Visual Studio Code. You may want to open your project one folder level higher so that the tsconfig.json file is seen by VS Code.
     
    --Rick

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 > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard