0 votes


I'm trying to add a button on Agenda view to generate action like "invite by mail" (exist in Appo Edit mode). i want to generate mail appointments for the whole week appointments.

I was checking, and the issue that there's a black-box function "CallEfficyProtocol" that create the invitation using #EditHandle, so how can i achieve this custom (from agenda view) and manipulate the #EditHandle?

Please advise.
Thank you.
Best Regards.

asked in Efficy/ Client side by (559 points)

1 Answer

0 votes

I managed to do it finally. in simple flow:
- first we get actions list that need to send invitation emails (through AJAX call)
- then loop through this list (using recursive calling for the function till no more actions to handle. I use recursive to make possible use of "wnd.close" check so i open windows one by one), and for each action i edit it (so i have EDITHANDLE), and i pass special flag
- in Acti dit window, i check the flag. If it's on, then i just activate the function "CallEfficyProtocol" and wait 3 seconds then close the window.
- Move And so on

But one issue with this solution that it depends on timing (it closes 'Acti' Edit windpw aftet some time), so if some thing during this time goes wrong then some appointments may not have invitation window opened. The real bottleneck is in the call through efficy sidebar, which is slow comparing to processing speed, so if X requests sent together using "CallEfficyProtocol" only the last one will be considered. That's why i use the wnd.close trick with timing.

It's not the perfect solution, and i'm really opened for any improvement suggestion or advises.
Thank you.
Best Regards.

Here's the code:

], function($, moment, History, Datetimepicker, Browser, format, Const, Model, CommandListener, Url, agendaStandardCmd) {
    /* This overrided module will add a new command to the original module and return it.
 * It is one of the multiple ways to add or modify the commands in a module
 * It is the preferred way for commands that are available from a large number of main modules (consult, list, agenda,), such as common desktop commands
 * The code inside the custom module will only run once, during the initial loading of the standard module.
    function createInvitationWeek(userKey) {
            var scriptFile = 'serverscripts/Agenda_server.js';
            var scriptFunc = 'GetNextWeekAppo';
            var extraParam = '&userKey=' + userKey;
                url: format("dialog?_macrofile=MacroAjax&_macro=RunScript&File=$0&Func=$1", scriptFile, scriptFunc),
                data: extraParam
            }).done(function (html) {
                html = html.slice(0, -1);
                var ResArr = html.split(",");
                InitiateInvitations(ResArr, 0);
    function InitiateInvitations(ActionArr, index){
        var period = 1000;
        var wnd;
            var K_ACTION = parseInt(ActionArr[index]);
            var URL = "edit?page=edit/Edit.htm&entity=Acti&key=" + K_ACTION + "&action=RefreshOpenerAgenda()&InviteOnly=1";
            wnd = OpenNewWindow("", URL, 640, 300);
            var timer = setInterval(function() {
                    if (wnd.closed) {
                        if( index+1 < ActionArr.length){
                            index += 1;
                            InitiateInvitations(ActionArr, index);
                }, 500);
    // Add command to handle the newly added command from the DesktopOffCanvasCustomEntities macro in MacroDesktopCustom
    // This actually modifies the command list of the STANDARD module
        createInvitationWeek: createInvitationWeek

    // return reference to STANDARD module
    return agendaStandardCmd;

in MacroEditSCustom, inside AfterLoaded function:

requirejs(['jquery', 'utils/url'], function($, URL) {
                if(URL.getArgument("InviteOnly") == "1")
answered by (559 points)
1,165 questions
1,423 answers
325 users