Is there a way to get all available mailing lists?
Hi Markus.
Is there a way i can get all available mailing lists, from either code or angluar?
I am trying to make an Umbraco Forms WorkFlowType, with a custom attribute setting type, where the user can select the mailing list from a dropdown, instead of manually typing a number.
I found the nsServiceHelper after looking through ~/App_Plugins/NewsLetterStudio/assets/compiled folder.
But i would like to know if there is a better approch, that are more future safe?
I added mailinglist.html to ~/App_Plugins/UmbracoForms/Backoffice/Common/SettingTypes/
<div ng-controller="Custom.SettingTypes.MailingListController">
<select class="-full-width"
ng-options="field.value as field.name for field in fields"
ng-model="mailinglist"
ng-change="changeValue()">
<option value="">Choose a mailing list</option>
</select>
</div>
Added javascript controller file to a package.manifest in a custom pluigin inside ~/App_Plugins/CustomPlugin/
angular.module("umbraco").controller("Custom.SettingTypes.MailingListController",
function ($scope, $routeParams, notificationsService, nsServiceHelper) {
function init() {
if ($scope.setting.value) {
$scope.mailinglist = $scope.setting.value;
}
var formId = $routeParams.id;
if (formId === -1 && $scope.model && $scope.model.fields) {
} else {
nsServiceHelper.http({
method: "GET",
url: "/backofficeApi/GetAllMailingLists"
}).success(function (response) {
$scope.fields = response;
console.log(response);
}).error(function () {
notificationsService.error("Load failed", "Could not load mailinglists from newsletter studio");
});
}
}
$scope.changeValue= function () {
$scope.setting.value = $scope.mailinglist;
};
init();
});
Now i can get the attribute setting inside a WorkFlowType
[Umbraco.Forms.Core.Attributes.Setting("Mailing list", description = "Choose mailinglist to use", view = "mailinglist")]'
public string MailingListId { get; set; }
Hmm, nsServiceHelper is basically a "wrapper" around $http that adds some error-handling and stuff.
Since you're only interested in the internal mailing lists (Newsletter Studios own and not any lists from a external Subscription Providers) I think that you're best of by creating your own API controller and return the mailing lists.
You can get them using our "Service Locator", something like this:
Is there a way to get all available mailing lists?
Hi Markus.
Is there a way i can get all available mailing lists, from either code or angluar?
I am trying to make an Umbraco Forms WorkFlowType, with a custom attribute setting type, where the user can select the mailing list from a dropdown, instead of manually typing a number.
I found a temporary solution.
I found the nsServiceHelper after looking through ~/App_Plugins/NewsLetterStudio/assets/compiled folder.
But i would like to know if there is a better approch, that are more future safe?
I added mailinglist.html to ~/App_Plugins/UmbracoForms/Backoffice/Common/SettingTypes/
Added javascript controller file to a package.manifest in a custom pluigin inside ~/App_Plugins/CustomPlugin/
Now i can get the attribute setting inside a WorkFlowType
Hi!
Hmm, nsServiceHelper is basically a "wrapper" around $http that adds some error-handling and stuff.
Since you're only interested in the internal mailing lists (Newsletter Studios own and not any lists from a external Subscription Providers) I think that you're best of by creating your own API controller and return the mailing lists.
You can get them using our "Service Locator", something like this:
Hope this points you in the right direction?
By the way, there is also some code that you can look at in our Contrib-project: https://github.com/enkelmedia/NewsletterStudioContrib/tree/master/Newsletter%20Studio%20V2/NewsletterStudioContrib/UmbracoForms this is stuff that I created for some Meetup-presentation some years ago but I think that there should be valuable pointers in there.
is working on a reply...