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.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @SorenDP ,
Technically, what you're trying to achieve is possible. I actually developed a similar solution around 5–6 years ago, where I built an entire delivery using JavaScript.
However, the Adobe team rejected that approach. They confirmed it's not best practice and not future-proof.
Now I understand why — every time you upgrade the build, deploy a package, or do any major update, the custom JS-based solution is prone to breaking.
I would suggest a more stable and scalable approach:
Use a workflow.
Retrieve the data from the external system via POST or HTTP signal.
Pass the data into the workflow, select your target audience there, and populate the values with variable in delivery like label etc. you're currently trying to set in the delivery.
Use a recurring or continuous delivery to send the message.
This method is supported, maintainable, and much less fragile over time.
If you still want to use JSSP, I believe you can pass all the data from the JSSP into the workflow as well.
Hope this helps!
Kind regards,
Parvesh
Hi @SorenDP ,
Technically, what you're trying to achieve is possible. I actually developed a similar solution around 5–6 years ago, where I built an entire delivery using JavaScript.
However, the Adobe team rejected that approach. They confirmed it's not best practice and not future-proof.
Now I understand why — every time you upgrade the build, deploy a package, or do any major update, the custom JS-based solution is prone to breaking.
I would suggest a more stable and scalable approach:
Use a workflow.
Retrieve the data from the external system via POST or HTTP signal.
Pass the data into the workflow, select your target audience there, and populate the values with variable in delivery like label etc. you're currently trying to set in the delivery.
Use a recurring or continuous delivery to send the message.
This method is supported, maintainable, and much less fragile over time.
If you still want to use JSSP, I believe you can pass all the data from the JSSP into the workflow as well.
Hope this helps!
Kind regards,
Parvesh
Hi @Parvesh_Parmar. Thanks for the feedback. I see how this may not be a sustainable solution. I have switched to working with triggering a workflow from JSSP instead and then parsing variables throughout the workflow to both query the correct recipients as well as setting delivery variables during execution. This seems to be a working solution, however, it is not performing quite as well, but it is solving the use-case.
Thanks!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies