Issue with Google Forms Integration

 

Hi there, hive mind!

I’ve been trying to set up Google Form Linking with Kintone as per this tutorial and am getting the following error in execution transcript:

[18-04-24 10:43:18:210 EDT] FormApp.getActiveForm() [0.218 seconds]
[18-04-24 10:43:18:307 EDT] Starting execution
[18-04-24 10:43:18:338 EDT] Logger.log([Form submitted, ]) [0.001 seconds]
[18-04-24 10:43:18:346 EDT] FormResponse.getItemResponses() [0.007 seconds]
[18-04-24 10:43:18:347 EDT] FormResponse.getRespondentEmail() [0 seconds]
[18-04-24 10:43:18:350 EDT] ItemResponse.getItem() [0 seconds]
[18-04-24 10:43:18:412 EDT] Item.getTitle() [0.061 seconds]
[18-04-24 10:43:18:413 EDT] ItemResponse.getResponse() [0 seconds]
[18-04-24 10:43:18:414 EDT] ItemResponse.getItem() [0 seconds]
[18-04-24 10:43:18:483 EDT] Item.getTitle() [0.068 seconds]
[18-04-24 10:43:18:484 EDT] ItemResponse.getResponse() [0 seconds]
[18-04-24 10:43:18:487 EDT] ItemResponse.getItem() [0 seconds]
[18-04-24 10:43:18:546 EDT] Item.getTitle() [0.059 seconds]
[18-04-24 10:43:18:576 EDT] ItemResponse.getResponse() [0 seconds]
[18-04-24 10:43:18:578 EDT] ItemResponse.getItem() [0 seconds]
[18-04-24 10:43:18:639 EDT] Item.getTitle() [0.06 seconds]
[18-04-24 10:43:18:641 EDT] ItemResponse.getItem() [0 seconds]
[18-04-24 10:43:18:705 EDT] Item.getTitle() [0.063 seconds]
[18-04-24 10:43:18:706 EDT] ItemResponse.getItem() [0 seconds]
[18-04-24 10:43:18:770 EDT] Item.getTitle() [0.064 seconds]
[18-04-24 10:43:18:772 EDT] ItemResponse.getItem() [0 seconds]
[18-04-24 10:43:18:836 EDT] Item.getTitle() [0.063 seconds]
[18-04-24 10:43:18:837 EDT] ItemResponse.getItem() [0 seconds]
[18-04-24 10:43:18:899 EDT] Item.getTitle() [0.061 seconds]
[18-04-24 10:43:18:901 EDT] ItemResponse.getItem() [0 seconds]
[18-04-24 10:43:19:011 EDT] Item.getTitle() [0.11 seconds]
[18-04-24 10:43:19:014 EDT] ItemResponse.getItem() [0.001 seconds]
[18-04-24 10:43:19:081 EDT] Item.getTitle() [0.066 seconds]
[18-04-24 10:43:19:082 EDT] Logger.log([Response JSON is “%s”, [[{“reporter_email”: { “value”: “meg.hillmann@unitedwayswpa.org” },“reporter” : { “value”: “Meg Hillmann” },“form” : { “value”: “Test 5” },“priority” : { “value”: "Form will be use]]…) [0 seconds]
[18-04-24 10:43:19:088 EDT] Execution failed: SyntaxError: Unexpected comma in object literal (line 41, file “sendToKintone”) [0.749 seconds total runtime]

I literally copied and pasted the script and adjusted field names… Any ideas what went wrong?

 

Hi Meg,

Sorry but I could not find how you got this error exactly from the error messages.

However, I see from the last line of the messages as below.
 
“Execution failed: SyntaxError: Unexpected comma in object literal (line 41, file “sendToKintone”) [0.749 seconds total runtime]”

There is SyntaxError and sendToKintone might have some issue on line 41 due to “Unexpected comma”.

 

If you just copy from the sample code from “step 3” on the tutorial, I wonder how you got the error with line 41, which include “var records = JSON.parse(str)”.

Actually, I have tried this tutorial by myself and I was able to accomplish this without any issue.

 

What I have revised is as below.

 

-On line 34, I changed “subdomain” to my subdomain address.

var subdomain = ‘{subdomain}.kintone.com’; // change URL to your kintone domain

 

-On line 36, I changed the information after “appid:”, “number:” and "token: ". 
YOUR_APPLICATION1: { appid: 1, name: ‘Kintone Connect’, token: ‘xxxxxxxxx’ }
    };

 

If I were you, I would double check line 41 on the coding.

 

Hope it helps.

Thanks.

Junko

It seems the error is originated from parsing JSON string.

Did you check the contents of variable “str”?

I suspect there is a double quote( " ) in the text value. 

Can you try the following code in line 40?

str = str.replace(//g, “\n”).replace(/\r/g, “\r”).replace(/\t/g, “\t”).replace(/"/g, “’”);//Add a method to replace a double quote to a single quote 

Hello Junko, 

I tried to follow this tutorial as well, but i could not successfully registered the data in Kintone.

  1. Does the value of the subdomain variable = {sampledomain}.kintone.com? 

Parenthesis is not removed?

Sorry to cut in here. Thank you.

Hi Kimmy,

No worries!

You are right that "{}"curly brackets should not be included in this case.

If your subdomain is “sampledomain”, here is how you can assign the value to the subdomain variable as below.

var subdomain = 'sampledomain.cybozu.com';

Thank you for asking!

Junko