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 :
Small and medium business | Business Central, N...
Answered

XML Port in web service in AL Code

(0) ShareShare
ReportReport
Posted on by 35

Hi All,

I am using Business Central  Cloud version 18.

I am trying to use XML Port for  Insert and update Customer

But in response I am getting all the record as response ,Can I get only the Current record as response.

like we have in the Rest API after Insertion?

If any one have idea ,then Please suggest.

Thank you so much for your help.

I have the same question (0)
  • Divesh Profile Picture
    327 on at

    Hi

    Can you please provide more information about the issue?

    Can you please share the screen shot / code related to the codeunit & xmlport that you have used? Thanks

  • Bharti20 Profile Picture
    35 on at

    Hi

    Thanks for your suggestion.

    I have used Customer.FindLast() to get the last id and pass in exit message.

    Please find the Screenshots of code unit and XMl Port

    pastedimage1631180396145v1.png

    pastedimage1631180482904v2.png

    But now I want only one value in response. It is possible?

  • Suggested answer
    Divesh Profile Picture
    327 on at

    There are 3 options to do that.

    1. In the Xmlport for elements that you want to skip use the OnBeforePassVariable trigger and add currXMLport.Skip(); code.

    OnBeforePassVariable

    currXMLport.Skip();

    2. Remove the var property for the XMLPortCreateCustomer parameter &  Add a new var parameter to UpdateCustomer Procedure and add code to assign the value that you want to return.

    procedure UpdateCustomer(XMLPortCreateCustomer : xmlport "Update Customer"; var CustomerNo: Code[20])

    3. Remove the var property for the XMLPortCreateCustomer parameter &  Add a return type for the Procedure UpdateCustomer and add code to assign the value that you want to return,either by assigning the value to RCustomerNo or you can use exit(value);

    procedure UpdateCustomer(XMLPortCreateCustomer : xmlport "Update Customer") RCustomerNo: Code[20]

    Hope this helps.

  • Verified answer
    Bharti20 Profile Picture
    35 on at

    Hi Divesh,

    Second Option work for me.

    Thanks for help.

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 > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,362

#2
YUN ZHU Profile Picture

YUN ZHU 867 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 607

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans