CA Service Management

 View Only
  • 1.  How to trigger a notification in a specific answer of a survey?

    Posted May 12, 2015 08:05 AM

    Greetings to everyone,

     

    I would like to know if there is any activity notification (or another way) to trigger a notification when an person answer a survey and there is a specific response in his answers. Example: when someone choose "Unsatisfactory" as answer between {"Good", "Regular" and "Unsatisfactory"} in a question of the survey, a notification message is sent to the manager.

     

    Thanks,

     

    Diogo Nobrega



  • 2.  Re: How to trigger a notification in a specific answer of a survey?

    Posted May 12, 2015 10:24 AM

    hi,

    this is not preferred method but if there is no others you can use SPEL macros to achieve that.

     

    mod file:

    MODIFY svy_ans POST_VALIDATE z_survey_answer() 1337 FILTER(EVENT("INSERT") && selected == 1);
    

     

    spl file:

    svy_ans::z_survey_answer(...)
    {
      string owner_persid;
      object zfound, zobj;
      if(text == "Unsatisfactory") // OR YOU CAN USE SEQUENCE HERE
      {
           send_wait(0, top_object(), "call_attr", "survey", "sync_fetch", "STATIC", format("id = %d", owning_survey_question.owning_survey ), -1, 0);
           if(msg[1]>0)
           {
                zfound = msg[0];
                send_wait(0, zfound, "dob_by_index", "DEFAULT", 0, 0);
                zobj = msg[0];
                owner_persid = format("%s:%d", zobj.object_type, zobj.object_id); // SO HERE IS PERSID OF THE OBJECT WHICH HAS POPULATED SURVEY
                evt::z_attach_evt("evt:1337", owner_persid , 3); // PLACE CORRECT MULTIPLE NOTIFICATION EVENT HERE
           }
      }
    }
    
    evt::z_attach_evt(string evt_persid, string obj_persid, int zwait, ...)
    {
      object group_leader2;
      object attached_events_table_record;
      send_wait(0, top_object(), "get_co_group");
    
      if (msg_error())
      {
           logf(ERROR, "Attach Event: error '%s' on '%s'", msg[0], obj_persid);
           return;
      }
    
      group_leader2 = msg[0];
      send_wait( 0, top_object(), "call_attr", "atev", "get_new_dob", NULL, NULL, group_leader2);
      if (msg_error())
      {
           logf(ERROR, "Attach Event: error '%s' on '%s'", msg[0], obj_persid);
           return;
      }
      attached_events_table_record = msg[0];
      attached_events_table_record.obj_id = obj_persid;
      attached_events_table_record.event_tmpl = evt_persid; 
      attached_events_table_record.wait_time = zwait;
    
      send_wait(0, group_leader2, "checkin");
      if (msg_error())
      {
           logf(ERROR, "Attach Event: error '%s' on '%s'", msg[0], obj_persid);
           send_wait(0, group_leader2, "uncheck");
           return;
      }
    }
    


  • 3.  Re: How to trigger a notification in a specific answer of a survey?

    Posted May 13, 2015 03:18 PM

    Very elegant solution!

    I am just wondering why it is not preferred solution? This is the only type of customization which causes no worries when migrating to new version. All of my spels written in versions 11 or 12 works in 14.1, and believe me I have dozens of them. Yes it is not supported by CA, but if some of your advanced form or script customizations are not working in new version believe me, support will say that this is also out of support scope.