Google Group Member Deletion

Deletes members (email address) from Google Group. It is possible to respond to email newsletter delivery cancellation, or to delete automatically from the group when employees move or leave the company.

    A. Set OAuth2 Config Name (at [OAuth 2.0 Setting])Single-line inputRequired
    B. Select STRING/CHECKBOX for Group Address (Non-existent Error)Data selectString(single line)orSelect(check box)Required
    C. Select STRING DATA for Email to DeleteData selectString(single line)Required
    X. Select STRING DATA for Access Log (update)Data selectString(multiple line)
    -variable namevariable label
    Aconf_OAuth2Set OAuth2 Config Name (at [OAuth 2.0 Setting])
    Bconf_DataIdBSelect STRING/CHECKBOX for Group Address (Non-existent Error)
    Cconf_DataIdCSelect STRING DATA for Email to Delete
    Xconf_DataIdXSelect STRING DATA for Access Log (update)
    // Google Group member delete via Admin SDK Directory API (ver. 20170704)
    // (c) 2017, Questetra, Inc. (the MIT License)
    
    //// == 工程コンフィグの参照 / Config Retrieving ==
    var oauth2  = configs.get( "conf_OAuth2" ) + "";
    var dataIdB = configs.get( "conf_DataIdB" ); // (returns key)
    var dataIdC = configs.get( "conf_DataIdC" ); // (returns key)
    var dataIdX = configs.get( "conf_DataIdX" ); // (returns key)
    
    //// == ワークフローデータの参照 / Data Retrieving ==
    var targetGroups = [];
    var dataDefB = engine.findDataDefinitionByNumber( dataIdB );
    if( dataDefB.matchDataType("SELECT_CHECKBOX") ){
      var selectedGroups = data.get( dataIdB );
      for( var i = 0; i < selectedGroups.size(); i++ ){ // java.util.ArrayList
        var pushGroup = selectedGroups.get(i).getValue() + "";
        targetGroups.push( pushGroup );
      }
    }else{
      var pushGroup = data.get( dataIdB ) + "";
      targetGroups.push( pushGroup );
    }
    var memberEmail = data.get( dataIdC ) + "";
    
    //// == 演算 / Calculating ==
    var accessLog = "";
    var token = httpClient.getOAuth2Token( oauth2 );
    
    for( var i = 0; i < targetGroups.length; i++  ){ // javascript array
      var uri = "https://www.googleapis.com/admin/directory/v1/groups/" + targetGroups[i] + "/members/" + memberEmail;
      var response = httpClient.begin()
        .bearer( token )
        .delete( uri );
      accessLog += "---DELETE request--- " + response.getStatusCode() + "\n";
      accessLog += response.getResponseAsString() + "\n";
    }
    
    //// == ワークフローデータへの代入 / Data Updating ==
    if( dataIdX !== "" ){
      retVal.put( dataIdX, accessLog );
    }
    

    • B’: Email addresses in Google Group stored in the data item selected at config B
    • C’: Email address stored in the data item selected at config C
    • The email address of C’ is deleted from Google Group of B’
    • The communication logs are stored in the data item selected at config X