Purpose:
Retrieve the transaction in whose context your integration is operating in, utilized by methods that operate on an existing transaction.
The methods that currently fall into this category are:
transaction.update
transaction.createEvent
Although integrations are free to set the transactional context they are operating in (using the transaction.set
method) , which may be necessary when providing views that allow users to switch between and perform actions on multiple transactions, the host application implicitly alters the transactional context in certain scenarios:
Implicit transaction context setting!
If your integration is launched by a user in the context of an existing transaction, such as from the Services page in Web Version of Encompass, the document icon on the services side-nav in Desktop Version of Encompass or on a loan application in Encompass Consumer Connect is set to said transaction.
Every time a new transaction is created during a user's interaction with your integration, the context is set to the last created transaction.
If the integration was initially launched in the context of an existing transaction, the
transaction.getOrigin
method will always return the originaltransactionId
the integration was launched in the context of, no matter how many times the transaction isset
in the current interaction. You can leverage this to track the initial transaction context for a user interaction.
The current transactional context your integration operates in can be queried using the transaction.get
method.
Sample Usage:
import host from '@elliemae/em-ssf-guest'
...
async function getCurrentTransactionContext() {
try {
let transactionObject = await host.getObject('transaction')
let transactionData = await transactionObject.get()
applicationState.currentTransactionContext = transactionData.id
} catch (error) {
console.log(error)
}
}
getCurrentTransactionContext()
import host from '@elliemae/em-ssf-guest'
...
host.getObject('transaction')
.then(
(transactionObject) => {
transactionObject.get()
.then(
(transactionData) => {
applicationState.currentTransactionContext = transactionData.id
}
)
.catch(
(error) => {
console.log(error)
}
)
}
)
.catch(
(error) => {
console.log(error)
}
)
Interface:
Input:
Type: Object
{
id: "{{TRANSACTION_ID}}"
}
Returns:
Type: Promise
==> Resolved:
The current transaction context is returned to the caller:
{
id: "TRANSACTION_GUID"
}
==> Rejected:
An error is raised, containing a message attribute with details about the error that occurred
{
message: "{{ERROR_DETAILS}}"
}