The Get-Or-Create Use-Case
Last updated
Last updated
Get-Or-Create is a very common use case.
The client sends invoices with an accountNo
(number). Your process must check if the accountNo
exists and get the account's id, or it creates a new account for the given number. In any case, the process needs the internal account
Id
(record-id) to continue processing the invoice: createInvoice( invoiceNo, account
Id
)
If you consider an input profile like this: j.Invoice.REQ
You will notice that having the acountId
as a Dynamic Document Property attached to the document would be a perfect solution, to create an Invoice:
DDP_AccountId
= 69d38081-3c43-41f8-b3d7-34cb9516eefe
Unfortunately the implementation is not as easy as it seems, and the proposed solution won't work: the reason is that at the end of Branch 1 the account response incl. the accountId
are discarded and they are no longer available on the beginning of Branch 2 where you need the accountId
to create the invoice.The Cache Challenge.
if you then need the created invoice's id, too, for the j.Invoice.RES
response, you are into trouble. The solution follows: PropCache Scripts