Expand my Community achievements bar.

You must define a key value for the elements error in adobe campaign classic

Avatar

Level 3

Hi Everyone,

 

I'm learning input forms. I'm facing error while i try to create new data in personalization field.

 

Schema code:

<element label="Personalization values" name="personalizationValues">
<attribute label="content" name="content" type="string"/>
</element>

 

<key name="personalizationValues">
<keyfield xpath="personalizationValues/@content"/>
</key>

 

Code used in input form:

<container label="Personalization fields">
<input type="list" xpath="personalizationValues">
<input xpath="@content"/>
</input>
</container>

 

Sujith_02kumar_0-1721208573127.png

 

Sujith_02kumar_1-1721208629025.png

 

 

Sujith_02kumar_2-1721208660238.png

 

Am i doing anything wrong here? Please help me sort this error.

 

Regards,

Sujith Kumar.

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

8 Replies

Avatar

Community Advisor

Hello @Sujith_02kumar  Like the error says. You will have to Set a Primary key in Schema. Add autopk as highlighted and it should work.

 

<element label="Personalization values" name="personalizationValues" autopk="true">
<attribute label="content" name="content" type="string"/>
</element>


     Manoj
     Find me on LinkedIn

Avatar

Community Advisor

Hi @Sujith_02kumar ,

Goto /Administration/Configuration/Data schemas/ and search for cus:Test schema.

In element tag, add autopk="true" and update the database structure.

  <element autopk="true" label="test" name="Test"/>

Disconnect and reconnect the console and now check your input form.

Avatar

Level 3

@ParthaSarathy , @_Manoj_Kumar_ ,

 

Thanks for replying.

 

This is my schema xml:

<element autopk="true" desc="Test" label="Test" labelSingular="Test" name="Test">

<attribute desc="Template Id for whatsapp" label="Template Id" length="150" name="templateId"
type="string"/>
<element label="Personalization values for whatsapp" name="personalizationValues">
<attribute label="content" name="content" type="memo"/>
</element>

<attribute desc="Media url for whatsapp" label="Media url" length="255" name="mediaUrl"
type="string"/>
<attribute desc="Media type for whatsapp" expr="Iif(@mediaUrl='', 'Text', 'Media')"
label="Media type" length="50" name="mediaType" type="string"/>
<attribute desc="Button link for whatsapp" label="Button link" length="255" name="buttonLink"
type="string"/>
<attribute desc="Channel type" enum="channelType" label="Channel type" length="50"
name="channelType" type="byte"/>

</element>
I have already defined primary key.

 

Below is my input form code:

<container>
<input xpath="@channelType"/>
</container>

<container type="visibleGroup" visibleIf="@channelType=1">
<container type="notebook">
<container label="Whatsapp template Id">
<input xpath="@templateId"/>
</container>
<container label="Whatsapp Personalization fields" xpath="personalizationValues">
<container>
<static>If you have multiple values, please enter them separated by commas (,).</static>
</container>
<input type="list" xpath="@content"/>
</container>
<container label="Whatsapp media url">
<input xpath="@mediaUrl"/>
</container>
<container label="Whatsapp Button link">
<input xpath="@buttonLink"/>
</container>
</container>
</container>

 

Do you see any issue here? If i try to create new values in personlization value column, adobe is getting closed.

 

If i use below code,

<input type="list" xpath="personalizationValues">
<input xpath="@content"/>
</input>

I'm getting parameter error.

 

How can I solve it?

 

Regards,

Sujith Kumar

Avatar

Community Advisor

Hello @Sujith_02kumar 

Try replacing 

<element label="Personalization values for whatsapp" name="personalizationValues">
<attribute label="content" name="content" type="memo"/>
</element>

 

with

<attribute label="content" name="content" type="memo"/>

 

and in the input form use this

<input xpath="@content"/>

 

and then refer the memo xpath in the input. 


     Manoj
     Find me on LinkedIn

Avatar

Level 3

Hi @_Manoj_Kumar_ ,

 

Thanks for replying. I'm able to able the update the data if i use the attribute without element. My main aim is to create a list type as mentioned below,

 

Sujith_02kumar_0-1721914697783.png

 

When i click on new icon instead of creating new my adobe client console get closed automatically.

 

Is there something i need to add a method i my schema to make it work?

 

Attaching the whole schema code and input form code for reference:

<element autopk="true" desc="whatsapp" label="whatsapp" labelSingular="whatsapp"
name="whatsappTest">

<attribute desc="Template Id for whatsapp" label="Template Id" length="150" name="templateId"
type="string"/>

<attribute label="content" name="content" type="memo"/>

<attribute desc="Media url for whatsapp" label="Media url" length="255" name="mediaUrl"
type="string"/>
<attribute desc="Media type for whatsapp" expr="Iif(@mediaUrl='', 'Text', 'Media')"
label="Media type" length="50" name="mediaType" type="string"/>
<attribute desc="Button link for whatsapp" label="Button link" length="255" name="buttonLink"
type="string"/>
<attribute desc="Channel type" enum="channelType" label="Channel type" length="50"
name="channelType" type="byte"/>

</element>


<container>
<input xpath="@channelType"/>
</container>
<container type="visibleGroup" visibleIf="@channelType=1">
<container type="notebook">
<container label="Whatsapp template Id">
<input xpath="@templateId"/>
</container>
<container label="Whatsapp Personalization fields">
<container>
<static>If you have multiple values, please enter them separated by commas (,).</static>
</container>
<input type="list" xpath="@content"/>
</container>
<container label="Whatsapp media url">
<input xpath="@mediaUrl"/>
</container>
<container label="Whatsapp Button link">
<input xpath="@buttonLink"/>
</container>
</container>
</container>

 

When i make it <input xpath="@content"/>, it works but when i make it <input type="list" xpath="@content"/>, it is not working.

 

Can you please tell me why this is not working.

 

Regards,

Sujith Kumar