Adobe Campaign - Add to List Via API - nms.group.Register()

Adobe Campaign - Add to List Via API - nms.group.Register()


Navigate:
 
If you’re reading this, you’re aware that Campaign’s official documentation can be a bit sparse on details sometimes. I’ve run into a very egregious example of this in the .Register() function for lists HERE
”takes XML recipientList” - wonderful, how helpful.
 
After an utter ton of fumbling around, I was able to get it to work with the following:
 
var listId = 11122223333 (obviously just get your list primary key) var recipientId = 12345678 (get your recipient Id from whereever) var listObj = NLWS.nmsGroup.load(listId); listObj.Register( <recipientList> <data> <recipient id={recipientId}> </recipient> </data> </recipientList> )
 
With custom fields - for example, a “registration date” field that records a timestamp, I was able to get this working with the following format:
 
var listId = 11122223333 (obviously just get your list primary key) var recipientId = 12345678 (get your recipient Id from whereever) var now = formatDate(getCurrentDate(),"%4Y/%2M/%2D %02H:%02N:%02S") var listObj = NLWS.nmsGroup.load(listId); listObj.Register( <recipientList> <data> <recipient id={recipientId}> <registerDate>{now}</registerDate> </recipient> </data> </recipientList> )
 
The <registerDate> name can be acquired from looking at the XML source of the target
notion image
notion image