Problem Returning to Form After Adding Record

My StudyGroups form has a page for Members in the group, powered by a DataView. I can click the AddMember action button to add a new member to the list of members in the group. This runs the AddGroupMember function:

function AddGroupMember(five, context, result)  {
        
        const parentForm = five.variable.MyForm; 
        const parentKey = five.variable.MyKey;
        
        let vars = {
            ParentTable: null,
            MemberKey: null,
            StudyGroupKey: null,
            IsLeader: false,
            IsCoordinator: false,
            IsCoLeader: false,
            IsAssistant: false,
            IsSunshine: false,
            GroupPaidDate: null,
            CheckNumber: null
        };

        if (parentForm === "Members") {
            vars.ParentTable = 'Members';
            vars.MemberKey = parentKey;
        } else if (parentForm === "StudyGroups") {
            vars.ParentTable = 'StudyGroups';
            vars.StudyGroupKey = parentKey;
        }
        five.setVariable("Vars", vars);
        // five.showMessage(JSON.stringify(five.variable.Vars));
        try {
            five.selectAction("AddGroupMemberProcess");
            return five.success(result);
        }
        catch (e) {
            five.showMessage("Error: " + e.message);
            return five.failure(result);
        }
    }

The AddGroupMemberProcess has screen fields for all of the fields in the GroupMembers table. It also has an action button to return directly back to the calling form, like a “cancel” button. This code is run:

function ReturnFromInputForm(five, context, result)  {
    five.showMessage('MyForm: ' + five.variable.MyForm + '\nMyKey: ' + five.variable.MyKey);
    
    five.selectAction(five.variable.MyForm, five.variable.MyKey);
    // return five.success(result);
}

This code seems to run just fine, and return me to the StudyGroups form properly.

However, when I actually choose the field values in the process’ screen fields, then click the run checkmark, these functions are run:

function InsertGroupMember(five, context, result)  {
    
    // make sure we selected member or group
    if (five.field.ParentTable === 'StudyGroups' && !five.field.MemberKey) {
        return five.createError("You must select a member before running this process.");
    }
    if (five.field.ParentTable === 'Members' && !five.field.StudyGroupKey) {
        return five.createError("You must select a study group before running this process.");
    }    
    
    let parms = {
            ParentTable: 'StudyGroupMembers',
            StudyGroupKey: five.field.StudyGroupKey ? `'${five.field.StudyGroupKey}'` : 'NULL',
            MemberKey: five.field.MemberKey ? `'${five.field.MemberKey}'` : 'NULL',
            IsLeader: five.field.isLeader ? 1 : 0,
            IsCoordinator: five.field.isCoordinator ? 1 : 0,
            IsCoLeader: five.field.isCoLeader ? 1 : 0,
            IsAssistant: five.field.isAssistant ? 1 : 0,
            IsSunshine: five.field.isSunshine ? 1 : 0,
            PaidDate: five.field.GroupPaidDate ? `'${five.field.GroupPaidDate}'` : 'NULL',
            CheckNumber: five.field.CheckNumber ? `'${five.field.CheckNumber}'` : 'NULL'
    }
    // five.log('Calling server function');
    five.executeFunction('InsertGroupMemberServer', parms, null, '', '', function (serverResult) {

        if (typeof serverResult.isOk === 'function' && serverResult.isOk()) {
            five.selectAction(five.variable.MyForm, five.variable.MyKey);
        } else {
            const rows = checkResult.rows; // rows is an array
            if (rows && rows.length > 0 && rows[0].ExistingCount > 0) {
                return five.createError("This member is already assigned to this study group.");
        }
        five.showMessage("Insert failed: " + errorMessage);
        }

    });
    // return five.success(result);
}
function InsertGroupMemberServer(five, context, result) {
    
    const newKey = five.uuid();
    const table = context.ParentTable;
    const groupKey = context.StudyGroupKey;
    const memberKey = context.MemberKey;
    const isLeader = context.IsLeader;
    const isCoordinator = context.IsCoordinator;
    const isCoLeader = context.IsCoLeader;
    const isAssistant = context.IsAssistant;
    const isSunshine = context.IsSunshine;
    const paidDate = context.PaidDate;
    const checkNumber = context.CheckNumber;
    
    // if member is already in group, warn and exit
    const checkSQL = `SELECT COUNT(*) AS ExistingCount FROM ${table} WHERE StudyGroupKey = ${groupKey} AND MemberKey = ${memberKey}`;
    const checkResult = five.executeQuery(checkSQL, 0);
    five.log(checkSQL);

    // If the query failed
    if (!checkResult.isOk || !checkResult.isOk()) {
        return five.createError("Could not check for existing member assignment.");
    }

    // If the record already exists
    const rows = checkResult.rows;
    if (rows && rows.length > 0 && rows[0].ExistingCount > 0) {
        return five.createError("This member is already assigned to this study group.");
    }
    const sql1 = `INSERT INTO ${table} ( StudyGroupMembersKey, StudyGroupKey, MemberKey, IsLeader, IsCoordinator, IsCoLeader, 
                    IsAssistant, IsSunshine, GroupPaidDate, CheckNumber ) `;
    const sql2 = `VALUES ( '${newKey}', ${groupKey}, ${memberKey}, ${isLeader}, ${isCoordinator}, ${isCoLeader}, ${isAssistant}, 
                    ${isSunshine}, ${paidDate}, ${checkNumber})`;
    let sql = sql1 + sql2;

    five.log(sql1);
    five.log(sql2);

    const queryResult = five.executeQuery(sql, 0);
    if (queryResult.isOk && queryResult.isOk()) {
        return five.success({ StudyGroupMembersKey: newKey });
    } else {
        let err = "Insert failed.";
        if (queryResult.errorMessage) {
            err = queryResult.errorMessage();
        } else if (queryResult.error) {
            err = queryResult.error;
        } else {
            err = JSON.stringify(queryResult); // fallback for inspection
        }
        five.log("Insert Error: " + err);
        return five.createError("Insert failed: " + err);
    }
}

Notice the code in the InsertGroupMember function that should return me to the original calling form if the insert went ok. This is basically the same code that gets executed when cancelling the process, but it does not return me to the calling form.

Can you please advise why this isn’t working as expected?

UPDATE:
Since nothing visual happens on the process screen when clicking the checkmark, it looks like the new record has not been saved. So the user is tempted to click the checkmark again. This results in multiple member records being added to the study group. Similar to the issue happening when I edit a member in the group, I can click the Return button to go back to the calling form, but this shouldn’t need to be done. There must be a way to immediately get the process to complete and then execute code to return to the calling form. Again, we could really use an After Complete event.