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

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Error "Wrong type of argument for conversion function" occured with array field

(1) ShareShare
ReportReport
Posted on by 57
Hi experts,
 
I want to use array field (extends from HcmWorkerRecId), but error is found when form datasource appending new record.
 
The followings are the steps:
1. Create a EDT A (Extends = HcmWorkerRecId, Reference Table = HcmWorker, new table refereneces and 4 array elements are added)
2. Drag this EDT to table
3. Table is set as form datasource, and drag related field to grid, 4 reference group controls are added.
 
While new record is appended, error is found when code Class\FormDataUtil\getRefRecIdFieldValue executing.
 
Can anyone tell me how to resolve this problem?
Thanks in advance.
 
Bernard
I have the same question (0)
  • YQ-12070237-0 Profile Picture
    57 on at
    Error "Wrong type of argument for conversion function" occured with array field
    Hi Andre, Anton
     
    I have implement it with several fields instead of using array field.
     
    Thanks both of you anyway.
     
    Bernard
     
  • André Arnaud de Calavon Profile Picture
    298,959 Super User 2025 Season 2 on at
    Error "Wrong type of argument for conversion function" occured with array field
    Hi Bernard,
     
    Anton explained that the field IDs of array fields are implemented differently. I guess the reference fields with array-type fields are not supported in the standard coding. If the 4 distinct fields are working, I guess this should be your solution.
  • Anton Venter Profile Picture
    20,289 Super User 2025 Season 2 on at
    Error "Wrong type of argument for conversion function" occured with array field
    Hello,
     
    The field IDs of the array fields work a little different. You have to use the extended field ID methods, see link below.
     
  • YQ-12070237-0 Profile Picture
    57 on at
    Error "Wrong type of argument for conversion function" occured with array field
    Hi Andre,
     
    The parameter _fieldId is 1, and it is the array field number. If I remove it, and add 4 fields instead, it woks fine.
  • André Arnaud de Calavon Profile Picture
    298,959 Super User 2025 Season 2 on at
    Error "Wrong type of argument for conversion function" occured with array field
    Hi Bernard,

    Apologies, I misread your question and thought you shared custom coding. If you are using the debugger, doe the parameter _fieldId have a value? 
    Do you get the same error in case you are not using the arrays on this field, but one or e.g. 4 distinct fields?
  • YQ-12070237-0 Profile Picture
    57 on at
    Error "Wrong type of argument for conversion function" occured with array field
    Thank you Andre for your reply. However, the method getRefIdFieldValue is the code of module plateform. I know I can extend it in my module, but does it mean that this is a bug for basic code?
  • André Arnaud de Calavon Profile Picture
    298,959 Super User 2025 Season 2 on at
    Error "Wrong type of argument for conversion function" occured with array field
    Hi,
     
    When you are using the Common object, the outcome of the field value is an anytype instead of an integer64.  You can change your coding in the following way to have the proper conversion:
     
    RefRecId refId = any2Int64(_record.(_fieldId));
     

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,239

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 903 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 604 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans