Running the script

The get_expense_reports.sh (Linux) script or the get_expense_reports.ps1 (Windows) script is run.

This table lists the valid arguments for the Linux script.

Option Description example
-f properties file taxback_infor.properties
-s Start date. This option is used to search for processing the work items. The start date is displayed in MM/DD/YYYY format. 08/01/2019
-e End date. This option is used to search for processing the work items. The end date is displayed in MM/DD/YYYY format. 08/31/2019
-p Password. This option overrides a password specified in the properties file.
-r File containing tracking numbers to reprocess workitem_errors.lst

This table lists the valid arguments for the Windows Powershell script.

Option Description example
-props properties file taxback_infor.properties
-start_date Start date. This option is used to search for processing the work items. The start date is displayed in MM/DD/YYYY format. 08/01/2019
-end_date End date. This option is used to search for processing work items. The end date is displayed in MM/DD/YYYY format. 08/31/2019
-password Password. This option overrides a password specified in the properties file.
-input_file File containing tracking numbers to reprocess. workitem_errors.txt
Note: The start date and end date can also be specified in the properties file as start_date and end_date.

These are the processes that the script follows to extract the expense report data:

  1. Validates all the properties and options specified in the expense_report.properties file.
  2. Calls the Token API to receive a token that is used in subsequent calls.
  3. Calls the DocumentsByDateRange API to get a list of work items matching the given activity number and within the date range.
  4. Creates a directory using the customer name, if not already created.
  5. 5. Creates cycles through the work items calling the Expense Report API to obtain the document and receipt image data. The results are in JSON format and are saved in the directory in step 4.

The tracking numbers of the documents that cannot be retrieved successfully are saved in the <customer>_workitem_errors.lst (or <customer>_workitem_errors.txt on Windows) file.

Example: Script execution on Linux

In this example, the start and end dates are sent to the line item. The other parameters are defined in the properties file.

$ ./get_expense_reports.sh -f expense_report.properties -s 07/01/2019 -e 07/31/2019

URL = http://localhost:7001/xm-api/v1/application

User = jsmith

Activity Number = 10

Customer = infor

Start Date = 07/01/2019

End Date = 07/31/2019

token = fSucGQ0TktgVv9AgtVJtO%2FfyHJVYft0U3aO3SpUdfjBE11ZDHVI2ZA%3D%3D

found 2 work items

working on ER00000007

success!

working on ER00000008

success!

all done

$

Example: Script execution in Windows Powershell

In this example, the start and end dates are sent to the line item. The other parameters are defined in the properties file.

PS C:\Users\pelia> ./get_expense_reports.ps1 -props expense_report.properties -start_date 07/01/2019 -end_date 07/31/2019

URL = https://xm10.xm.awsdev.infor.com/xm-api/v1/application

User = XMQA_TRN.jsmith

Activity Number = 10

Customer = infor

Start Date = 07/01/2019

End Date = 07/31/2019

token = 9/BWQNybdpDr6nFCDg2rCf60HiixLdBa7YYjW4Srl8G+E7GlgwD+M7SZgNk9KFY7ab1koRm5sBE=

1 work items found

working on ER00020383

success!

all done. 1 work items processed, 0 errors and 1 successes