Insert mirror link into a database table via workflow javascript

Avatar

Avatar
Validate 1
Level 1
rahuladwani
Level 1

Likes

0 likes

Total Posts

8 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
rahuladwani
Level 1

Likes

0 likes

Total Posts

8 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
rahuladwani
Level 1

26-10-2020

Hello,

 

I am using Adobe Campaign Classic v7 build 8936. My objective is to insert the mirror link of a message into a table in the database.

 

I have built a workflow which queries broadlogid and deliveryid from the nmsbroadlogrcp table and then I have written the following javascript:

 

var deliveryData = xtk.queryDef.create(
<queryDef schema="temp:query" operation="select">
<select>
<node expr="@id"/>
<node expr="@id1"/>
</select>
</queryDef>);
try {
var data = deliveryData.ExecuteQuery();

} catch(e) {

}

for each(var value in data)
{
    var mirrorPageURL = nms.delivery.GetMirrorURL(value.@id1,value.@id);

    var queryXML = <campmirrorlinkinfo _operation="insert" xtkschema="ybl:campmirrorlinkinfo"/>;

    /*var queryXML = <campmirrorlinkinfo _operation="insert" xtkschema="ybl:campmirrorlinkinfo" broadLogId={value.@id} deliveryId={value.@id1} mirrorurl={mirrorPageURL}/>;*/

    queryXML.@broadLogId = value.@id;
    queryXML.@deliveryid = value.@id1;
    queryXML.@mirrorurl = mirrorPageURL;
    try{
        xtk.session.Write(queryXML);
    } catch(e) {
    }

}

 

I am able to fetch the mirror link but I am not able to insert it in the table. I am getting the below error:

 

 

error.JPG

 

Can anyone please help me as to how can I achieve this objective and get rid of this error?

 

Thanks in Advance,

Rahul

Accepted Solutions (0)

Answers (2)

Answers (2)

Avatar

Avatar
Give Back 50
Employee
Sukrity_Wadhwa
Employee

Likes

155 likes

Total Posts

913 posts

Correct reply

35 solutions
Top badges earned
Give Back 50
Validate 1000
Validate 500
Validate 250
Validate 100
View profile

Avatar
Give Back 50
Employee
Sukrity_Wadhwa
Employee

Likes

155 likes

Total Posts

913 posts

Correct reply

35 solutions
Top badges earned
Give Back 50
Validate 1000
Validate 500
Validate 250
Validate 100
View profile
Sukrity_Wadhwa
Employee

04-11-2020

Hi @rahuladwani,

Were you able to resolve this query with the given solution or do you need more help? Do let us know.

Thanks!

Avatar

Avatar
Boost 5
Level 2
isahore
Level 2

Likes

8 likes

Total Posts

36 posts

Correct reply

11 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Affirm 5
Affirm 3
View profile

Avatar
Boost 5
Level 2
isahore
Level 2

Likes

8 likes

Total Posts

36 posts

Correct reply

11 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Affirm 5
Affirm 3
View profile
isahore
Level 2

28-10-2020

Hi @rahuladwani,

 

You need to uncomment the second statement, and comment the first one here. You also need to add a key field to the statement, only then an insert will be successful.

 

/*var queryXML = <campmirrorlinkinfo _operation="insert" xtkschema="ybl:campmirrorlinkinfo"/>; */

var queryXML = <campmirrorlinkinfo _operation="insert" xtkschema="ybl:campmirrorlinkinfo" key="@broadLogId" broadLogId={value.@id} deliveryId={value.@id1} mirrorurl={mirrorPageURL}/>;

// I assume that broadLogId is the primary key of the schema you want to write to.

 

Regards,

Ishan