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 / Possible bug in compil...
Power Apps
Unanswered

Possible bug in compiler: Powerapps compiler confusing record with untyped object in UDF

(0) ShareShare
ReportReport
Posted on by 2

I have the following code:

data: Self.ConvertRecordToFields(rec, patientData, Split(rec.Status, ","))

Self.ConvertRecordToFields is a UDF in a component and defined as (Record, Record, Table({Value:""})

 

Error code for argument 1: Invalid argument type (Record). Expecting an UntypedObject value instead.

Error code for argument 2: Invalid argument type (Record). Expecting an UntypedObject value instead. 

 

The function converts all the fields in Argument 1 and Argument 2 to a Table of values with type erasure. The compiler error is not in the function but at the call site of the function. 

 

I am sending the correct record types to the function. The code worked yesterday without issue. I believe there is a compiler error. 

Thanks

 

 

 

Categories:
I have the same question (0)
  • D_McCann1 Profile Picture
    28 on at

    Same issue, did you get it fixed?

  • Fearless404 Profile Picture
    2 on at

    I spoke to tech support but in the end solved it myself: 

      The error is caused by an uninitialized value being used as a type. 

     A simple very reproducible example:

      In your component you have a function defined as: Foo(arg as Record) returns a Boolean

      arg is defined as: First(SomeTableValue) 

      In the above definition the PowerApps editor and compiler never runs the function First as it is never used anywhere in the code. Hopefully it will be fixed in the future but the workaround is straight forward.

      The fix is to replace the definition of arg to a manually defined record that matches your table structure. 

       arg: {Field1: "", Field2: 5, Field3: Date(1,1,2023)}

      Then the compiler now knows it is a typed value of some sort. 

       If you have a crazy complicated table (like you get from sharepoint with all the extra fields) then make sure you only define the fields that you plan on accessing. It is ok to send a record with more fields than you use. It will not trigger a compiler error. It may give you a warning flag but ok to ignore.  

     

     

     

     

     

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 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard