Record a transaction for custom component APIs for AEM Forms on JEE record-a-transaction-for-custom-components

When you use billable APIs in your custom component, you can enable transaction reporting for the component. To enable transaction reporting, modify the component.xml file of the component and add the tag given below under the operation for which transaction reporting must be enabled.

Tag: <transaction-operation-type>CONVERT</transaction-operation-type> // Supported values are SUBMIT, CONVERT, RENDER.

Old operation tag
New operation tag
<operation>
<.... tags
<...>
<operation>
<operation>
<.... tags
<...>
<transaction-operation-type>CONVERT</transaction-operation-type
<operation>

If you must capture more than one transaction for an API, such as a batch API where transaction count varies with the number of input counts, handle the transaction count at the API level.

To record the varied transaction count:

  1. Import class "com.adobe.idp.dsc.InvocationContextStack" in the code. The class is part of the adobe-livecycle-client.jar sdk file. The sdk file is available at <AEM_Forms_JEE_Install>\sdk\client-libs\common

    note note
    NOTE
    Update the client file shared above in your client project with the new file in case that it is already bundled.
  2. In the API for which varied transactions must be logged:

    1. Add logic so you can store the transaction count in some integer variable, such as, transaction_count.
    2. When the operation is successful, add InvocationContextStack.recordTransactionCount(transaction_count).
recommendation-more-help
19ffd973-7af2-44d0-84b5-d547b0dffee2