iosCustomFields (application parameters) from JSSP
Hi Community!
I am working on a use-case that allows external system to integrate to our Campaign instance in order to create push deliveries and schedule + execute them. Here I have a requirement where I need to be able to set a single application variable "path". However, I have been unable to succeed with that. I mostly get a silent error/exception - So the system does not output any errors. The only thing I can confirm is, that it is related to attempting to set this specific field in my code. If I remove it, everything works again (but without the application variable)
Code snippet that is not working:
var deliveryDoc = nms.delivery.CreateFromModel(templateName, targetDef);
var delivery = nms.delivery.create(deliveryDoc);
delivery.label = label;
delivery.content.iosTitle.source = payload.title;
delivery.content.iosMessage.source = payload.body;
delivery.scheduling.delayed = schedule.delayed;
delivery.scheduling.contactDate = schedule.date;
delivery.scheduling.validationMode = "auto";
delivery.validation.useBudgetValidation = false;
delivery.validation.useContentValidation = false;
var customFieldsXML = '<source><customFieldsItem key="path" value="' + payload.link + '"/></source>';
var doc = DOMDocument.fromXMLString(customFieldsXML);
delivery.content.iosCustomFields = doc.documentElement;
delivery.content.androidCustomFields = doc.documentElement;
delivery.save();
I also tried:
var doc = new DOMDocument("customFields");
var source = doc.createElement("source");
var customField = doc.createElement("customFieldsItem");
customField.setAttribute("key", "path");
customField.setAttribute("value", payload.link);
source.appendChild(customField);
doc.appendChild(source);
delivery.content.iosCustomFields = doc.documentElement;
delivery.content.androidCustomFields = doc.documentElement;Which gives me the error: "SCR-160048 Error while processing XML, please check the parameters.".
I hope someone is able to assist with this challenge or point me in the correct direction allowing me to configure an application custom variable from a JSSP application while dynamically creating a push delivery.