Skip to main content

Hi everyone,

I'm developing a 3rd-party app integrated with IFS for managing leave requests.
I need to expose an action that returns multiple calculated values (total leave entitlement, used leave, and remaining leave) based on CompanyId and EmployeeNo.

The logic works fine in SQL — here’s the simplified query I’m trying to use inside the action implementation:

SELECT
NVL(ccntr_integration_utility_api.Get_Total_Leave_Entitlement(:CompanyId, :EmployeeNo), 0),
NVL(ccntr_integration_utility_api.Get_Total_Leave_Used(:CompanyId, :EmployeeNo), 0),
NVL(ccntr_integration_utility_api.Get_Remaining_Leave(:CompanyId, :EmployeeNo), 0)
INTO
:TotalEntitlement, :TotalUsed, :Remaining
FROM dual;

I couldn’t find any working example of an action returning a complex type (structure) in the documentation or community.

 

Thanks in advance for any guidance!

Solved it.

structure LeaveSummaryStruct {
attribute CompanyId Text;
attribute EmployeeNo Text;
attribute LeaveEntitlement Number;
attribute LeaveUsed Number;
attribute LeaveRemaining Number;
}

action GetLeaveSummary Structure(LeaveSummaryStruct) {
initialcheck none;
parameter EmployeeNo Text;
parameter CompanyId Text;
}
FUNCTION Get_Leave_Summary___ (
employee_no_ IN VARCHAR2,
company_id_ IN VARCHAR2) RETURN Leave_Summary_Struct_Rec
IS
l_res Leave_Summary_Struct_Rec;
BEGIN
l_res.company_id := company_id_;
l_res.employee_no := employee_no_;

SELECT
NVL(ccntr_integration_utility_api.Get_Total_Leave_Entitlement(company_id_, employee_no_), 0),
NVL(ccntr_integration_utility_api.Get_Total_Leave_Used(company_id_, employee_no_), 0),
NVL(ccntr_integration_utility_api.Get_Remaining_Leave(company_id_, employee_no_), 0)
INTO
l_res.leave_entitlement,
l_res.leave_used,
l_res.leave_remaining
FROM dual;

RETURN l_res;

EXCEPTION
WHEN OTHERS THEN
l_res.leave_entitlement := 0;
l_res.leave_used := 0;
l_res.leave_remaining := 0;
RETURN l_res;
END Get_Leave_Summary___;

 


Hello ​@seadtaydin 

You can easily create a QuickReport, then using the quickreport API you can get your data.

Much lighter than creating a custom function.