The queryDef method is one of the most commonly used methods in Adobe Campaign. It allows us to execute SQL queries against the database.
Now, suppose you are given an Adobe Campaign implementation. One of the instructions in the project requirement document is that you cannot use
This article provides techniques that
The 4 methods that I have implemented in my previous projects are given below.
Using sqlExec()
/*
Author: Prajwal Shetty
Version: 2.6
Function: Update using sqlExec and EscapeData
NL.SQL.escape(data) to escape a parameter that can be used in an SQL query. This function automatically places the expression between simple quotation marks. This function is defined in the NL.SQL package.
*/
var strEmail = 'prajwalshetty202@gmail.com'
var strSql = "UPDATE NmsRecipient SET sEmail=" +NL.SQL.escape(strEmail)+ " WHERE iRecipientId = 187696";
var dataUP = Using delivery.load()(strSql)
logInfo("UPDATE NmsRecipientt ->" + dataUP)
Using recipient.load()
var recipient = nms.recipient.load("122553")
recipient.firstName = "Prajwal"
recipient.save()
Using recipient.create() + XML
var recipient = nms.recipient.create(
<recipient
email = "prajwalshetty202@gmail.com"
lastName = "Shetty"
firstName = "Prajwal"/>)
recipient.save()
Using recipient.create() + JavaScript
var recipient = nms.recipient.create()
recipient.email = "prajwalshetty202@gmail.com"
recipient.lastName = "Shetty"
recipient.firstName = "Prajwal"
recipient.save()
Hope this helps.