0

I created a pipeline with a condition module and an action module. While coding for the condition and action modules, I need to pass some data from a different document to the condition module so that the expected condition could be evaluated to True or False.

For example, I have two policy documents (P1 and P2) in my DB and I am updating document P1. The condition I want to check before invoking action module is whether the Policy Effective date of P1 is greater than Policy Effective Date of P2. I understand that the document P1 is available in both condition and action modules through the $cpf-uri variable, but not able to pass the values from P2 document to the condition/action module.

Is there a way to pass parameter values to condition and action modules in a pipeline?

Thanks in advance!

Bhanu
  • 427
  • 2
  • 8
  • I think you should be able to grab the P2 document in the condition or action module via fn:doc or cts.doc. You may need to do an xdmp.eval in order to evaluate it against your content database - I don't remember if it evaluates by default against the content database or triggers database (I would guess the content database, in which case no eval is needed). – rjrudin Jan 10 '19 at 22:46
  • Thanks a lot! My use case is that I have a document with a phone number and whenever I perform update on this document, and if the phone number changes during the update (condition), then I should find other documents that have the old phone number and update those documents with new phone number (action). By the time, the condition module is invoked, the document is already updated and hence I lose the old phone number unless I setup temporal. I was able to achieve this using xdmp.spawn without having to setup temporal, but preferring to do it with CPF as it comes with a framework! – Bhanu Jan 11 '19 at 14:28
  • CPF may be overkill here. If there aren't many ways for the phone number to be updated, I would just insert a function call into each transaction that can update the phone number. CPF is good when you need durable, asynchronous processing - but that isn't normally the case. – rjrudin Jan 13 '19 at 17:19

0 Answers0