Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Running a Codeunit from a Page Web Service

(0) ShareShare
ReportReport
Posted on by 10

Hi All,

I have a Codeunit which takes in 9 parameters ("No." : Code[20];dim1 : Code[20];dim2 : Code[20];dim3 : Code[20];dim4 : Code[20];dim5 : Code[20];dim6 : Code[20];dim7 : Code[20];dim8 : Code[20]) returntext : Text[50])

I need to create a Page Web Service which will be exposed by Odata which will take those 9 parameters and run the Codeunit mentioned above. 

Can I Just create a page with those 9 global variables on the list and run the Codeunit on the OnAfterGetRecord trigger on the page?

Thanks

*This post is locked for comments

  • TESDEveloper Profile Picture
    TESDEveloper 10 on at
    RE: Running a Codeunit from a Page Web Service

    Hi Gusti,

    After trying this with Odata v3 the following error message occurs "Could not add property to the resource type". Any ideas what this is referring too?

    Thanks

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 44,656 on at
    RE: Running a Codeunit from a Page Web Service

    Check this link, you can use the OData v4

    demiliani.com/.../

  • Suggested answer
    I Gusti Made Ari Profile Picture
    I Gusti Made Ari 3,594 on at
    RE: Running a Codeunit from a Page Web Service

    Create a Page with temporary set to yes, use table that have fields/structure which can represent the parameter of your function , then call the function of your codeunit inside the OnInsertRecord Trigger

    If your NAV version is 2018 or above, you can make use of OData Bound Action

    docs.microsoft.com/.../walkthrough-creating-and-interacting-odata-v4-bound-action

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…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

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