Kintone Batch acquisition of Two rows data

Stores the value of the field code of two columns of the specified kintone application into a data item respectively, and stores its communication log in a String type data item.

    A. Set Sub-Domain (https://{subdomain}.kintone.com/)Single-line inputRequired
    B. Set App-ID (/k/"3"/)Single-line inputRequired
    C. Set Api-TokenSingle-line inputRequired
    D. Select STRING/SELECT for a Field-Code of Choice-IDsData selectString(single line)orSelect(radio/select/search)Required
    E. Select STRING/SELECT for a Field-Code of LabelsData selectString(single line)orSelect(radio/select/search)Required
    F. Select STRING DATA for Choise-IDs (update)Data selectString(multiple line)Required
    G. Select STRING DATA for Labels (update)Data selectString(multiple line)Required
    H. Select STRING DATA for Access Log (update)Data selectString(multiple line)
    -variable namevariable label
    Aconf_SubDomainSet Sub-Domain (https://{subdomain}.kintone.com/)
    Bconf_AppIdSet App-ID (/k/"3"/)
    Cconf_ApiTokenSet Api-Token
    Dconf_DataIdDSelect STRING/SELECT for a Field-Code of Choice-IDs
    Econf_DataIdESelect STRING/SELECT for a Field-Code of Labels
    Fconf_DataIdFSelect STRING DATA for Choise-IDs (update)
    Gconf_DataIdGSelect STRING DATA for Labels (update)
    Hconf_DataIdHSelect STRING DATA for Access Log (update)
    // Batch to Get Data via Kintone REST API (ver. 20160921)
    // (c) 2016, Questetra, Inc. (the MIT License)
    
    //// == 工程コンフィグの参照 / Config Retrieving ==
    var subDomain = configs.get( "conf_SubDomain" );
    var appId     = configs.get( "conf_AppId" );
    var apiToken  = configs.get( "conf_ApiToken" );
    var dataIdD = configs.get( "conf_DataIdD" ); // (returns Number)
    var dataIdE = configs.get( "conf_DataIdE" ); // (returns Number)
    var dataIdF = configs.get( "conf_DataIdF" ); // (returns Number)
    var dataIdG = configs.get( "conf_DataIdG" ); // (returns Number)
    var dataIdH = configs.get( "conf_DataIdH" ) + ""; // (returns Number)
    
    //// == ワークフローデータの参照 / Data Retrieving ==
    var fieldCodeI = "";
    if( data.get( dataIdD ) instanceof java.util.ArrayList ){
      fieldCodeI = data.get( dataIdD ).get(0).getValue() + "";
    }else if( data.get( dataIdD ) instanceof java.lang.String ){
      fieldCodeI = data.get( dataIdD ) + "";
    }
    var fieldCodeL = "";
    if( data.get( dataIdE ) instanceof java.util.ArrayList ){
      fieldCodeL = data.get( dataIdE ).get(0).getValue() + "";
    }else if( data.get( dataIdE ) instanceof java.lang.String ){
      fieldCodeL = data.get( dataIdE ) + "";
    }
    
    //// == 演算 / Calculating ==
    var accessLog = "";
    var responseJson = "";
    
    var choiseIds = "";
    var choiseLabels = "";
    
    try{
      var uri = "https://";
      uri += subDomain;
      uri += ".cybozu.com/k/v1/records.json";
    
      var response = httpClient.begin()
        .header("X-Cybozu-API-Token", apiToken )
        .queryParam( "app", appId )
        .queryParam( "fields[0]", fieldCodeI )
        .queryParam( "fields[1]", fieldCodeL )
        .queryParam( "query", "order by " + fieldCodeI + " asc" )
        .get( uri ); 
      accessLog += "---GET request--- " + response.getStatusCode() + "\n";
      responseJson = response.getResponseAsString();
      if( response.getStatusCode() == 200 ){
        var jsonObj = JSON.parse( responseJson );
        for( var i = 0; i < jsonObj.records.length; i++ ){
          choiseIds += jsonObj.records[i][fieldCodeI].value + "\n";
          choiseLabels += jsonObj.records[i][fieldCodeL].value + "\n";
        }
      }
    }catch(e){
      accessLog += e.message + "\n";
    }
    // for Debug
    // accessLog += responseJson + "\n";
    
    //// == ワークフローデータへの代入 / Data Updating ==
    retVal.put( dataIdF, choiseIds );
    retVal.put( dataIdG, choiseLabels );
    if( dataIdH !== "" ){
      retVal.put( dataIdH, accessLog );
    }
    

    • D’: Field Code stored in the Data Item selected at D
    • E’: Field Code stored in the Data Item selected at E
    • The values in Field code of D’ and ‘E in Kintone application B’ will be respectively stored in the Data Items that are selected at F and G
    • The communication logs are stored in the data item selected at H
    • You cannot specify fields which is an array-value or contains line-break code
    • Field Code for “Record Number” should be specified as “$id”