Thursday, July 15, 2021

How to Subscribe to Business Events Raised In ERP cloud Using OIC

 There are many use cases where we need to capture business events raised in ERP cloud in our   Integration designs.

in this article we will see  by taking one of the ERP event "ReceivablesInvoiceCompleted

When we subscribe to this event in OIC then whenever a manual invoice is Completed then the OIC integration will get triggered, with the invoice details in payload.

let us see how we can configure, subscribe and test this event Using an OIC integration.

1). To get  list of public events in ERP, Either run the below URL in browser:

https://(FA Domain)/soa-infra/PublicEvent/catalog

OR 

Run the below from POSTMAN or Browser:

https://(FA Domain)/fscmRestApi/resources/11.13.18.05/erpBusinessEvents 

 

2) Search for the  event you want to subscribe( here it is ReceivablesInvoiceCompleted)

The JSON response would be  either of the the below two screenshots respectively:

From:
https://(FA Domain)/soa-infra/PublicEvent/catalog

 

From:
https://(FA Domain)/fscmRestApi/resources/11.13.18.05/erpBusinessEvents

Using POSTMAN:



 

3). See the Enabled Flag. If it is true then we are good, if it is false then we need to enable it, then only we can subscribe to this event.

To enable it follow the below steps:

Use below url: 

https://(FA Domain)/fscmRestApi/resources/11.13.18.05/erpBusinessEvents/{ErpBusinessEventId} 

Eg.  https://xxxx-dev.fa.us6.oraclecloud.com/fscmRestApi/resources/11.13.18.05/erpBusinessEvents/100000000369039
 

get the ErpBusinessEventId from the step 2 payload.

Use Method as :PATCH

and JSON body as:

{
 "EnabledFlag": true
}

4). Verify the if the event is enabled in the response in POSTMAN:

 

5). Now we are good to subscribe this event.

Create a CSF key in Fusion for your OIC instance using THIS link.

From 21B release we  do not need to create CSF key as token-based authentication is enabled.

The HTTP header will have EHF-token.

6). Now Create a trigger based (App driven) OIC integration to subscribe to above event.

Create a connection for ERP cloud adapter using EPR cloud host URL as shown below:

Use ERP cloud adapter as Trigger

 

 


 

 

 


 

7). Activate the integration

 

 

Since the integration is active and it has subscribed to "ReceivablesInvoiceCompleted" event, we can see it in Fusion event subscription URL:

Example- https://xxxx-dev.fa.us6.oraclecloud.com/soa-infra/PublicEvent/subscriptions

The Response will be like below:

We can see the OIC integration which we had created is listed in the subscription list.

We can observer one more thing, The CSF Key is null, this means the authentication is being done through EHF Token.

7). Now  Create an AR invoice in and complete it, the OIC integration should get triggered.


After entering the details for AR Invoice if we click on Complete and Review or Complete and close then if all the entered details are valid then invoice gets completed.

 

Now the OIC Integration which we had created to subscribe, would have got triggered automatically

 

8). Verify the OIC integration trigger and payloads.

 We can see that the invoice completion triggered the OIC integration. We hadve given Ivoice number as Primary identifier in Tracking Variable.

 Now let us see the payload which has been sent as part of this event:

 

the sample Payload which we get as part of this Event is as below:

<ns01:onEvent xmlns:ns01="http://xmlns.oracle.com/cloud/adapter/erp/xxtest_REQUEST/types">
  <ns0:ReceivablesInvoiceCompleted xmlns:ns0="http://xmlns.oracle.com/apps/financials/receivables/shared/model/events">
    <ns0:BillToCustomerAccount>3001</ns0:BillToCustomerAccount>
    <ns0:BillToCustomerName>ABC Customer US</ns0:BillToCustomerName>
    <ns0:BillToSite>1008</ns0:BillToSite>
    <ns0:CustomerTransactionId>300000009266197</ns0:CustomerTransactionId>
    <ns0:DocumentNumber>100000023</ns0:DocumentNumber>
    <ns0:InvoiceBusinessUnit>USA BU</ns0:InvoiceBusinessUnit>
    <ns0:InvoiceCurrency>USD</ns0:InvoiceCurrency>
    <ns0:InvoiceDate>2021-07-14</ns0:InvoiceDate>
    <ns0:InvoiceNumber>100000023</ns0:InvoiceNumber>
    <ns0:InvoiceTotalAmount>10.5</ns0:InvoiceTotalAmount>
    <ns0:PaymentTerms>BFB 26 Net 30</ns0:PaymentTerms>
    <ns0:ShipToCustomerName/>
    <ns0:ShipToCustomerSite/>
    <ns0:TransactionSource>Manual </ns0:TransactionSource>
    <ns0:TransactionType>AR Other INV 1100</ns0:TransactionType>
    </ns0:ReceivablesInvoiceCompleted>
    </ns01:onEvent>

 

Similarly we can subscribe to other events which are raised in Fusion ERP Cloud.

 

No comments:

Post a Comment