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 :
Microsoft Dynamics AX (Archived)
Suggested Answer

Function ProjectPosting::getProjectPostingType has been incorrectly called

(0) ShareShare
ReportReport
Posted on by 17

Hi,

I am trying to create a Purchase Order through AIF service from C# code. It works just fine but I need to set the Project for the purchase order and when i set the ProjId = "some value" it throws me the following error:

`Function ProjectPosting::getProjectPostingType has been incorrectly called.`

this is the code to populate project

` purchTable[0].ProjId = "338/19"; `

so how can I set project from code?

Thanks.

*This post is locked for comments

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    300,721 Super User 2025 Season 2 on at
    RE: Function ProjectPosting::getProjectPostingType has been incorrectly called

    Hi Nderon,

    Did you do some debugging to see what is actually going on? Initially, I don't see a relation with setting a field on the purchase order table and the function which is generating the error. Why did you use a hard coded value for the project ID?

  • Nderon Hyseni Profile Picture
    17 on at
    RE: Function ProjectPosting::getProjectPostingType has been incorrectly called

    I have hard coded the project ID because it comes from a mobile application. I did debug the app and all i get is 'Function ProjectPosting::getProjectPostingType has been incorrectly called' error message. In order to populate project ID from my C# code do I need to set another properties?

  • nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: Function ProjectPosting::getProjectPostingType has been incorrectly called

    If you debug (or even read the code of) the method that throws the error (ProjectPosting::getProjectPostingType), what is the condition for throwing this error? That's the first thing to check when trying to understand the reason for the error.

  • Suggested answer
    Mykhailo Stakhniv Profile Picture
    180 on at
    RE: Function ProjectPosting::getProjectPostingType has been incorrectly called

    Hi Nderon,

    Looking into that method I guess you should try to check if at least one of these configuration keys is enabled: Payroll, Timesheet or Public sector

  • Nderon Hyseni Profile Picture
    17 on at
    RE: Function ProjectPosting::getProjectPostingType has been incorrectly called

    @Nikolaos I am using C# code to create a Purchase Order through AIF, which means 'ProjectPosting::getProjectPostingType' is an x++ method therefore it is not in my project. However the error is pointing me at that function.

  • nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: Function ProjectPosting::getProjectPostingType has been incorrectly called

    Nobody said it's in your project. It doesn't mean you don't have to care about it or understand it.

    Please reread the suggestions that were given to you, they contain information that you can use to understand and resolve your issue.

  • Suggested answer
    Mohammed Khatib Profile Picture
    430 on at
    RE: Function ProjectPosting::getProjectPostingType has been incorrectly called

    Hi Nderon,

    I am assuming that you are passing Purchase lines along with the AIF call, therefore you have to specify the project details on the purchase line level, mainly "Project Category"

    PurchLine[0].ProjCategoryId = "Some value";

    PurchLine[1].ProjCategoryId = "Some value";

    PurchLine[2].ProjCategoryId = "Some value";

  • Nderon Hyseni Profile Picture
    17 on at
    RE: Function ProjectPosting::getProjectPostingType has been incorrectly called

    nmaenpaa Yes you are right, but I do not have permission to debug any x++ code, I only have access to the AIF endpoint and c# code

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: Function ProjectPosting::getProjectPostingType has been incorrectly called

    Well, if you integrate with AX, either you or someone else in your team should be able to debug the x++ code. Otherwise you have a long and difficult path ahead.

    I suggest you report these issues to the x++ expert of your project. Systems integration is always team work.

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 3

#3
Scott_itD Profile Picture

Scott_itD 2 Community Manager

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans