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

Announcements

No record found.

News and Announcements icon
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.

  • 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 740 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 531 Super User 2026 Season 2

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 310 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans