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

Announcements

News and Announcements icon
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)
  • André Arnaud de Calavon Profile Picture
    306,887 Super User 2026 Season 2 on at
    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));
     
  • YQ-12070237-0 Profile Picture
    57 on at
    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
    306,887 Super User 2026 Season 2 on at
    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
    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.
  • Anton Venter Profile Picture
    21,173 Super User 2026 Season 2 on at
    Hello,
     
    The field IDs of the array fields work a little different. You have to use the extended field ID methods, see link below.
     
  • André Arnaud de Calavon Profile Picture
    306,887 Super User 2026 Season 2 on at
    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.
  • YQ-12070237-0 Profile Picture
    57 on at
    Hi Andre, Anton
     
    I have implement it with several fields instead of using array field.
     
    Thanks both of you anyway.
     
    Bernard
     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

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

#1
Martin Dráb Profile Picture

Martin Dráb 341 Most Valuable Professional

#2
CU10121822-0 Profile Picture

CU10121822-0 312

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 262 Super User 2026 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans