Keywords

udt

The udt URL keyword is used to retrieve the list of UDTs configured in SAP Business One. The B1WebAPI web service provides developers with an interface to UDTs via a HTML GET or a HTML POST.

Syntax: /udt.aspx

HTML GET

If you provide the name of the UDT and the internal key of a record in that table, then the B1WebAPI web service will return an XML representation of that record.

Syntax: [/<optional-profile>]/udt/<UDT-name>/<UDT-key>.aspx Example (default profile): /udt/myCustomTable/10000.aspx Example (“myCompany” profile): /myCompany/udt/myCustomTable/10000.aspx

If you just provide the name of the UDT without a key, then the B1WebAPI web service will return all of the records in that UDT in XML format.

Syntax: [/<optional-profile>]/udt/<UDT-name>.aspx Example (default profile): /udt/myCustomTable.aspx Example (“myCompany” profile): /myCompany/udt/myCustomTable.aspx

HTML POST

If you provide the name of the UDT and the internal key of a record in that table the B1WebAPI web service will update the UDT record with the XML that you POST.

Syntax: [/<optional-profile>]/udt/<UDT-name>/<UDT-key>.aspx Example (default profile): /udt/myCustomTable/10000.aspx Example (“myCompany” profile): /myCompany/udt/myCustomTable/10000.aspx

If you just provide the name of the UDT without a key, then the B1WebAPI web service will insert a new record into that table using the XML that you POST.

Syntax: [/<optional-profile>]/udt/<UDT-name>.aspx Example (default profile): /udt/myCustomTable.aspx Example (“myCompany” profile): /myCompany/udt/myCustomTable.aspx

Testing UDTs

You can load UDTs and UDT rows using the Test Transactions screen, as outlined below.

  • Connect to B1WebAPI, typically installed on the SAP Business One server, usually at http://localhost:4033/index.aspx.</li>

  • Navigate to Test Transactions, typically http://localhost:4033/transactions.aspx</li>

  • Select “UDT” from the Object Type drop-down, and select your UDT name. If desired fill in the Key (UDT Code field).</li>

  • Press Load UDT to load the data for the UDT or UDT row, as populated in B1. See screenshots below.

    Select the Object Type (1), UDT Name (2) and, if desired, fill in the Key (UDT Code) (3). Load the UDT (4) and view the results (5).
    Select the Object Type (1), UDT Name (2) and, if desired, fill in the Key (UDT Code) (3). Load the UDT (4) and view the results (5).
    UDT in B1, note the Code field (1) is the UDT Key.
    UDT in B1, note the Code field (1) is the UDT Key.

UDOs (User Defined Objects)

UDO support is very similar to UDT support. First, select UDO from the drop-down, or simply replace the “udt” keyword mentioned above with the keyword “udo”, and use the appropriate UDO name and UDO identifier.