An error occurred when attempting to execute a Javascript block. See inner exception for detail.
Script:
/***************************************************************************
* Programmers: *
* original Ian Cruz icruz@exacttarget.com *
* most recent Josh Thaxton jthaxton@exacttarget.com *
***************************************************************************/
var TMC_MID = "1047532";
var dynamic_brand_profile_center_html_version = 41;
Platform.Load("Core", "1");
var advAttData, advAttProp, brand, brandID, choice, client, config, datatyp, dispname, eMailTypeFound, fldname,
fldName, fldtyp, fldvalue, g, imgData, imgLeftURL, imgProp, imgTopURL, is_html_layout, is_preview, isReqd,
jobID, k, key, m, mID, MyListData, MyListProp, myListRetr, obj, optChoices, optJSON, out, r, reqdCount, reqdValue,
su, subEmail, subKey, subret, subscriptionData, subscriptionDesc, subscriptionID, subscriptionName,
subscriptionProp, unsub_href, subscriptionDefaultChecked;
function addQueryParams(url, params) {
var glue, new_params, param;
try {
new_params = [];
for (param in params) {
if (params.hasOwnProperty(param)) {
new_params.push(param + "=" + encodeURIComponent(params[param]));
}
}
if (new_params.length > 0) {
glue = (url.indexOf("?") === -1) ? "?" : "&";
url += glue + new_params.join("&");
}
} catch (e) {
e.stack = e.stack || [];
e.stack.push('addQueryParams()');
throw e;
}
return url;
}
function createPlatformObject (type, options) {
var i;
var obj;
obj = Platform.Function.CreateObject(type);
if (options) {
if (options.SetObjectProperty) {
setObjectProperty(options.SetObjectProperty);
}
if (options.AddObjectArrayItem) {
addObjectArrayItem(options.AddObjectArrayItem);
}
}
return obj;
function setObjectProperty (properties) {
var property;
for (property in properties) {
if (properties.hasOwnProperty(property)) {
Platform.Function.SetObjectProperty(obj, property, properties[property]);
}
}
}
function addObjectArrayItem (arrays) {
var array;
var i;
for (array in arrays) {
if (arrays.hasOwnProperty(array)) {
for (i = 0; i < arrays[array].length; i++) {
Platform.Function.AddObjectArrayItem(obj, array, arrays[array][i]);
}
}
}
}
}
function createSimpleFilterPart (Property, SimpleOperator, Value) {
if (!isArray(Value)) {
Value = [Value];
}
return createPlatformObject("SimpleFilterPart", {
SetObjectProperty : {
Property : Property,
SimpleOperator : SimpleOperator
},
AddObjectArrayItem : {
Value : Value
}
});
}
function createComplexFilterPart (LeftOperand, LogicalOperator, RightOperand) {
return createPlatformObject("ComplexFilterPart", {
SetObjectProperty : {
LeftOperand : LeftOperand,
LogicalOperator : LogicalOperator,
RightOperand : RightOperand
}
});
}
function isArray (obj) {
return Object.prototype.toString.call(obj) === "[object Array]";
}
function invokeRetrieveRequest (options) {
var retrieve_request = createPlatformObject("RetrieveRequest", options);
var status = [0, 0];
return Platform.Function.InvokeRetrieve(retrieve_request, status);
}
function getConfigValues () {
var i;
var j;
var name;
var obj;
var parts;
var value;
parts = invokeRetrieveRequest({
SetObjectProperty : {
QueryAllAccounts : 1,
ObjectType : "DataExtensionObject[MasterConfiguration]",
Filter : createComplexFilterPart(
createSimpleFilterPart("Group", "equals", "CustomProfileCenter"),
"OR",
createComplexFilterPart(
createSimpleFilterPart("Group", "equals", "EnterpriseInfo"),
"AND",
createSimpleFilterPart("Name", "equals", "EnterprisePortfolioBaseURL")
)
)
},
AddObjectArrayItem : {
ClientIDs : [
createPlatformObject("ClientID", {
SetObjectProperty : {
ID : TMC_MID
}
})
],
Properties : [
"Name",
"Value"
]
}
});
obj = {};
for (i = 0; i < parts.length; i++) {
name = value = "";
if (parts[i] && parts[i].Properties && isArray(parts[i].Properties)) {
for (j = 0; j < parts[i].Properties.length; j++) {
if (parts[i].Properties[j].Name === "Name") {
name = parts[i].Properties[j].Value;
} else if (parts[i].Properties[j].Name === "Value") {
value = parts[i].Properties[j].Value;
}
}
}
if (name && value) {
obj[name] = value;
}
}
return obj;
}
function retrieveBrand () {
var brand_obj, brand_properties, brand_row, j;
brand_row = invokeRetrieveRequest({
SetObjectProperty : {
QueryAllAccounts : 1,
// Set the Request type - Get BRANDS Data first...
ObjectType : "DataExtensionObject[Brands]",
//Filter DE with BrandID
Filter : createSimpleFilterPart("ID", "equals", brandID)
},
AddObjectArrayItem : {
//Set the BU Client
ClientIDs : [
client
],
// Set the fields to retrieve
Properties : [
"ID",
"Name",
"Profile_Name",
"Description",
"Top_Image",
"Left_Image",
"Form_Title",
"Form_Intro",
"layout",
"html_references",
"html_top",
"html_left",
"html_footer",
"Req_Fields",
"Fields",
"Subscriptions"
]
}
});
brand_properties = [];
if (brand_row && brand_row.length > 0 && brand_row[0] && brand_row[0].Properties && brand_row[0].Properties.length > 0) {
brand_properties = brand_row[0].Properties;
}
brand_obj = {};
for (j = 0; j < brand_properties.length; j++) {
brand_obj[brand_properties[j].Name] = brand_properties[j].Value;
}
brand_obj.Req_Fields = (brand_obj.Req_Fields) ? eval(brand_obj.Req_Fields) : [];
brand_obj.Fields = (brand_obj.Fields) ? eval(brand_obj.Fields) : [];
brand_obj.Subscriptions = (brand_obj.Subscriptions) ? eval(brand_obj.Subscriptions) : [];
return brand_obj;
}
config = getConfigValues();
//fetch query params
mID = Request.GetQueryStringParameter("m");
brandID = Request.GetQueryStringParameter("b");
subKey = Request.GetQueryStringParameter("s");
jobID = Request.GetQueryStringParameter("j");
is_preview = Request.GetQueryStringParameter("pvw") === "1";
if (subKey) {
// w-3875808 Replace spaces with '+' in the subkey to work around an encoding issue
subKey = subKey.replace(/\s/g, "+");
subret = Subscriber.Retrieve({
Property : "SubscriberKey",
SimpleOperator : "equals",
Value : subKey
});
for (su = 0; su < subret.length; su++) {
subEmail = subret[su].EmailAddress;
}
}
//Impersonation here...
client = createPlatformObject("ClientID", {
SetObjectProperty : {
ID : mID
}
});
////Get Brands Data Extension Information
brand = retrieveBrand();
//Declare array for Reqd Fields hidden field
reqdValue = "";
reqdCount = 0;
//Declare Email DataType validator
eMailTypeFound = false;
//Loop thru Brands DE Properties
is_html_layout = brand.layout && brand.layout.toUpperCase() === "HTML";
ListID: 0
Index: 6
ExactTarget.OMM.FunctionExecutionException: An error occurred when attempting to evaluate a SetObjectProperty function call. See inner exception for details.
Source: OMMCommon |