How to populate drop down based on custom srcSchema | Community
Skip to main content
LukasPe1
Level 3
September 27, 2021
Solved

How to populate drop down based on custom srcSchema

  • September 27, 2021
  • 1 reply
  • 1576 views

Hi, we are struggling with drop down functionality in Campaign Classic:

 

Requirements:
1. We want to use a custom srcSchema to populate a drop down, (not system enumeration or db enumeration).

2. The displayed value in the drop down list should be a specified field in the srcSchema, not the primary key.
3. The displayed value in the drop down list should be a specified field in the srcSchema, not the primary key also after saving and reopening the offer.

 

These are the solutions we have tried so far:

1. Input form: input type="enum" schema="cus:customSchema".
    SrcSchema (cus:customSchema): <compute-string expr="@nonPrimaryKey"/>.
    After saving the form/entity, primary key is displayed in the drop down, instead of the desired computed string.

2. SrcSchema: Creating a link to the cus:customSchema from an offer extension schema.
   Input form: input type="linkList" xpath="linkXpath" and displaying the nonPrimaryKey column with a child input element.
   We are struggling to get the linkList shown as a normal drop down. We only se the chosen/linked value.

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Marcel_Szimonisz

Hello @lukaspe1,

I always look how out-of-the-box fields are done. Your example is exactly the same as country field in nms:recipient. Except that the state link (conditional select based on previous selection) in your case is not needed.

 

See the schema nms:recipient

 <element externalJoin="true" label="Country/Region" name="country" revIntegrity="normal"
             revLink="recipient" target="nms:country" type="link">
      <join xpath-dst="@isoA2" xpath-src="location/@countryCode"/>
    </element>
    <element desc="State/Province" externalJoin="true" label="State" name="stateLink"
             revLink="recipient" target="nms:state" type="link">
      <join xpath-dst="@code" xpath-src="location/@stateCode"/>
      <join xpath-dst="@countryCode" xpath-src="location/@countryCode"/>
    </element>

See the input form nms:recipient

    <input choiceButton="true" createMode="none" extraColumns="@isoA2,@isoA3" noZoom="true"
           xpath="../country">
      <orderBy>
        <node expr="@label"/>
      </orderBy>
      <enter name="onChange">
        <set value="" xpath="../location/@stateCode"/>
        <reset xpath="../stateLink"/>
      </enter>
    </input>
    <input choiceButton="true" createMode="none" extraColumns="@code,@countryCode"
           noZoom="true" notifyPathList="country/@label|../country/@_cs,@countryCode|../location/@countryCode,country|../country"
           xpath="../stateLink">

      <sysFilter>
        <condition expr="@countryCode = $(../location/@countryCode)"/>
      </sysFilter>
      <orderBy>
        <node expr="@label"/>
      </orderBy>
    </input>

This also applies for all the custom objects you want to create, it is good to look at the ootb objects apart from the documentation

 

Marcel

1 reply

Marcel_Szimonisz
Community Advisor
Marcel_SzimoniszCommunity AdvisorAccepted solution
Community Advisor
September 27, 2021

Hello @lukaspe1,

I always look how out-of-the-box fields are done. Your example is exactly the same as country field in nms:recipient. Except that the state link (conditional select based on previous selection) in your case is not needed.

 

See the schema nms:recipient

 <element externalJoin="true" label="Country/Region" name="country" revIntegrity="normal"
             revLink="recipient" target="nms:country" type="link">
      <join xpath-dst="@isoA2" xpath-src="location/@countryCode"/>
    </element>
    <element desc="State/Province" externalJoin="true" label="State" name="stateLink"
             revLink="recipient" target="nms:state" type="link">
      <join xpath-dst="@code" xpath-src="location/@stateCode"/>
      <join xpath-dst="@countryCode" xpath-src="location/@countryCode"/>
    </element>

See the input form nms:recipient

    <input choiceButton="true" createMode="none" extraColumns="@isoA2,@isoA3" noZoom="true"
           xpath="../country">
      <orderBy>
        <node expr="@label"/>
      </orderBy>
      <enter name="onChange">
        <set value="" xpath="../location/@stateCode"/>
        <reset xpath="../stateLink"/>
      </enter>
    </input>
    <input choiceButton="true" createMode="none" extraColumns="@code,@countryCode"
           noZoom="true" notifyPathList="country/@label|../country/@_cs,@countryCode|../location/@countryCode,country|../country"
           xpath="../stateLink">

      <sysFilter>
        <condition expr="@countryCode = $(../location/@countryCode)"/>
      </sysFilter>
      <orderBy>
        <node expr="@label"/>
      </orderBy>
    </input>

This also applies for all the custom objects you want to create, it is good to look at the ootb objects apart from the documentation

 

Marcel

LukasPe1
LukasPe1Author
Level 3
October 6, 2021

Thank you so much Marcel!