> For the complete documentation index, see [llms.txt](https://kb.theloops.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kb.theloops.io/agentstudio/skills-library/projects/prioritize-due-contract-retentions.md). Agents can also search and read this documentation through its [MCP server](https://kb.theloops.io/~gitbook/mcp).

# Prioritize Due Contract Retentions

On construction and engineering contracts the customer withholds retention from each application for payment.

| Business area | Action type |
| ------------- | ----------- |
| Projects      | Read-only   |

## Overview

Interim (practical completion) and final (end of defects period) retention must be claimed on time, or cash stays locked up and claims can lapse.

IFS Cloud OData integration.

## How it works

{% stepper %}
{% step %}
List: SalesContractSet filter.
{% endstep %}

{% step %}
Profile: SalesContractSet key.
{% endstep %}

{% step %}
AfP: AppForPaymentSet.
{% endstep %}

{% step %}
Rank: Local ranking.
{% endstep %}

{% step %}
Return structured results and any escalation guidance.
{% endstep %}
{% endstepper %}

## Key capabilities

* Read contracts for one company with interim/final retention dates and percentages.
* Filter by horizon (overdue + due within N days) and optional contract state.
* Use IFS-computed TotalRetentionReleased and RemainingRetention (converted to contract currency by App\_For\_Payment\_API).
* Determine the next relevant retention event (interim vs final) and days until/overdue.
* Rank by urgency band, then exposure, with deterministic tie-breaks.
* Drill into one contract's applications to show where retention sits and whether interim/final release is flagged.
* Flag data-quality gaps (retention percentage set but no retention date, date passed but no remaining retention).
* Return a ranked table and recommended next action per contract.

## Requirements

The following IFS Cloud components and projections must be available, with permission sets that grant access to each projection.

| Component                        | Projection                                  |
| -------------------------------- | ------------------------------------------- |
| CONMGT (SALES CONTRACT)          | SalesContractDueRetentionsAnalysis          |
| APPPAY (APPLICATION FOR PAYMENT) | SalesContractApplicationsForPaymentHandling |

## Version compatibility

| Projection                                  | Supported IFS Cloud releases |
| ------------------------------------------- | ---------------------------- |
| SalesContractDueRetentionsAnalysis          | 24R2, 25R1, 25R2, 26R1, 26R2 |
| SalesContractApplicationsForPaymentHandling | 24R2, 25R1, 25R2, 26R1, 26R2 |

## Known limitations

* Scope matches the packaged tools and instructions only.
