> 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/service-management-and-contracts/assess-service-request-margin-exposure.md). Agents can also search and read this documentation through its [MCP server](https://kb.theloops.io/~gitbook/mcp).

# Assess Service Request Margin Exposure

Assess one service request for cost-versus-revenue margin erosion. Reads the request header, per-scope planned and actual totals, and optional drill-down into cost, sales and planned lines.

| Business area                    | Action type |
| -------------------------------- | ----------- |
| Service Management and Contracts | Read-only   |

## Overview

The Request Cost and Sales page (RequestCostAndSales.client, page RequestCostAndSalesPage using ServiceRequestSet) shows planned and actual cost, revenue and profit margin per request scope. These totals are computed by Price\_Rule\_Utility\_API and exposed as scope attributes (PlannedTotCost, ActualTotRevenue, ActualProfitMarginRate, …).

The IFS Cloud integration reads Request Cost and Sales data (read-only) to assess margin exposure on one service request.

## How it works

{% stepper %}
{% step %}
Get Request Cost Sales Header with `req_id`. Not found or not visible (access-group filter) → say so and stop.
{% endstep %}

{% step %}
List Scope Margin Summary with `req_id`. Exclude Cancelled scopes (list them).
{% endstep %}

{% step %}
Compute per scope and in total (invoice currency) using the tools and rules defined in the skill package.
{% endstep %}

{% step %}
Classify each scope: INSUFFICIENT\_DATA: no actual cost and no actual revenue. NEGATIVE: actual margin < 0. ERODING: actual margin < target, or actual margin < planned margin - 2\*watch\_band. WATCH: actual margin within watch\_band below target, or cost\_overrun\_pct > 10 while scope not Completed. HEALTHY: otherwise.
{% endstep %}

{% step %}
For scopes that are NEGATIVE, ERODING or WATCH (max 5 scopes): call List Scope Actual Cost Lines, List Scope Actual Sales Lines and List Scope Planned Lines. Report: cost by CostType and top 3 lines by CostAmount. Cost lines with no SalesLineSeq (unbilled cost). Sales lines with State NotInvoiceable. Planned vs actual by cost type.
{% endstep %}

{% step %}
Output: verdict headline with actual vs planned vs target, scope table, drivers. One next permissible action for the responsible role, currency stated, "no data changed".
{% endstep %}
{% endstepper %}

## Key capabilities

* Read one request with customer, currencies, status and invoice flags.
* Read planned and actual cost, revenue and margin per scope in invoice and base currency.
* Compute request-level totals, margin rate and plan-versus-actual variance.
* Drill into actual cost lines by cost type to find cost drivers.
* Detect cost lines without sales lines and sales lines in NotInvoiceable state.
* Compare planned lines (work-order cost type, quantity, cost) to actuals.
* Classify exposure against a user target margin with clear thresholds.
* Return evidence and one next permissible action. Never execute the projection's write actions.

## Requirements

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

| Component | Projection                  |
| --------- | --------------------------- |
| REQMGT    | RequestCostAndSalesHandling |

## Version compatibility

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

## Known limitations

* Read-only: does not create, update, or delete IFS Cloud data.
* Requires projection-level security. Permission errors halt the run.
