Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

SSRS report custom code not recognized

(0) ShareShare
ReportReport
Posted on by 455

Hello Community

I wrote a simple function in the Code property of the ssrs report and trying to call it from one of the expressions on row Visibility property but it is giving me error when I build or deploy the report

<Function_Name> is invalid: InvalidIdentifier

I checked the syntax look for any typo but everything seems to be fine but still I am not able to get pass this error. Any Idea why It is doing this?

*This post is locked for comments

  • Verified answer
    Samy123 Profile Picture
    455 on at
    RE: SSRS report custom code not recognized

    Baber, I did what you suggested. Lets see if they again hit it or not. The problem is that its occasional the same field SSRS doesn't complain most of the time.

    Sohaib yes I followed this article. So are you saying that Microsoft doesn't support adding VB code to the code section anymore in SQL server 2012 ssrs ? then why its there in the first place?

    No Raj it dint work same error.

  • Suggested answer
    Kanagaraj A Profile Picture
    1,250 on at
    RE: SSRS report custom code not recognized

    Hi samy,

    " This is the expression on the row Hidden property"

    IIF(code.IsFieldMissing(Fields!BackOrder),True, False) "

    Try below for this <Function_Name> is invalid: InvalidIdentifier -  error

    please copy and paste the below code:

    IIF(code.IsFieldMissing(Fields!BackOrder.VALUE),True, False)

  • Sohaib Cheema Profile Picture
    46,614 User Group Leader on at
    RE: SSRS report custom code not recognized

    But writing VB Functions/scripts on Code window is not supported in AX-SSRS

    you have choice to write same thing as your are writing in VB code as under

    =Code.IsFieldMissingThenString(Fields!FieldName,"Missing")

    or as following

    =Code.IsFieldMissing(Fields!FieldName).

    This should be written in TEXTBox Expressions

    Have a look here

  • Verified answer
    syed baber Profile Picture
    11,633 on at
    RE: SSRS report custom code not recognized

    Hi Samy,

    Rather than writing a VB function to check this, I would suggest you to try resolving the issue from SSRS or AX client by doing the following steps:

    1) Clear cache from Tools -> Cache options.

    2) Do full CIL.

    3) In Visual Studio, select the report dataset, copy the query and then remove it, then refresh dataset. All fields should disappear. Now put the query back again and refresh dataset. See if the new field now showing under the dataset or not.

    4) If you are still getting the error, then send me the project XPO and I will verify it on my demo environment.

    Thanks,

    Baber.

  • Samy123 Profile Picture
    455 on at
    RE: SSRS report custom code not recognized

    Martin and Sohaib,

    The reason I am doing this, is because of an exception that we get occasionally that says that the hidden property reference a field that is not exists in the dataset. I googled out and someone suggested this solution to use VB function IsMissing() to check for the missing field at run-time they suggested me to write this function in code section and reference it in your expression. That way if for some reason the field is not included in the dataset at runtime the SSRS will not throw the ugly internal server error infolog to the user.

    Actually its a TechNet article

    https://technet.microsoft.com/en-us/library/cc281297(v=sql.100).aspx

  • Suggested answer
    Martin Dráb Profile Picture
    232,860 Most Valuable Professional on at
    RE: SSRS report custom code not recognized

    You can't do that in AX reports, AFAIK. In your case, you can easily use an expression alone.

    If you need something more complex, create a data method.

  • Sohaib Cheema Profile Picture
    46,614 User Group Leader on at
    RE: SSRS report custom code not recognized

    VB code is no more supported in AX2012-SSRS

    tell us what you want to achieve

  • Samy123 Profile Picture
    455 on at
    RE: SSRS report custom code not recognized

    this the VB code in code section:

    Public Function IsFieldMissing(field as Field) as Boolean

    If(field.IsMissing) Then

    Return True

    Else

    Return False

    End If

    End Function

    This is the expression on the row Hidden property"

    IIF(code.IsFieldMissing(Fields!BackOrder),True, False)

  • syed baber Profile Picture
    11,633 on at
    RE: SSRS report custom code not recognized

    Hi Samy,

    Can you please let me know what you are trying to achieve? May be there is a way to write that code in X++ and utilize that in SSRS report expression.

    Thanks,

    Baber.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March 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... 294,081 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,860 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans