Skip to main content

Notifications

Microsoft Dynamics NAV (Archived)

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

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

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

  • Asismorodo Profile Picture
    Asismorodo 5 on at
    RE: Adding a Resource in a Job Planning Line through OData (C#)

    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?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Adding a Resource in a Job Planning Line through OData (C#)

    That looks like it has worked. Thank you Suresh.

  • Suresh Kulla Profile Picture
    Suresh Kulla 43,925 on at
    RE: Adding a Resource in a Job Planning Line through OData (C#)

    Yes try with <TRUE>

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Adding a Resource in a Job Planning Line through OData (C#)

    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>' ?

  • Verified answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,925 on at
    RE: Adding a Resource in a Job Planning Line through OData (C#)

    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
    Community Member Microsoft Employee on at
    RE: Adding a Resource in a Job Planning Line through OData (C#)

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

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,925 on at
    RE: Adding a Resource in a Job Planning Line through OData (C#)

    What is the NAV page no. you published ?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Adding a Resource in a Job Planning Line through OData (C#)

    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
    Suresh Kulla 43,925 on at
    RE: Adding a Resource in a Job Planning Line through OData (C#)

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

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

Announcing Our 2025 Season 1 Super Users!

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

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,996 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,853 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans