Expand my Community achievements bar.

Announcing the launch of new sub-community for Campaign Web UI to cater specifically to the needs of Campaign Web UI users!
SOLVED

On change input Forms

Avatar

Level 2

Greetings ,
What I'm trying to do is to make my input change according to my enumeration. I want the value of my enumeration to be added to my input which will be displayed

Here is my data Schema :

 

<enumeration basetype="string" name="AEnum">
    <value label="first Value" name="firstValue" value="firstValue"/>
    <value label="second Value" name="secondValue" value="secondValue"/>
</enumeration>

<element desc="Test" img="fts:test.png" label="Test"
           name="test" template="xtk:workflow:activity">
    <attribute enum="AEnum" label="A" name="AEnumeration" type="string"/>
    <element label="Content" name="content" type="memo" xml="true"/>
</element>

 

And here is my input forms :

 

 <input xpath="@AEnumeration"/>
 <input xpath="content"/>

 

What I'd like is for the value of my input, which is string, to be added each time I click on an element in my enumeration,
thanks in advance for your help!

1 Accepted Solution

Avatar

Correct answer by
Level 2

Hi ,

THANK U @ParthaSarathy  And @aggabhi for Your Help ,
I found the solution in fact it is the SOAP call, I have two input attributes and one output then what I do is that I create a function that processes all that and each time I click on a button that I put in my form bah it works, here is the code:

The Input forms :

<input xpath="message_content"/>
<input xpath="@AEnumeration"/>
            <input label="Add" type="button">
              <enter>
                <soapCall name="setMessageContent" service="tst:concatainer">
                  <param exprIn="message_content" type="string"/>
                  <param exprIn="@AEnumeration" type="string"/>
                  <param type="string" xpathOut="message_content"/>
                </soapCall>
              </enter>
            </input>

 And i Add this in my dataSchema :

<methods>
    <method library="tst:concatainer.js" name="setMessageContent" static="true">
      <parameters>
        <param desc="message_content" inout="in" name="message_content" type="string"/>
        <param desc="A Enumeration" inout="in" name="AEnumeration" type="string"/>
        <param desc="The form" inout="out" name="self" type="string"/>
      </parameters>
    </method>
</methods>

i create a javascript code "tst:concatainer.js"  this is the code of the JS :

function tst_concatainer_setMessageContent(message_content,AEnumeration)
  {
    return message_content+" "+AEnumeration
  }
  

 

View solution in original post

9 Replies

Avatar

Community Advisor

Hi @AnasSpir05 ,

Create a OPEN type enumeration under /Administration/Platform/Enumerations/ and define it in your schema attribute.

 

Go to /Administration/Platform/Enumerations/ create new > Type: Open, and add the enumeration values eg, First_value, Second_value

ParthaSarathy_0-1687180714606.png

 

Now in Data schema, call the above created open enumeration as userEnum

<attribute userEnum="AEnum" label="A" name="AEnumeration" type="string"/>

 Input form configuration is same as you mentioned.

 

Now when a user click on  AEnumeration drop down, the user can see 'first value' and 'second value' in dropdown. But If the user enter 'third value', a pop-up will ask 'Do you want to create value 'Third Value' in enumeration 'Aenumeration', and on Clicking Yes, this new value will get stored in enumeration as well as in schema. 

So when next user click on the same enumeration, he can see this new value as well in drop down

ParthaSarathy_1-1687181038145.png

 

nms:recipient schema's 'City' field is one such example.

Avatar

Level 2

thank you for your reply @ParthaSarathy 
but my problem is that when I click on an element in the dropdown, I want that element to be displayed on my "Content" input,
if, for example, my "content" field contains the value "Hello This is my " ,
if I click on "First Value" in my dropdown, I want my "content" field to become "Hello this is my First Value".

Avatar

Level 6

Hi @AnasSpir05 ,

This is very much related to use case of using JavaScript SOAP calls to validate form data from the Console.

Refer "Validate Values" section on this link https://experienceleague.adobe.com/docs/campaign-classic/using/configuring-campaign-classic/input-fo...

 

Below is example :-

 

This example shows how you can make service calls from within forms:

<enter>
  <soapCall name="client" service="c4:ybClient">
    <param exprIn="@id" type="string"/>
    <param type="boolean" xpathOut="/tmp/@count"/>
  </soapCall>
</enter>
 

In this example, the input is an ID, which is a primary key. When users fill the form for this ID, a SOAP call is made with this ID as the input parameter. The output is a boolean that is written to this field: /tmp/@count. You can use this boolean inside the form.

 

So in your case, what you are returning should be saved in your enumeration.

 

Note :- This is just a example and I am sure this approach will help you to achieve the use case, you just need to modify your use case accordingly.

Avatar

Level 2

greetings @aggabhi  ,
thank you for your help
I've already tried this alternative but the problem is that I can't apply any changes. The problem is that I can recover both values with the soap call but I can't change them in the input forms.

Avatar

Community Advisor

Hi @AnasSpir05 ,

I tried it, you can use expression in schema to concatenate content+dropdown_value. But for this you need to create one more attribute, because you cant merge field1 and field2 on any of the same field inside schema definition.

 

you can give a try on below approach,

Schema:

<enumeration basetype="string" name="AEnum">
    <value label="first Value" name="first" value=" First Value"/>
    <value label="second Value" name="second" value=" Second Value"/>
</enumeration>

<element desc="Test" img="fts:test.png" label="Test"
           name="test" template="xtk:workflow:activity">
    <attribute enum="AEnum" label="DropDown" name="AEnumeration" type="string"/>
    <attribute label="content" name="content" length="2000" type="string"/>
    <attribute expr="@text1+' '+@sscript" label="Final Content" name="FinalContent"/>
</element>

 

Input Form:

  <input label="Drop down" xpath="@AEnumeration"/>
  <input label="Content" xpath="@content"/>

  <input label="Final Content" xpath="@FinalContent" readOnly="true"/>

 

Output:

 

ParthaSarathy_0-1687191177627.png

 

Final content wont populate automatically, but the Final content of content+dropDown value got stored in schema.

To view in input form, you can just refresh the console

ParthaSarathy_1-1687191258119.png

Only drawback I noticed in this is, combining using memo field is not working. So I made it as String and tested the same. But You can give a try on this approach.

Parallelly you can try @aggabhi 's approach as well.

 

Avatar

Level 2

Hi @ParthaSarathy ,
thank you for your help, but the problem is that in your example this remains static all the time because if for example I want to click on the dropdown again it won't change anything, what I'm trying to do is that each time I click on the dropdown I want the 'Content' text to be added inside the text for example:
my content is this: "hello this is my "
if I click on 'first value', I want my text to become: "hello this is my first value" but I'd also like to add some, for example I click on 'Second Value' again, so I want this value to be added and the text becomes "hello my first value second value".

Avatar

Community Advisor

@AnasSpir05 , 

In 1st case, when you select 'first value' in dropdown and content as "hello this is my " and click on Save, final content will become as "hello this is my first value" (you can refresh the console, so that this final value will get reflected in input form as well.)

And next time, when you select 'second value' in dropdown and with the same content for the same record and click on save, it will update as "hello this is my Second value" in schema (you can refresh the console, so that this new updated value will get reflected in input form as well.)

 

But if you want "hello this is my First Value Second value" after the above mentioned 2nd scenario, only way from input form is, you need to copy the final content and paste it in content, and then select the dropdown value.

ParthaSarathy_0-1687349370881.png

 

Avatar

Correct answer by
Level 2

Hi ,

THANK U @ParthaSarathy  And @aggabhi for Your Help ,
I found the solution in fact it is the SOAP call, I have two input attributes and one output then what I do is that I create a function that processes all that and each time I click on a button that I put in my form bah it works, here is the code:

The Input forms :

<input xpath="message_content"/>
<input xpath="@AEnumeration"/>
            <input label="Add" type="button">
              <enter>
                <soapCall name="setMessageContent" service="tst:concatainer">
                  <param exprIn="message_content" type="string"/>
                  <param exprIn="@AEnumeration" type="string"/>
                  <param type="string" xpathOut="message_content"/>
                </soapCall>
              </enter>
            </input>

 And i Add this in my dataSchema :

<methods>
    <method library="tst:concatainer.js" name="setMessageContent" static="true">
      <parameters>
        <param desc="message_content" inout="in" name="message_content" type="string"/>
        <param desc="A Enumeration" inout="in" name="AEnumeration" type="string"/>
        <param desc="The form" inout="out" name="self" type="string"/>
      </parameters>
    </method>
</methods>

i create a javascript code "tst:concatainer.js"  this is the code of the JS :

function tst_concatainer_setMessageContent(message_content,AEnumeration)
  {
    return message_content+" "+AEnumeration
  }