Expand my Community achievements bar.

SOLVED

JSSP to List

Avatar

Level 5

Im bringing in data by JSSP. I can subscribe and write to the rec table, but I want a single view of all JSSP submissions for for good record keeping. So I'd like to simply add all submissions via JSSP to a list.

I am getting an error with this.

var rcp =

    <recipient

      _operation="insertOrUpdate"

      _key="@email"

      xtkschema="nms:recipient"

      firstName={request.getParameter("firstName")}

      lastName={request.getParameter("lastName")}

      email={request.getParameter("email")}>

      />;    

 

    var list = <rcpGrpRel _key="[rcpGroup/@name] email={request.getParameter("email")} name="LST16133"/>;

    var svc = <service>{request.getParameter("serviceName")}</service>;

    var create = true;

    

    nms.subscription.Subscribe(svc,rcp,create);

     xtk.session.Write(list);

But this is returning this error.

JST-310000 Error while compiling script 'get_we_simpleFormSubmit_jssp' line 18: invalid XML tag syntax (line=' var list = <rcpGrpRel _key="[rcpGroup/@name] email={request.getParameter("email")} name="LST16133"/>;

' token='email")} name="LST16133"/>;

').

JavaScript: error while compiling script 'get_we_simpleFormSubmit_jssp'.

1 Accepted Solution

Avatar

Correct answer by
Level 5

Thanks Vipul

I just ended up extending the recipient schema to include a JSSP_flag. Figured that was the simplest/quickest way to do it.

  var rcp =

    <recipient

      _operation="insertOrUpdate"

      _key="@email"

      xtkschema="nms:recipient"

      firstName={request.getParameter("firstName")}

      lastName={request.getParameter("lastName")}

      email={request.getParameter("email")}

      profileID={request.getParameter("profileId")}

      JSSP_flag={"true"}

    />;

View solution in original post

2 Replies

Avatar

Employee

Hi davidl14970702,

The code you are using here is wrong. There are multiple ways to accomplish this requirement.

1. Fill the origin field with some data to denote that the recipient was created using a JSSP page. Then have a workflow run every hour or 15 minute to pull such recipients which have been created since the workflow was last executed and then add them to a list. OR

2. If you wish to have everything executed in real time.

Once you have the ID of Recipient and also the ID of list, use following code.

Assuming ListID is 24447964 and RecipientID is 18995462

//List
var entity = <entityList><key value="24447964"/>

              <where>

                <condition enabledIf="" expr="@id = 24447964"/>

              </where>

            </entityList>

//Recipient

var choice = <choiceList><key value="18995462"/>

              <where>

                <condition enabledIf="" expr="@id = 18995462"/>

              </where>

            </choiceList>

nms.recipient.RegisterGroup(entity,choice,true)

Regards,
Vipul

Avatar

Correct answer by
Level 5

Thanks Vipul

I just ended up extending the recipient schema to include a JSSP_flag. Figured that was the simplest/quickest way to do it.

  var rcp =

    <recipient

      _operation="insertOrUpdate"

      _key="@email"

      xtkschema="nms:recipient"

      firstName={request.getParameter("firstName")}

      lastName={request.getParameter("lastName")}

      email={request.getParameter("email")}

      profileID={request.getParameter("profileId")}

      JSSP_flag={"true"}

    />;