Thursday, April 21, 2022

Sending OIC Instance ID Tracking page link in Error emails

In case of any Fault in Integrations, one of the most common configured step is to send email along with some important details such as Instance ID and other fault details.

After reading email, we often want more information about error and for that we must look at the flow trace to understand what caused this fault. For this usually the step is to login to OIC console then go to Monitoring -> Tracking and then filter based on Instance ID which usually consumes quite amount of time. However, we can totally save this time by embedding a hyperlink of Instance ID Tracking page in the email itself at design time.

Steps to achieve–
  1. In Notification Template create a reusable HTML body which contains Instance Id and before that add <a href='{InstanceBaseUrl}{InstanceId}'>
    If you are sending instance details in table row, then it would look something like this
    <tr>
    <td width="200" valign="top"><b>Instance ID</b></td>
    <td valign="top"><a href='{InstanceBaseUrl}{InstanceId}'>{InstanceId}</a></td>
    </tr>
  2. Set Parameter name and its value as
    InstanceBaseUrl – concat($self/nsmpr0:metadata/nsmpr0:environment/nsmpr0:baseURL,'/integration/home/faces/link?page=tracking&tracking_id=')
    InstanceId - $self/nsmpr0:metadata/nsmpr0:runtime/nsmpr0:instanceId
  3. Activate and test. Your email should look like below screenshot and once you click on Hyperlink it will open that Instance ID.
Bonus tip –

For Integrations developed using Oracle SOA Suite - BPEL you can send Flow ID links in emails. To generate generic Flow ID url and use it-
  1. Navigate to SOA Infra -> Flow Instances and click on Search Options.
  2. Change Instance created Time to 7 days
  3. Click on Add/Remove Filter and remove all selection and check Flow Instance
  4. Click on generate Bookmarkable Link and copy the URL. It would look like this -
    http://{hostname}:{port}/em/faces/ai/soa/infra?flowQuery=fId%3A{flow_id}%3Bct_twv%3A7%3Bct_twu%3Adays%3Bct_md%3Anormal%3B&type=oracle_soainfra&selectedTab=flowInstancesTab&target=/Domain_DefaultDomain/DefaultDomain/DefaultServer/soa-infra
  5. There are some values which are env specific so, create two BPEL properties to store URL values, everything before flow_id as part1 and everything after that as part2. Now concat these in assign and add this as href in email which triggers from SOA, similarly to how we did in OIC. We can update config plans to with env specific properties values and then migrate.
Let’s look at the result


No comments:

Post a Comment