How to Add Budget Pool Transaction Descriptions via Scripting
Applicable Products
Talent Management - Compensation
Applicable Releases
24.07 and later
Details
Previously, administrators could use a data processing script (like the AddBudgetPoolTransaction sample script) to add budget pool transactions. However, descriptions for the added transactions could not be added using a script; descriptions could only be entered manually in the UI.
In this update, administrators can add descriptions when adding budget pool transactions using a data processing script. To do this, there is an extra parameter that can be added to the script, and of course the data file must include the description data as well.
As an example, here is the existing AddBudgetPoolTransaction sample script with additions to add a description highlighted:
/This script will add a list of Budget Pool Transactions for the given Reward Cycle.
//This script assumes that a parameter will be added to the Runtime Properties for the Data Process that contains the Reward Cycle Name.
//This script assumes that a file will be uploaded to the Data Process that contains a list of the following columns: Budget Pool Name, TransactionTypeId, Amount, EffectiveDate
if (Params.RewardCycleName == null){
logError("Please provide a reward cycle name in the Runtime Properties.");
return;
}
def rewardCycle = WorksheetRuns.findByName(Params.RewardCycleName);
if (rewardCycle == null) {
logError("RewardCycleName (" + Params.RewardCycleName + ") is not a valid reward cycle name.");
return;
}
def transactionList = Vfile.getListFromCSV();
for (rec in transactionList ) {
def budgetPoolName = rec.get("BudgetPoolName");
def transactionTypeID = rec.get("TransactionTypeId");
def amount = new BigDecimal(rec.get("Amount"));
def effectiveDate = rec.get("EffectiveDate");
def description = rec.get("Description")
if (budgetPoolName == null) {
logError("Budget Pool Name (" + budgetPoolName + ") is not a valid Budget Pool name.");
return;
}
if (transactionTypeID == null) {
logError("Transaction Type Id (" + transactionTypeID + ") is not a valid WorksheetRunBudgetPoolTrxType.");
return;
}
def budgetPool = rewardCycle.findBudgetPoolByName(budgetPoolName); if (budgetPool == null) {
logError("Budget Pool Name (" + budgetPoolName + ") is not a valid Budget Pool name and does not return a valid Budget Pool.");
return;
}
def pattern = "yyyy-MM-dd";
if (effectiveDate != "" && effectiveDate != null){
effectiveDate =new SimpleDateFormat(pattern).parse(effectiveDate );
}
def scriptMessage = budgetPool.addBudgetPoolTransaction(transactionTypeID, amount, effectiveDate, description );
if (scriptMessage != null)
logError(scriptMessage);
}
The data file needs a Description column with the description text:
Keep in mind that the Description field is still limited to 400 characters, as it is in the UI. Anything over 400 characters in the Description field of the data file will be truncated.