CA Service Management

 View Only

HTML Notifications in a context of custom object. 

Nov 25, 2015 08:48 AM

Built-in multiple-notification functionality fails at macro::execute when applied on a custom object, thus a different solution is required.

As it turns out, there is a notify_contact method defined as:

 

notify_contact(int,  // notify_level (urgency: 1 - low, 2 - normal, etc.)

              string, // msg_title

              string, // msg_body

              string, // msg_ack (unsure for the purpose of this field yet)

              int,    // transition_point (Activity Notification flag?)

              string, // context_persid (persistent_id of context object.)

              int,    // is_internal (probably internal field flag)

              int,    // cmth_override (override contact notification method with specified method ID. 0 -- keeps default setting.)

              ...    // arg[0] -- (string)in_msg_html -- sends HTML message.

              SDM 14.1 only:

              ...    // arg[1] -- likely (int)allow_internal_group -- upon testing, no affect noticed, so unsure about meaning.

              ...    // arg[2] -- (int)is_email_to_list_flag -- mail method:    //  these values need more in-depth testing.

                                                                            0 -- takes both 'to:' and 'cc:' addresses from specified list;

                                                                            1 -- no effect;

                                                                            2 -- sends to default contact e-mail, no cc: recipients.

              ...    // arg[3] -- (string)email_to_list -- a list of recipient adderesses, semicolon separated.

              ...    // arg[4] -- (string)email_cc_list -- a list of cc adderesses, semicolon separated.

              ...    // arg[5] -- (int)attachment_id -- attaches the specified file to an email.

              );      // possibly there are more additional arguments, at this stage they were not needed and not tested.

 

 

 

Usage for SDM 12.9:

 

 

object cntobj;     

send_wait(0, top_object(), "call_attr", "cnt", "dob_by_persid", 0, "cnt:2C74D1CF51FDB844ADCF79296B5F7367");

cntobj = msg[0];

//  notify_contact( int, string, string, string, int, string, int, int, ...) ;

send_wait(0, cntobj, "notify_contact", 2, "test subject", "test body", "", 0, "ztest_wf:400006", 0, 0, "<b>test body</b>");

if (msg_error()) {  logf(ERROR, "Error %s", msg[0]);  } 

 

SDM 14.1 introduced a couple of new atrributes to be passed: Recipient Email List, CC List and attachments:

send_wait(0, cntobj, "notify_contact", 2, "test subject", "test body", "", 0, "ztest_wf:400006", 0, 0, "<b>test body</b>", 0, 0, "to@email1;to@email2", "cc@email1;cc@email2", (int)attachment_id);

Statistics
1 Favorited
22 Views
0 Files
0 Shares
0 Downloads

Tags and Keywords

Comments

Mar 27, 2019 02:57 PM

Mar 27, 2019 02:46 PM

cdtj

Can you share your PERL script?

Thanks.

Dec 06, 2017 11:17 AM

Hi Melis,

 

Just in case you still need it, have to enable mail_allow_attmnts in options manager.

 

Test it and let us know the results.

Oct 18, 2017 02:11 AM

Hello,

Is there any update? 

Thanks, 

Oct 06, 2017 06:42 AM

Hello,

 

I can sent the email but no attachment. This ticket has attached file as pdf. PDF file id is 1710826642.

 

send_wait(0, cntobj, "notify_contact", 2, "test subject", "test body", "", 0, "ztest_wf:400006", 0, 0, "<b>test body</b>", 0, 0, "to@email1;to@email2", "cc@email1;cc@email2", (int)attachment_id);

 

What  is the (int)attachment_id) parameter?

 

alg::zIptalFormuMailGonder(...)
{
logf(ERROR, "zIptalFormuMailGonder: persid : %s -- ref_num: %s", call_req_id , call_req_id.ref_num);

object cntobj_2;

string mail, html_header_2, html_text_2;
mail ='a@hotmail.com';

html_header_2 = 'html_header DENEME';

html_text_2 = 'html_text DENEME';

send_wait(0, top_object(), "call_attr", "cnt", "dob_by_persid", 0, "cnt:297AC2C6251A25439A7E8FFF15360D07");
cntobj_2 = msg[0];
send_wait(0, cntobj_2, "notify_contact", 2, html_header_2, "", "", 0, call_req_id, 0, 0, html_text_2, 0, 0, mail, "abc@hotmail.com", 1710826642);

//send_wait(0, cntobj, "notify_contact", 2, html_header, "", "", 0, zpers_id, 0, 0, html_text, 0, 0, cnt_retour, "", "");

logf(ERROR, "zIptalFormuMailGonder: persid : %s -- ref_num: %s -- mail: %s", call_req_id , call_req_id.ref_num,mail);


}

Feb 27, 2017 01:06 PM

I have faced limitation (or performance advantage ) of this method:

I'm using this one to trigger my custom Notification Method which passes data to PERL script and have found that this method provides very limited amount of data to the ENV array: message body, summary, recepient info and 2-3 more;

When regular notification methods provides array with all object's variables including custom defined, also provides whole activity (alg) data.

 

The limitation is that I can't fetch persistnet_id of an object which is used to populate the notification. Adding @{persistent_id} to notification method's argument returns recepient's persid.

So I'm using msg_ack input to pass ticket's persid to my PERL script.

Dec 22, 2015 10:13 AM

Atnaujink sd14.1 versijai

send_wait(0,cntobj, "notify_contact", 2, "test subject", "testbody", "", 0, "cr:402125", 0, 0, "<B>testbody</B>",0,0,"servicedesk2@vaitvilas.local","martynas@vaitvilas.local","400453");

send_wait(0,cntobj, "notify_contact", 2, "test subject", "testbody", "", 0, "cr:402125", 0, 0, "<B>testbody</B>",0,2,"","","400453");

Related Entries and Links

No Related Resource entered.