web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Adding a Resource in a Job Planning Line through OData (C#)

(0) ShareShare
ReportReport
Posted on by

Hi all,

I'm currently trying to add a resource in a Job Planning Line record using the OData API. I obtain a Resource Code No and attempt to push this into the Job Planning Line object and update/save. This brings down the entire NAV service and requires a restart.

I have tried multiple ways to populate the Resource field in a Job Planning Line, including:

Creating a Line without a resource then updating one with one later.

Populating the fields that are autocompleted on the form programatically.

Creating a Line with a resource manually, then programatically updating it with another.

Each time, it crashes the system. When a Line is created, the Type is set to Resource, so i'm not sure as to why any time I programatically add anything in the No property of a Job Planning Line, the system crashes.

Is there any way I can programatically set a resource to a Job Planning Line using OData?

Thanks

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    What is the error message you see in the event viewer, when it crashes ?

  • Community Member Profile Picture
    on at

    Hi Suresh,

    The error message is:

    Type: Microsoft.Dynamics.Nav.Service.WebMetadata.ServiceBrokerException

    HttpStatusCode: InternalServerError

    Message: Property "Editable" for No. is invalid!

    StackTrace:

        at Microsoft.Dynamics.Nav.Service.WebMetadata.MetaControl.IsFieldEditable(NavForm form)

        at Microsoft.Dynamics.Nav.Service.ODataServiceProvider.ODataUpdateProviderToNavPage.AssertControlIsEditable(MetaControl control, NavForm form)

        at Microsoft.Dynamics.Nav.Service.ODataServiceProvider.ODataUpdateProviderToNavPage.SetValues(ODataResource resource, NavForm form, Dictionary`2 changedValues)

        at Microsoft.Dynamics.Nav.Service.ODataServiceProvider.ODataInsertCommand.Execute(NavForm form)

        at Microsoft.Dynamics.Nav.Service.ODataServiceProvider.ODataUpdateProvider.ExecutePendingCommands(NavForm form)

        at Microsoft.Dynamics.Nav.Service.ODataServiceProvider.NavServiceHelper.<>c__DisplayClass1.<ExecuteUpdateOperation>b__0(NavSession session)

        at Microsoft.Dynamics.Nav.Service.ODataServiceProvider.NavServiceHelper.<>c__DisplayClass4.<ExecuteOperation>b__3(NavSession session)

        at Microsoft.Dynamics.Nav.Service.ODataServiceProvider.NavServiceHelper.ExecuteOperation[TResult,T1,T2](String companyName, ODataOperation`3 operation, T1 parameter1, T2 parameter2, Boolean isDefaultCompanyRequired)

    Source: Microsoft.Dynamics.Nav.Service.WebMetadata

    The error confused me as the property is editable in the form itself, so i'm not sure if i've misunderstood what the error message means.

  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    What is the NAV page no. you published ?

  • Community Member Profile Picture
    on at

    I believe it's 1007, the object ID of Job Planning Lines, unless I misunderstood your question.

  • Verified answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    In the page 1007 the Editable property for the "No." field,there is a source expression "No.Editable", i think that will always default to false if you are accessing via webservice, can you remove that expression and set it to true and try again.

  • Community Member Profile Picture
    on at

    The other properties have <PropertyEditable> and are editable via the web service, what is different about the No. field?

    And just to clarify, the Editable Property should have a value of '<TRUE>' ?

  • Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    Yes try with <TRUE>

  • Community Member Profile Picture
    on at

    That looks like it has worked. Thank you Suresh.

  • Asismorodo Profile Picture
    5 on at

    Thank you for this post, I was going nuts trying to figure out what I was doing wrong.

    I have a similar problem with the Cost field, no matter what I send the value doesnt save. I changed the editable property to true with no success. Any ideas?

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 NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans