Skip to Content

Service Layer: How To Get Contact Info From ContactPersonCode

Hi,

I’m currently using the Service Layer calling the method DeliveryNotes. There is one property called ContactPersonCode as shown below.

I want to ask for this int ID, which method in service layer I can pass the ContactPersonCode to get the contact name?

Regards,

William

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Oct 16, 2017 at 12:57 PM

    Hi Willian.

    ContactPerson is a sub object of the BusinessPartner therefore, you need to access the specific BusinessPartner in order to retrieve the ContactPerson details.

    You can do that Via Odata Association (3.2. Addressing Links between Entries).

    GET https://HANASERVER:50000/b1s/v1/DeliveryNotes(2)/?$select=DocEntry,DocNum,CardCode,ContactPersonCode,BusinessPartner/ContactEmployees&$expand=BusinessPartner

    This will return all ContactEmployess from the Business Partner of Delivery Note #2 and also the DocEntry,DocNum,CardCode,ContactPersonCode From Delivery Note #2. See my next reply for a sample of this call response.*

    Since chidren's objects filters or "getByKeys" are not supported your code will have to compare which BusinessPartner/ContactEmployee element has the InternalCode property equals to the DeliveryNotes/ContactPersonCode.

    But at this point this is trivial :)

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 12, 2017 at 02:36 PM

    Hi William,

    You can use Object.getbykey("parameter name") method of Service Layer to get the contact name when passing ContactPersonCode.

    Regards

    Bhupendra

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Bhupendra,

      Are you implying for me to write to write a custom script to get the contact person name from ContactPersonCode? What I was looking for some existing method I can call from Service Layer is I pass in the int for ContactPersonCode and it returns me the contact.

      Regards,

      William