Explaining the Need for Custom Business Logic

After completing this lesson, you will be able to:

After completing this lesson, you will be able to:

  • Explain the need for Custom Business Logic

The Need for Custom Business Logic

Usage Scenario

While CAP provides a high-level abstraction for building cloud (native/side-by-side) applications, there will always be cases where custom logic is essential to meet the unique needs of your business or to integrate with external systems. Custom logic in CAP allows you to extend and customize the default behaviors of the framework to create a fully tailored and functional application.

Introducing Service API for Custom Logic

Custom Code is the logic that you can add to the application to express things like data validation, enrichment, calculations, integration with external systems, or any other custom processing that your application requires.

In the figure, The Service API for Custom Logic, you see four types of APIs:

Construct, Reflection API
This deals with constructing and looking things up in services or connecting to other required services. These are not commonly used. Usually, you will not deal too much with these.
Querying API
This is a query API, through which you can send synchronous queries to services, including databases.
Messaging API
This is the asynchronous counterpart of the query API with which services can send messages to one another.
Event Handling
These are used to register custom event handlers.

As we see on the picture, the box for services appears twice.

This shows that services can mean our own services that we provide as part of the application, or it denotes remote services from other applications or it can mean in databases in which we have the same APIs for in the programming model.

For this unit, we are going to focus on the APIs around registering event handlers to the runtime system (deep dive in the next lesson: Explaining Event Handling in CAP).


Adding custom business logic to a CAP application allows you to tailor the application to your specific needs and extend its functionality beyond the default capabilities provided by the framework.

Further reading

Read more about CAP Core Services here.

Log in to track your progress & complete quizzes