cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
723
Views
0
Helpful
1
Replies

Combination of Conditional & Data Retrieval?

Is is possible to have the combination of the conditional and data retrieval rule?

I want a data retrieval rule to be executed on form load - based on a field value. Is it possible? How?

Curious to hear about this            

1 Reply 1

derevan
Level 4
Level 4

There is a technique I used in the MultiCloud accelerator that does just this. For your case, it would be accomplished as follows:

1) Have your DDR attached to another dictionary field (hidden, but editable client-side). Let's call it "MyDictionary.TriggerField".

2) On Form Load, execute a JavaScript that checks the dictionary field of interest (let's call that "MyDictionary.MyField"). Based on matching the condition of interest, you will trigger the change event for the "TriggerField" firing your DDR conditionally. Below is an example:

element = document.getElementById("MyDictionary.TriggerField");    

if (element == undefined)

   return;

if (serviceForm.MyDictionary.MyField.getValue() == "Some Condition") {

   if ("fireEvent" in element)

      element.fireEvent("onChange");

   else {

      var evt = document.createEvent("HTMLEvents");

      evt.initEvent("change",false, true);

      element.dispatchEvent(evt);

   }

}

PS. DDRs execute before JS, so the value of interest should be available before you get here. The subsequent DDR is executed conditionally based on this JS.