Expand my Community achievements bar.

How to unwrap or get values from a Wpp Object from "activity"

Avatar

Level 2

Hi, I have a element of a "link" type which I am using on an input form. In my custom JS activity, how do I get the values of selected linked schema (options:dimentions). I can get to other values in JS using activity.label etc. but when I do activity.dimension I get at [Object WppObject] and I tried to use "for each" etc. but I cannot get to the selected schema values "dimensions". Does anyone know, how to get to the values in Wpp Object?

Schema:
<element label="Dimensions" name="dimension" target="options:dimensions" type="link"/>

Form:
<input xpath="dimension"/>

JS:
activity.dimension (Wpp Object)

Thanks!
/Wiki

4 Replies

Avatar

Level 1

Hi @wiki, I'm facing the same problem currently and I wonder if you found a solution for parsing an wpp object?
I'm also trying to create custom activity that let's user pick values from a schema.
Thanks in advance!

Avatar

Level 2

Hi @rasmusp39956127 , I didn't find the solution to parse a wpp object; but I managed to implement in another way; I created the link and then some "temp variables" where on the form, I then saved the values from user inputs (in those variables) and read those variables then in the activity.

 

Regards
Wiki

Avatar

Level 1

Thanks for your reply and great to hear you found an alternative solution!
I'd very much appreciate a generic example of the steps you performed to achieve the desired end result, if possible?
Many thanks!

Avatar

Level 2

Sure

In my custom activity's extended "Workflow" schema:

Link to schema:
  <element label="campaign" name="campaign" target="ws:campaign" type="link"/>

Placeholders to save selected value from above link/schema:
    <attribute label="campaignSelectedValue" name="campaignSelectedValue" type="string"/>
    <attribute label="campaignSelectedTextValue" name="campaignSelectedTextValue"
               type="string"/>

And then in my input form, I can set the placeholders, with selected inputs:

  <form name="campaignActivity">
       <container colcount="2" colspan="2" label="Campaign" name="campaignContainer"
                 type="frame">
        <input xpath="campaign">
          <enter name="onClick">
            <set alias="@_cs" expr="[.]"/>
            <set alias="@campaignId" expr="[/@campaignId]"/>
          </enter>
        </input>
       </container>
    </container>
    <leave>
      <set expr="[campaign/@campaignId]" xpath="@campaignSelectedValue"/>
      <set expr="[campaign/.]" xpath="@campaignSelectedTextValue"/>
    </leave>
    <enter>
      <set expr="[@campaignSelectedValue]" xpath="campaign/@campaignId"/>
      <set expr="[@campaignSelectedTextValue]" xpath="campaign/@_cs"/>
    </enter>
  </form>

 

Hope it helps.