AnsweredAssumed Answered

AFDeliveryFormat properties How to fill programmatically

Question asked by mikhail.ten.seic on Nov 19, 2018
Latest reply on Nov 19, 2018 by mikhail.ten.seic

Hi all,

 

I faced with an issue when I need to create NotifcationRule programmatically and use web service as subscription. I can successfully create NotificationRule with AFDeliveryFormat. However when I try to set properties it never fills correctly. For example I have web service with the following parameters:

key values.JPG

Some of them are taken from current Event Frame Properties, Some of them from Notification Rule properties and some of the are hard coded. In the background I have Subscriber as NotificationContactTemplate (Created from AF explorer). And on the screentshot I added properties through AF System Explorer and looked what is stored in the properties of DeliveryFormat Properties. I tried to set the same key/values for the same element but it is still not configured in the end (delete current Notification Rule from System Explorer and re-created Notification Rule from my application using the same key/values)

 

The question is what I am doing wrong? How can I create Notification Rule with set up properties. I also do not understand where can I get all those GUID's from properties.

 

Some code i use:

 

AFNotificationRule myNotifincation = new AFNotificationRule(Name);
if (myElement.Analyses.Contains("Analys_PTM_" + paraID))
{
myElement.Analyses.Remove("Analys_PTM_" + paraID);
}


AFAnalysis rule = myElement.Analyses.Add("Analys_PTM_"
rule.AnalysisRulePlugIn = srv.AnalysisRulePlugIns["EventFrame"];
rule.AnalysisRule.ConfigString = "EFTGUID=9ce61543-3abe-4d34-8e9f-e3bf8048de4c;EFTNAME=Migrated Notifications Event Frame Template";
rule.Description = Name;
rule.TimeRulePlugIn = srv.TimeRulePlugIns[new Guid(TimeRuleGUIDs.Natural)];


myNotifincation.Criteria = "AnalysisName:Analys_PTM_" + paraID;
+ paraID);
AFAnalysisRule seqRuleHighHigh = rule.AnalysisRule.AnalysisRules.Add(srv.AnalysisRulePlugIns[new Guid(AnalysisRuleGUIDs.PerformanceEquation)]);
seqRuleHighHigh.ConfigString =
AFNotificationContactTemplate t = srv.NotificationContactTemplates["PTMNotificationService"];
myNotiContact.NotifyOption = AFNotifyOption.EventStartAndEnd;

if (myNotifincation.DeliveryFormats.Contains("PTMDeliveryFormat"))
{
myNotiContact.DeliveryFormat = myNotifincation.DeliveryFormats["PTMDeliveryFormat"];
}
else
{
myNotiContact.DeliveryFormat = myNotifincation.DeliveryFormats.Add("PTMDeliveryFormat", myNotiContact.DeliveryChannelPlugIn);
}


//myNotiContact.DeliveryFormat = srv.DeliveryFormats.Add("PTMDeliveryFormat", myNotiContact.DeliveryChannelPlugIn);
AFDeliveryFormat DF= myNotiContact.DeliveryFormat;


DF.Properties.Add("parameter:ParameterId", "{\"ParameterType:\"'\"System.String\",\"ValueType\":1,\"ContentInfo\":{\"Id\":\"00000000-0000-0000-0000-000000000000\",\"Name\":\"" + paraID + "\",\"PropertyId\":0}}");

Outcomes