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 |
These are the processes that the script follows to extract the expense report data:
- Validates all the properties and options specified in the expense_report.properties file.
- Calls the Token API to receive a token that is used in subsequent calls.
- Calls the DocumentsByDateRange API to get a list of work items matching the given activity number and within the date range.
- Creates a directory using the customer name, if not already created.
- 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.
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
$
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