【kintone】Google 양식에서 레코드 등록
10635 단어 googleform금과gas
라고 알고, 시도한 기록입니다.
참고 페이지:
Google 양식과 kintone을 함께 사용해 보세요!
kintone과 Google Apps Script 협력
kintone 앱 만들기
이런 식으로 만듭니다.

필드
필드 이름
필드 코드
문자열 (1 행)
필수
문자열 (1 행)
이름
이름
필수
라디오 버튼
참여/불참
attend
필수, 참여/불참
※메일 주소는 나중에 updateKey로 하고 싶다고 생각해, 문자열(1행)으로 해 보았습니다.
API 토큰 생성 및 복사
API 토큰을 생성하고 '레코드 추가'를 선택합니다.

Google 양식 작성
※Google 양식의 자세한 작성 방법은 여기에서는 생략합니다 m(_ _)m
이메일 주소를 수집하도록 설정
(1) 기어 버튼을 클릭

(2)메일 주소를 수집하기로 체크(응답의 카피를 송신에 체크 넣어도 좋을지도)

(3) 메일 주소 입력란이 생겼다.

이름란 작성

참가/불참가란 작성

gas 쓰기
이미지처럼 조작하여 스크립트 편집기를 표시합니다.

라이브러리 및 매니페스트 파일 설정
↓여기의 Step 9와 Step 10을 참고로 라이브러리와 매니페스트 파일의 설정을 합니다.
Google 양식과 kintone을 함께 사용해 보세요!
코드 작성
이전의 developer network 사이트의 step 11 코드를 참고로 아래와 같이 써 둡니다.
를 사용 환경에 맞추십시오.
forEach나 애로우 연산자도 사용할 수 있는 것 같다.
function getFormResponse(e) {
'use strict';
//アンケートの回答を取得
const itemResponses = e.response.getItemResponses();
//追加するレコード作成
let record = {};
record["Email"] = {"value": e.response.getRespondentEmail()};
itemResponses.forEach(item => {
switch (item.getItem().getTitle()) {
case "名前":
record["name"] = {"value": item.getResponse()};
break;
case "参加/不参加":
record["attend"] = {"value": item.getResponse()};
break;
}
});
//recordを配列にして返す
return [record];
}
function sendToKintone(e) {
'use strict';
const subdomain = "サブドメイン";//.cybozu.comの前のサブドメイン名
const apps = {
YOUR_APPLICATION: { appid: アプリID, name: "アプリの名前", token: "さっきコピーしたAPIトークン" }
};
const manager = new KintoneManager.KintoneManager(subdomain, apps);// ライブラリの初期化
const records = getFormResponse(e);
const response = manager.create("YOUR_APPLICATION", records);//kintone レコードの生成
// ステータスコード
const code = response.getResponseCode();
}
트리거 설정
(1) "편집 → 현재 프로젝트 트리거"를 클릭

(2) 오른쪽 하단의 "트리거 추가"

(3) 실행할 함수를 선택하고, 상기 코드를 그대로 사용하는 경우는 「sendToKintone」
이벤트 유형을 선택하고 양식을 제출할 때를 선택하고 저장을 클릭합니다.

설문조사 보내기
설문지에 입력하고 제출 버튼을 클릭합니다.

kintone 앱에 반영 되었습니까?

요약
Google 설문지와 kintone을 함께 사용하려면,
앱에 맞게 양식을 작성하거나 코딩해야 합니다.
좀처럼 힘들지만, 약간의 폼을 하나 원해, 계속적으로는 불필요한 경우에는 만들어 보는 것은 어떻습니까? ?
또, 간단하게 폼 제휴를 할 수 있는 서비스등도 있으므로 시험해 보는 것도 좋을지도 모릅니다^0^!
그럼!
Reference
이 문제에 관하여(【kintone】Google 양식에서 레코드 등록), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/juri_don/items/cfe95dbd884e89838a24텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)