Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / The first parameter of...
Finance forum
Answered

The first parameter of AifCollectionTypeAttribute must match either a parameter of the method it is defined on or "return".

Posted on by 237

Hi

I see this BP warning and have no idea what this one is about. Here is the warning below

"The first parameter of AifCollectionTypeAttribute must match either a parameter of the method it is defined on or "return".

[DataMember, AifCollectionType("customValues",Types::Class,classStr(cgiKeyValue))]
public List customValues(List __customValues = _customValues)
{
    _customValues = __customValues; return _customValues;
}

Any ideas are appreciated

Thanks

  • srikanthkonda Profile Picture
    srikanthkonda 237 on at
    RE: The first parameter of AifCollectionTypeAttribute must match either a parameter of the method it is defined on or "return".

    Brilliant answer. Thanks Martin

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 225,549 Super User on at
    RE: The first parameter of AifCollectionTypeAttribute must match either a parameter of the method it is defined on or "return".

    The value in your attribute assumes that the parameter is called customValues, but the actual name is __customValues.

    Note that names of both variables are wrong - the parameter should be prefixed with a single underscore, not two, and the member variable shouldn't be prefixed with any underscore at all (because that's used for parameters). Let me also add an extra attribute describing the type of the return value.

    [
    	DataMember,
    	AifCollectionType('_customValues', Types::Class, classStr(cgiKeyValue)),
    	AifCollectionType('return', Types::Class, classStr(cgiKeyValue))
    ]
    public List customValues(List _customValues = customValues)
    {
        customValues = _customValues;
    	return customValues;
    }

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,914 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,549 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans