Skip to main content

Get Loan Activities

Retrieve all activities related to a specific loan account. This is a convenience query that wraps GetActivitiesQuery with entity type set to Loan.

Command

Use GetActivitiesQuery with entity: "Loan":

{
"Cmd": "GetActivitiesQuery",
"Data": {
"entity": "Loan",
"entityId": "12345",
"pageSize": 50
}
}

Request Parameters

ParameterTypeRequiredDescription
entitystringYesMust be "Loan"
entityIdstringNo*Database ID of the loan
encodedKeystringNo*Loan's encoded key
startDatestringNoStart date filter (YYYY-MM-DD)
endDatestringNoEnd date filter (YYYY-MM-DD)
pageNumberintegerNoPage number (default: 1)
pageSizeintegerNoItems per page (default: 50)

*Either entityId or encodedKey is required.

Examples

Using Loan ID

{
"Cmd": "GetActivitiesQuery",
"Data": {
"entity": "Loan",
"entityId": "12345",
"startDate": "2025-01-01",
"pageSize": 100
}
}

Using Loan Encoded Key

{
"Cmd": "GetActivitiesQuery",
"Data": {
"entity": "Loan",
"encodedKey": "8a80866e7f987654",
"pageSize": 50
}
}

Response Example

{
"Status": "00",
"Message": "Activities retrieved successfully",
"Data": {
"activities": [
{
"Id": 2001,
"CreationDate": "2025-12-24T09:00:00",
"UserName": "loan.officer@banklingo.com",
"UserKey": "8a80866e7f123456",
"Action": "Create",
"ActivityDescription": "Loan application created",
"AffectedItemType": "LoanAccount",
"AffectedLoanAccountName": "Personal Loan",
"AffectedLoanEncodedKey": "8a80866e7f987654",
"AffectedLoanId": "LN-2025-00123"
},
{
"Id": 2002,
"CreationDate": "2025-12-24T10:30:00",
"UserName": "credit.manager@banklingo.com",
"Action": "Approval",
"ActivityDescription": "Loan approved by credit committee",
"AffectedItemType": "LoanAccount",
"AffectedLoanAccountName": "Personal Loan",
"AffectedLoanEncodedKey": "8a80866e7f987654",
"AffectedLoanId": "LN-2025-00123"
},
{
"Id": 2003,
"CreationDate": "2025-12-24T14:00:00",
"UserName": "operations@banklingo.com",
"Action": "Disbursement",
"ActivityDescription": "Loan disbursed - Amount: ₦5,000,000",
"AffectedItemType": "LoanAccount",
"AffectedLoanAccountName": "Personal Loan",
"AffectedLoanEncodedKey": "8a80866e7f987654",
"AffectedLoanId": "LN-2025-00123"
}
],
"totalRows": 15,
"totalPages": 1,
"currentPage": 1,
"pageSize": 50
}
}

TypeScript Example

async function getLoanActivities(loanId: string, startDate?: string): Promise<ActivityResponse> {
const response = await fetch('/api/core/cmd', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
},
body: JSON.stringify({
Cmd: 'GetActivitiesQuery',
Data: {
entity: 'Loan',
entityId: loanId,
startDate: startDate,
pageSize: 50
}
})
});

return await response.json();
}

// Usage
const activities = await getLoanActivities('12345');
console.log(`Loan has ${activities.Data.totalRows} activities`);

// Display loan timeline
activities.Data.activities.forEach(activity => {
console.log(`${activity.CreationDate}: ${activity.Action} by ${activity.UserName}`);
});

Common Activity Types for Loans

  • Create: Loan application created
  • Update: Loan details updated
  • Approval: Loan approved
  • Rejection: Loan application rejected
  • Disbursement: Loan amount disbursed
  • Repayment: Loan payment received
  • Restructure: Loan restructured
  • Write-off: Loan written off
  • Penalty: Penalty assessed
  • Status Change: Loan status changed (Active, Closed, Defaulted)

Use Cases

Loan Lifecycle Timeline

View complete lifecycle of a loan from application to closure:

{
"Cmd": "GetActivitiesQuery",
"Data": {
"entity": "Loan",
"encodedKey": "8a80866e7f987654",
"pageSize": 100
}
}

Disbursement Audit

Track all disbursement activities for a loan:

{
"Cmd": "GetActivitiesQuery",
"Data": {
"entity": "Loan",
"entityId": "12345",
"searchText": "Disbursement",
"pageSize": 50
}
}

Payment History

View all payment-related activities:

{
"Cmd": "GetActivitiesQuery",
"Data": {
"entity": "Loan",
"entityId": "12345",
"searchText": "Repayment",
"startDate": "2025-01-01",
"pageSize": 100
}
}

Loan Problem Investigation

Investigate issues with a problematic loan:

{
"Cmd": "GetActivitiesQuery",
"Data": {
"entity": "Loan",
"encodedKey": "8a80866e7f987654",
"startDate": "2025-12-01",
"pageSize": 50
}
}

Frontend Integration Example

// React component for loan activity timeline
import React, { useEffect, useState } from 'react';

interface LoanActivity {
Id: number;
CreationDate: string;
UserName: string;
Action: string;
ActivityDescription: string;
}

export const LoanActivityTimeline: React.FC<{ loanId: string }> = ({ loanId }) => {
const [activities, setActivities] = useState<LoanActivity[]>([]);
const [loading, setLoading] = useState(true);

useEffect(() => {
async function fetchActivities() {
const response = await fetch('/api/core/cmd', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
},
body: JSON.stringify({
Cmd: 'GetActivitiesQuery',
Data: {
entity: 'Loan',
entityId: loanId,
pageSize: 50
}
})
});

const result = await response.json();
if (result.Status === '00') {
setActivities(result.Data.activities);
}
setLoading(false);
}

fetchActivities();
}, [loanId]);

if (loading) return <div>Loading...</div>;

return (
<div className="loan-activity-timeline">
<h3>Loan Activity History</h3>
<ul>
{activities.map(activity => (
<li key={activity.Id}>
<strong>{new Date(activity.CreationDate).toLocaleString()}</strong>
<br />
<span>{activity.Action}</span>: {activity.ActivityDescription}
<br />
<small>by {activity.UserName}</small>
</li>
))}
</ul>
</div>
);
};

Best Practice: Combine loan activities with loan transaction history for complete loan management visibility.