Hi wodnicki,
The issue was that the subscription was not created. There was no error raised, but nothing happened.
It turned out using the @name of the service doesn't work. We had to use the @id. So first we convert the service name to a service id, then we use your XML.
This is what we ended up doing:
var recipientEmail = "henry.gallagher@yopmail.com";
var serviceName = "ceoTips";
var subscribe = true;
var sendConfirmation = true;
// get service id
var query = NLWS.xtkQueryDef.create({queryDef: {
schema: "nms:service", operation: "get",
select: { node: {expr: "@id"} },
where: { condition: {expr: "@name='"+serviceName+"'"} },
}});
var serviceId = query.ExecuteQuery().$id;
// recipient query
var recipientList = {choiceList:{
where: { condition: { expr: "@email = '"+recipientEmail+"'" } },
}}
// service query
var serviceList = entityList = {entityList:{
key:{ value: serviceId }
}}
// call
var confirmationIds = nms.subscription.RecipientSubscribe (
recipientList, serviceList,
subscribe, {empty: sendConfirmation}
);
logInfo('confirmationIds', confirmationIds); // DOMElement
logInfo('confirmationIds', confirmationIds.toString()); // 1:DM11|13605
logInfo('confirmationIds', confirmationIds.toXMLString(true)); // <elemConfirmationIds>1:DM11|13605</elemConfirmationIds>
Which seems overkill just to programmatically subscribe a recipient with the confirmation email... But it is needed in our case for a custom SOAP call.
Thank you
Florian