Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Power Apps Pro Dev & ISV
Answered

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?

  • Verified answer
    Rick Wilson Profile Picture
    160 on at
    Re: content Get field names and items

    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
  • Nttdocomo Profile Picture
    29 on at
    Re: content Get field names and items

    I encountered an error using this code?

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Power Apps Pro Dev & ISV

#1
WarrenBelz Profile Picture

WarrenBelz 85 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 59 Super User 2025 Season 1

#3
mmbr1606 Profile Picture

mmbr1606 55 Super User 2025 Season 1

Overall leaderboard