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, ...
Suggested answer

The type 'Record' is not supported as a return value

(1) ShareShare
ReportReport
Posted on by 230
Hi Team,
 
I have created new SSRS report, initial report is working fine.
 
I have created contract class and set return type is tmp table.
 
I am using DP, Contract and Controller class
 
Now, while run the report getting below error.
The type 'Record' is not supported as a return value.
 
Please let  me know how to solve this.
I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    236,503 Most Valuable Professional on at
    The type 'Record' is not supported as a return value
    The short answer is "don't use a table".
     
    The longer answer is: how to solve it depends on what you're trying to achieve. If you inserted several records to a temporary buffer and you want to somehow pass the reference, it can't work. The report may run on a different machine, weeks later and so on, so you can't refer to any temporary buffer, because it doesn't have to exist anymore.
     
    If you want a single set of fields, add them to your TestReportContract class directly. If you need a collection of such records, create a new data contract for those values and add a List of those contracts as a data member of TestReportContract.
  • CU21091228-0 Profile Picture
    230 on at
    The type 'Record' is not supported as a return value
    Hi Martin.
     
    I need  a collection of such records
    I am sharing some sample code please let me know if i am wrong.
    New TestDataContract class with three different fields.
    [DataContractAttribute]
    class TestDataContract
    {
        Field1 field1;
        Field2 field2;
        Field3 field3;
    
        [DataMemberAttribute('Field1')]
        public Field1 parmField1(Field1 _field1 = field1)
        {
            field1 = _field1;
            return field1;
        }
    
        [DataMemberAttribute('Field2')]
        public Field2 parmField2(Field2 _field2 = field2)
        {
            field2 = _field2;
            return field2;
        }
    
        [DataMemberAttribute('Field3')]
        public Field3 parmField2(Field3 _field3 = field3)
        {
            field3 = _field3;
            return field3;
        }
    
    }
    Created list for all three fields.
     
    [DataContractAttribute]
    class TestReportContract
    {    
       List field1, field2, field3;   
     
      [DataMemberAttribute('Field1'),
      AifCollectionTypeAttribute('return', Types::String)]    
      public List parmListField1(List _field1 = field1)    
      {        
          field1 = _field1;    
          return field1;   
      }
    
      [DataMemberAttribute('Field2'),
      AifCollectionTypeAttribute('return', Types::Int)]    
      public List parmListField2(List _field2 = field2)    
      {        
          field2 = _field2;    
          return field2;   
      }
    
      [DataMemberAttribute('Field3'),
      AifCollectionTypeAttribute('return', Types::String)]    
      public List parmListField3(List _field3 = field3)    
      {        
          field3 = _field3;    
          return field3;   
      }
    }
     
  • Suggested answer
    GirishS Profile Picture
    27,825 Moderator on at
    The type 'Record' is not supported as a return value
    Hi,
     
    You cannot use the table as return type for the SSRS report contract class - You can only use data types.
    You need to rethink your design - I would suggest you to use List type for your scenario.
     
    Thanks,
    Girish S.
  • Suggested answer
    Martin Dráb Profile Picture
    236,503 Most Valuable Professional on at
    The type 'Record' is not supported as a return value
    You never use your new class (TestDataContract), so it's the same as if you never created it.
     
    While creating a separate list for each field is technically possible, using such a solution is not particular easy. Using a list of objects (where each objects holds related values) it's much more natural. Let me give you an example, I'll just use more descriptive names to make it all easier to understand:
    [DataContract]
    class MainContract
    {
        List items;
        
        [
            DataMember,
            AifCollectionType('_items', classStr(ItemContract)),
            AifCollectionType('return', classStr(ItemContract))
        ]
        List parmItems(List _items = items)
        {
            items = _items;
            return items;
        }
    }
    
    
    [DataContract]
    class ItemContract
    {
        str field1;
        int field2;
        str field3;
    
        [DataMember('Field1')]
        public str parmField1(str _field1 = field1)
        {
            field1 = _field1;
            return field1;
        }
    
        [DataMember('Field2')]
        public int parmField2(int _field2 = field2)
        {
            field2 = _field2;
            return field2;
        }
    
        [DataMember('Field3')]
        public str parmField2(str _field3 = field3)
        {
            field3 = _field3;
            return field3;
        }
    }
     
  • WV-08081158-0 Profile Picture
    7 on at
    The type 'Record' is not supported as a return value
    Hi Martin,
     
    I was trying to create a data contract and have a list of classes attached to it.
     
    This is my SSRS report data contract:
     
    My Data contract containing the fields (which will be in the list):
     
    But when trying to execute, it returns me this error message: 
    Report parameters does not support collection of user defined class objects
     
    Coming from over here:
     
    So it looks like you cannot have a collection (like a List) of Classes as parameter for a Report data contract.

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 1,882

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 525 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans