Hi,
I'm trying to use a control typology rule to dynamically set some SMTP headers of the delivery. One of the things I need to do is check the name of an enumeration based on the value configured in the delivery.
In a test workflow, I was able to get the name using the application get schema method and find the desired enumeration: application.getSchema("nms:recipient")
However, when I try to apply the same code in my typology rule it just doesnt find the schema, I suspect that the application object is not available. According to the documentation it should be:
The complete code is:
function findBounceAddress(vendor){
var schema = application.getSchema("nms:recipient");
var enum = schema.enumerations.filter(findEnum("nms:recipient:vendor"));
return findNameFromValue(enum[0].values, vendor);
}
function findEnum(name){
return function(enumerations){
return enumerations.name.trim() == name;
}
}
function findNameFromValue(values, searchValue){
var result = "";
Object.keys(values).forEach(function(key,index) {
if(values[key].value == searchValue){
result = key;
}
});
return result;
}
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hi @jmeilan ,
I did some research on your query and seems you are not correctly configuring the control typology.
Above code will return value and can you please specify, how you are using the same value to set a rule in control typology.
As per your query above, its not much about having application object for control typology or not, its about that you are not returning the correct value which your custom control typology rule wants in same.
Can you give some more details of your control typology rule?
I am very much sure, rule is not been configured correctly.
Note :- JS code in control rule don't work exactly like JS code in workflow activity.
Regards
Abhishek
Views
Replies
Total Likes
Hi Abhishek,
I have an enumeration thas values as integers. The whole point of the above code is to give it a value such as 1 and find the name of that enumeration value such as "firstValue".
The reason why I think application is not available it's because when I do the below code I don't even get the schema. So nevermind all the loops and searching, I just don't get the recipient schema object in the first place.
var schema = application.getSchema("nms:recipient");
Maybe the object is different in a typology rule but that code worked fine in a workflow
Views
Replies
Total Likes
Hi @jmeilan ,
Yes I also tried the same code at my end and I am also not getting the recipient schema.
It seems it is not available.
Regards
Abhishek
Views
Replies
Total Likes
Hi @jmeilan,
Were you able to resolve this query on your own or do you still need help here? Do let us know.
Thanks!
Views
Replies
Total Likes
Hi @Sukrity_Wadhwa ,
Unfortunately I wasn't able to make it work and I had to use a workaround. It would be good if I could get some clarity on this for my information but it seems from my side that it is not possible
Views
Replies
Total Likes
Alright! Thanks for updating us on your issue. I will escalate it among our internal SMEs and see if they can help.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies