How to get an object by Document

To get any object by document, we can use any attribute as search criteria of the object and the findbyDocument web service.
This is similar to How to get an object by Key but the only difference is that it can return multiple records since we are not using the key to get the data.

First, go to AiM and decide a search criteria to be used to find the documents.
Back

Example:

  • Set Employee Type as “Shop Person” and Active status as “Yes” and Execute

emp_search_document

emp_Search_output

Now we are going to use the FinAeHEmpByDocument web service to get the result set.

  • Setup the authentication details
  • Create a service stub for the FinAeHEmpByDocument web service and pass the ENDPOINT URL of the web service
  • Pass the authentication through the serviceStub using Options
  • Create a “FinAeHEmpByDocument” document
  • Create FinAeHEmpByDocument object and set the values of the attributes we are going to use for the search. In our case it is ‘S’ for empType and ‘Y’ for active status
  • Now, use the service stub to call the FinAeHEmpByDocument web service and store the result in a AeHEmpEListDocument
  • Return the Document found using the search which is the object we wanted to find

Empdocument_1

Go back to Development with web services – Training