Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Error executing code: Wrong argument type for function SysDataBaseLog\Methods\setDescription - line 8

(0) ShareShare
ReportReport
Posted on by 205

Hi,

In AX2009, i am getting following error while updating a record, please help.

 

Error executing code: Wrong argument type for function.

(S)\Data Dictionary\Tables\SysDataBaseLog\Methods\setDescription - line 8

(S)\Classes\Application\logUpdate - line 28

(S)\Classes\xRecord\update

 

The setDescription method of SysDataBaseLog table gets the TitleField1 and TitleField2 of the table being updated. My table has TitleField1 as RefRecId and TitleField2 is sysContainer type. I am updating the second field.

Regards,

Amiya

*This post is locked for comments

  • Suggested answer
    RE: Error executing code: Wrong argument type for function SysDataBaseLog\Methods\setDescription - line 8

    Dear Amiya, 

    My table causing the error  was 2899 (DimensionSetCombinationDuplicate), 

    I removed the database log from this table, 

    and I could delete the company account.  

    Best regards,

    sylvia

  • Re: Error executing code: Wrong argument type for function SysDataBaseLog\Methods\setDescription - line 8

    i don't think so but just check if database log is enable for this specific table in production.

  • Amiya Das Profile Picture
    Amiya Das 205 on at
    Re: Error executing code: Wrong argument type for function SysDataBaseLog\Methods\setDescription - line 8

    Thanks Vikas and Jonathan

    The code is provided by the product and no customization is made. Its working in production, but not in one of the test environment. In this environment CUS.aod was deleted by mistake and then synchornized. We restore the sql db and again put the cus.aod and sync. I suspect this might cause the issue.

  • Suggested answer
    Re: Error executing code: Wrong argument type for function SysDataBaseLog\Methods\setDescription - line 8

     

    The problem boils down to the strFmt() method not supporting containers as a parameter.  As Vikas suggested, changing the TitleField2 property to a non-container field should resolve the issue.  Alternatively you could attempt to add support for containers by modifying the field2Str() helper method:

     

      str field2Str(fieldId fieldId)
        {
    // fix -->
            if (DictTable.fieldObject(fieldId).type() == Types::Container)
                return strfmt('%1', con2str(common.(fieldId)));
            else
    // fix <--
            return strfmt('%1', common.(fieldId));
        }

     

    Hope this helps.  As always, test thoroughly before you use strange code for anything important.

     

  • Re: Error executing code: Wrong argument type for function SysDataBaseLog\Methods\setDescription - line 8

    Syscomtainer type field should not be a title field. Remove it and check.

    Additionally, this error is because of database log functionality on this table. Just check if u really need database logs on this transaction table for audit purpose.

  • Amiya Das Profile Picture
    Amiya Das 205 on at
    Re: Error executing code: Wrong argument type for function SysDataBaseLog\Methods\setDescription - line 8

    debugged the code

    its failing in dictTable.titleField2() condition while calling field2str. the second fieldid is not found in common. i have synchronized it but still getting same error. The table uses CustTables security key

    void setDescription(Common common)
    {
        DictTable dictTable = new DictTable(common.TableId);
        Description description;

        str field2Str(fieldId fieldId)
        {
            return strfmt('%1', common.(fieldId));
        }

        if (dictTable.titleField1())
        {
            description = field2Str(dictTable.titleField1());
        }

        if (dictTable.titleField2())
        {
            description += (description?',':'')+field2Str(dictTable.titleField2());
        }

        this.Description = description;
    }

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,407 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans