Archive Old Matched Transactions and Purge Archived Transactions

Use the scripts in this section to archive matched transactions, including support and adjustment details, that are equal to or older than a specified age and then purge the archived transactions from Account Reconciliation. The archived matched transactions are recorded in a ZIP file.

How the Script Works

  1. Using the information in the input.properties file, logs into the environment
  2. Runs the following archiveTmTransactions command to create an archive. Resulting ZIp file and log file use the defaulting names Archive_Transactions_INTERCO_JOB_ID.zip and Archive_Transactions_INTERCO_JOB_ID.log

    epmautomate archiveTmTransactions INTERCO 365 filterOperator=contains filterValue=14001

    You can change the command parameters by modifying the input.properties file.
  3. Downloads the log file and the .ZIP file containing archived transactions to the local computer. The script displays an error message if no matching transactions are found.
  4. Copies the .ZIP file containing archived transactions to Oracle Object Store.
  5. Runs the purgeArchivedTmTransactions command (with the job ID of the archiveTmTransactions job) to delete the archived matched transactions from the application.

Running the Script

  1. Create the input.properties file and update it with information for your environment. Save the file in a local, directory. This directory is referred to as parentsnapshotdirectory in this discussion. Contents of this file differs depending on your operating system.

    Make sure that you have write privileges in this directory. For Windows, you may need to start PowerShell using the Run as Administrator option to be able to run scripts.

  2. Create transaction_match.ps1 (Windows PowerShell) or transaction_match.sh (Linux/UNIX) script and save it in the parentsnapshotdirectory where input.properties is located.
  3. Launch the script.
    • Linux/UNIX: run ./transaction_match.sh.
    • Windows PowerShell: run transaction_match.ps1.

Creating the input.properties Script

Create input.properties by copying and updating the following script.

javahome=JAVA_HOME
epmautomatescript=EPM_AUTOMATE_LOCATION
epmusername=exampleAdmin1
epmpassword=examplePassword1.epw
epmurl=exampleURL1
objectstorageusername=exampleAdmin2
objectstoragepassword=examplePassword2
objectstorageurl=exampleURL2
matchtype=INTERCO
age=365
filteroperator=contains
filtervalues=FilterValue=14001
proxyserverusername=myProxyserver
proxyserverpassword=myProxyserver_pwd
proxyserverdomain=myProxyDomain

Note:

Windows only: Remove these properties from the input.properties file:

  • javahome=JAVA_HOME
  • epmautomatescript=EPM_AUTOMATE_LOCATION

If authentication at proxy server is not enabled for your Windows network environment, remove these properties from the input.properties file.

  • proxyserverusername
  • proxyserverpassword
  • proxyserverdomain

Table 3-25 input.properties Parameters

Parameter Description
javahome The directory where the JDK used by EPM Automate is installed. Delete this entry from the Windows version of input.properties.

Example: javahome=./home/JDK/bin

epmautomatescript The directory where EPM Automate is installed. Delete this entry from the Windows version of input.properties.

Example:epmautomatescript=./home/utils/EPMAutomate/bin

epmusername User name of a Service Administrator or a Power User, User, or Viewer who is authorized to archive matched transactions.

Example: epmusername=ServiceAdmin

epmuserpassword The encrypted password file for the user identified as epmusername.

Example: epmpassword=myPwd.epw

epmurl The URL of the environment wherein matched transactions are to be archived.

Example: epmurl=https://test-cloudpln.pbcs.us1.oraclecloud.com

objectstorageusername The ID of a user who has the required access rights to write to Oracle Object Storage Cloud.

For users created in a federated identity provider, specify the fully-qualified name of the user (for example, exampleIdP/jdoe or exampleIdP/john.doe@example.com, where exampleIdP is the name of the federated identity provider). For other users, specify the User ID.

Example: epmusername=myIdP/jdoe

objectstoragepassword The Swift password or auth token associated with the user identified in objectstorageusername. This password is not the same as the password that the user uses to sign into the Object Storage Console. Auth token is an Oracle-generated token that you use to authenticate with third-party APIs, for example to authenticate with a Swift client. For instructions to create this token, see To create an auth token in Oracle Cloud Infrastructure Documentation.

Example: objectstoragepassword=jDoe_PWD

objectstorageurl The URL of the Oracle Object Storage Cloud bucket with an optional object name appended.

Example: objectstorageurl=https://swiftobjectstorage.region_identifier.oraclecloud.com/v1/namespace/MT_Archives/2023_archives

matchtype The identifier (TextID) of the match type from which matched transactions should be archived.

Example: matchtype=cashrecon

age

The number of days since the transaction was matched. Matched transaction older than or equal to this value will be archived.

Example: age=180

filteroperator The filter conditions to identify the accounts containing matched transactions for archival. Must be one of these: equals, not_equals, starts_with, ends_with, contains or not_contains.

This value is combined with the filterValue to identify the accounts from which matched transactions are to be archived.

Example: filteroperator=not_equals

filtervalues One or more filter value to identify the transactions to archive. If equals or not_equals is specified as the filterOperator, you can use a space-separated list to specify multiple values. If multiple values are specified, transactions from accounts matching any filter operator and filter value combination are selected for archival.

Example: filterValue=101-120 filterValue=140-202

proxyserverusername The user name to authenticate a secure session with the proxy server that controls access to the internet.

Example: proxyserverusername=myProxyserver

proxyserverpassword The password to authenticate the user with the proxy server.

Example: proxyserverpassword=myProxyserver_pwd

proxyserverdomain The name of the domain defined for the proxy server.

Example: proxyserverdomain=myProxyDomain

Windows Script

Create transaction_match.ps1 by copying the following script. Store it in the folder where input.properties is stored.

# Archive and Purge Transaction Matching PowerShell script

$inputproperties = ConvertFrom-StringData(Get-Content ./input.properties -raw)
$epmusername="$($inputproperties.epmusername)"
$epmpassword="$($inputproperties.epmpassword)"
$epmurl="$($inputproperties.epmurl)"
$objectstorageusername="$($inputproperties.objectstorageusername)"
$objectstoragepassword="$($inputproperties.objectstoragepassword)"
$objectstorageurl="$($inputproperties.objectstorageurl)"
$matchtype="$($inputproperties.matchtype)"
$age="$($inputproperties.age)"
$filteroperator="$($inputproperties.filteroperator)"
$filtervalues="$($inputproperties.filtervalues)"
$proxyserverusername="$($inputproperties.proxyserverusername)"
$proxyserverpassword="$($inputproperties.proxyserverpassword)"
$proxyserverdomain="$($inputproperties.proxyserverdomain)"

echo "Running processes to archive and purge transaction matching transactions ..."
if (${proxyserverusername}) {
    echo "Running epmautomate login ${epmusername} ${epmpassword} ${epmurl} ${proxyserverusername} ${proxyserverpassword} ${proxyserverdomain}" 
    epmautomate login ${epmusername} ${epmpassword} ${epmurl} ${proxyserverusername} ${proxyserverpassword} ${proxyserverdomain} 
} else {
    echo "Running epmautomate login ${epmusername} ${epmpassword} ${epmurl}" 
    epmautomate login ${epmusername} ${epmpassword} ${epmurl}
}
echo "Running epmautomate archiveTmTransactions \"${matchtype}\" ${age} filterOperator=${filteroperator} ${filtervalues}"
epmautomate archiveTmTransactions "${matchtype}" "${age}" "filterOperator=${filteroperator}" "${filtervalues}" > ./outfile.txt.tmp

$jobIdLine=Select-String -Path "outfile.txt.tmp" -Pattern "Job ID"; $jobIdLine=($jobIdLine -split ":")[-2]; $jobid=($jobIdLine -split " ")[1];
$logfile="Archive_Transactions_${matchtype}_${jobid}.log"
$transactionsfile="Archive_Transactions_${matchtype}_${jobid}.zip"
epmautomate listfiles > ./files.txt.tmp
$transactionslogfound=Select-String -Path "./files.txt.tmp" -Pattern "${logfile}"
$transactionsfilefound=Select-String -Path "./files.txt.tmp" -Pattern "${transactionsfile}"
rm ./outfile.txt.tmp
rm ./files.txt.tmp

if (${transactionslogfound}) {
    echo "Running epmautomate downloadfile \"${logfile}\""
    epmautomate downloadfile "${logfile}"
    if (${transactionsfilefound}) {
        echo "Running epmautomate downloadfile ${transactionsfile}"
        epmautomate downloadfile "${transactionsfile}" 
        if ($?) {
            echo "Running epmautomate copyToObjectStorage ${transactionsfile} ${objectstorageusername} ${objectstoragepassword} ${objectstorageurl}"
            epmautomate copyToObjectStorage "${transactionsfile}" "${objectstorageusername}" "${objectstoragepassword}" "${objectstorageurl}"
            if ($?) {
                echo "Running epmautomate purgeArchivedTMTransactions JOBID=${jobid}"
                epmautomate purgeArchivedTMTransactions "JobID=${jobid}"
            } 
	    else {
                echo "EPMAutomate copyToObjectStorage failed. Purging of archived matched transactions will not be attempted."
            } 
	}
	else {
            echo "Download of transactions file ${transactionsfile} failed. Copy to object storage, and purging of archived matched transactions will not be attempted."
	}
    } 
    else {
        echo "No matched transactions found. Archive file download, copy to object storage, and purging of archived matched transactions will not be attempted."
    }
} 
else { 
    echo "Matchtype ID \"${matchtype}\" not found. Archive file download, copy to object storage, and purging of archived matched transactions will not be attempted."
}

echo "Running epmautomate logout"
epmautomate logout
echo "Script processing completed."

Linux/UNIX Script

Create transaction_match.sh by copying the following script. Store it in the folder where input.properties is stored.

#!/bin/sh

. ./input.properties
export JAVA_HOME=${javahome}

echo "Running processes to archive and purge transaction matching transactions..."
if [[ "${proxyserverusername}" != "" ]]
then
    echo "Running epmautomate login ${epmusername} ${epmpassword} ${epmurl} ProxyServerUserName=${proxyserverusername} ProxyServerPassword=${proxyserverpassword} ProxyServerDomain=${proxyserverdomain}" 
    ${epmautomatescript} login "${epmusername}" "${epmpassword}" "${epmurl}" "ProxyServerUserName=${proxyserverusername}" "ProxyServerPassword=${proxyserverpassword}" "ProxyServerDomain=${proxyserverdomain}" 
else
    echo "Running epmautomate login ${epmusername} ${epmpassword} ${epmurl}" 
    ${epmautomatescript} login "${epmusername}" "${epmpassword}" "${epmurl}" 
fi
echo "Running epmautomate archiveTmTransactions \"${matchtype}\" ${age} filterOperator=${filteroperator} ${filtervalues}"
${epmautomatescript} archiveTmTransactions "${matchtype}" "${age}" "filterOperator=${filteroperator}" "${filtervalues}" > ./output.txt.tmp

jobid=$(grep "Job ID" ./output.txt.tmp | cut -d':' -f3 | cut -d' ' -f2)
logfile="Archive_Transactions_${matchtype}_${jobid}.log"
transactionsfile="Archive_Transactions_${matchtype}_${jobid}.zip"
${epmautomatescript} listfiles > ./files.txt.tmp
transactionslogfound=$(grep "${logfile}" ./files.txt.tmp | wc -l)
transactionsfilefound=$(grep "${transactionsfile}" ./files.txt.tmp | wc -l)
rm ./files.txt.tmp
rm ./output.txt.tmp

if [ ${transactionslogfound} -eq 0 ]
then
    echo "Matchtype ID \"${matchtype}\" not found. Archive file download, copy to object storage, and purging of archived matched transactions will not be attempted."
else
    echo "Running epmautomate downloadfile \"${logfile}\""
    ${epmautomatescript} downloadfile "${logfile}"
    if [ ${transactionsfilefound} -eq 0 ]
    then
        echo "No matched transactions found. Archive file download, copy to object storage, and purging of archived matched transactions will not be attempted."
    else
        echo "Running epmautomate downloadfile ${transactionsfile}"
        ${epmautomatescript} downloadfile "${transactionsfile}" 
        if [ $? -eq 0 ]
        then
            echo "Running epmautomate copyToObjectStorage ${transactionsfile} ${objectstorageusername} ${objectstoragepassword} ${objectstorageurl}"
            ${epmautomatescript} copyToObjectStorage "${transactionsfile}" "${objectstorageusername}" "${objectstoragepassword}" "${objectstorageurl}"
            if [ $? -eq 0 ]
            then
                echo "Running epmautomate purgeArchivedTMTransactions JOBID=${jobid}"
                ${epmautomatescript} purgeArchivedTMTransactions "JobID=${jobid}"
            else
                echo "EPMAutomate copyToObjectStorage failed. Purging of archived matched transactions will not be attempted."
            fi
        else
            echo "Download of transactions file ${transactionsfile} failed. Copy to object storage, and purging of archived matched transactions will not be attempted."
        fi
    fi
fi

echo "Running epmautomate logout"
${epmautomatescript} logout
echo "Script processing completed."