Purpose:
Set the transaction in whose context you want to invoke methods that operate on an existing transaction. The subject transaction must be one that was created for the current loan and EPC product.
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, 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 the Web Version of Encompass, the document icon on the services side-nav in Encompass Desktop or when returning to a loan application in Encompass Consumer Connect, the transactional context is implicitly 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,
transaction.getOrigin
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 that your integration is operating in can be queried using the transaction.get
method.
Sample Usage:
import host from '@elliemae/em-ssf-guest'
...
const transactionId = "{{TRANSACTION_ID}}"
async function setCurrentTransactionContext(transactionId) {
try {
const transactionObject = await host.getObject('transaction')
const transactionData = await transactionObject.set({"id":transactionId})
applicationState.currentTransactionContext = transactionData.id
} catch (error) {
console.log({error})
}
}
setCurrentTransactionContext(transactionId)
import host from '@elliemae/em-ssf-guest'
...
const transactionId = "{{TRANSACTION_ID}}"
host.getObject('transaction')
.then(
(transactionObject) => {
transactionObject.set(transactionId)
.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 transactional context has successfully been set, upon confirming the subject transaction was for the subject product and loan. The updated context is echoed back to the caller:
{
id: "{{TRANSACTION_ID}}"
}
==> Rejected:
An error is raised, containing a message attribute with details about the error that occurred
{
message: "{{ERROR_DETAILS}}"
}
Common Error Scenarios!
- You tried to change the context to a transaction that was not created for the subject EPC product and loan. Make sure the transaction you are trying to change to meets these requirements!