Page tree
Skip to end of metadata
Go to start of metadata

From ConfiForms version 1.19.1 you can now setup a rule to lookup a value from another form to be set for you into your form/field

It expects 3 parameters to be set

 

  1. Values to set - You can set multiple values at once using (to be set on a TARGET form, the one which you have set up this Field Definition Rules macro)

    fieldName=[entry.FIELD_NAME_FROM_LOOKUP_FORM]&anotherField=[entry.SOME_OTHER_FIELD_NAME_FROM_LOOKUP_FORM]

    Please note that here [entry.] is the record values from the SOURCE form

     

  2. Lookup filter - here you specify the filter which should be used to get the data from the source form. Syntax expect is as in ConfiForms Filters. Also can be constructed dynamically

    somefield:[entry.mylocalfield]
  3. Form name and location of the source form (where lookup is done). Expects in form name and page id format, separated by a : (this is a location of a SOURCE form)

    myform:984848

Raw strorage format of an example, which demonstrates this technique

  • We have 2 forms, and for 1st form we have 2 Field Definition Rules (one is to hide a field which we set with lookup (2nd rule)). We cannot use HIDDEn field as it is not exposed to client and cannot be set from the form (even via the rule). So, both fields are of type ""text""

 

<ac:structured-macro ac:macro-id="eb6dc554-c15c-45c6-b6be-d366408e4787" ac:name="confiform" ac:schema-version="1">
  <ac:parameter ac:name="formName">f</ac:parameter>
  <ac:rich-text-body>
    <p>
      <ac:structured-macro ac:macro-id="3e9910c7-7a97-4f55-b6a8-2042e0ccf546" ac:name="confiform-entry-register" ac:schema-version="1">
        <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
        <ac:rich-text-body>
          <p> </p>
        </ac:rich-text-body>
      </ac:structured-macro>
      <ac:structured-macro ac:macro-id="4c666857-123c-47b2-99c9-16ad81296063" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">mykey</ac:parameter>
        <ac:parameter ac:name="fieldLabel">My key</ac:parameter>
        <ac:parameter ac:name="type">text</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="7e11797f-89be-44b4-9c8a-7206238c5207" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">valueFromOtherForm</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Value from other form</ac:parameter>
        <ac:parameter ac:name="type">text</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="48a08dc1-8415-42e8-b127-8b4a65a9c4f7" ac:name="confiform-field-definition-rules" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">valueFromOtherForm</ac:parameter>
        <ac:parameter ac:name="action">Hide field</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="4eab5594-d2a5-4b85-a335-7d538f79245d" ac:name="confiform-field-definition-rules" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">valueFromOtherForm=[entry.lookupValue]</ac:parameter>
        <ac:parameter ac:name="values">type:[entry.mykey]</ac:parameter>
        <ac:parameter ac:name="action">Lookup and set value</ac:parameter>
        <ac:parameter ac:name="actionFieldName">mykey</ac:parameter>
        <ac:parameter ac:name="values2">formWithLookups:7602668</ac:parameter>
      </ac:structured-macro>
    </p>
  </ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="8f40beae-e69b-4c88-ae11-652bf35db240" ac:name="confiform" ac:schema-version="1">
  <ac:parameter ac:name="formName">formWithLookups</ac:parameter>
  <ac:rich-text-body>
    <p>
      <ac:structured-macro ac:macro-id="acd8c8f8-7ce7-4863-bd94-e9aa0c217e67" ac:name="confiform-entry-register" ac:schema-version="1">
        <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
        <ac:rich-text-body>
          <p> </p>
        </ac:rich-text-body>
      </ac:structured-macro>
      <ac:structured-macro ac:macro-id="d4ea5ec9-3561-476c-9e21-be9c694377f9" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">type</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Type</ac:parameter>
        <ac:parameter ac:name="type">text</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="9d5c39f9-44c6-4665-abd8-fb84f284cfdf" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">lookupValue</ac:parameter>
        <ac:parameter ac:name="fieldLabel">My Lookup value</ac:parameter>
        <ac:parameter ac:name="type">text</ac:parameter>
      </ac:structured-macro>
    </p>
  </ac:rich-text-body>
</ac:structured-macro>

 

 

 

 

 

 

 

  • No labels