Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GAS-070] Error _onFormSubmit when have the new request #2

Open
tuanngocptn opened this issue Jul 17, 2023 · 15 comments
Open

[GAS-070] Error _onFormSubmit when have the new request #2

tuanngocptn opened this issue Jul 17, 2023 · 15 comments

Comments

@tuanngocptn
Copy link

Hello I have some problem when running on GAS-070 (https://github.com/ashtonfei/google-apps-script-projects/tree/GAS-070).
.
Some user missing additional value like _uid, _status, _response_id, _approver_1, _approver_2.

So I found the reason. Sometimes, the additional value inserted wrong area. That inserted in the before line.

image

Like the image above UID-00059 must fill in the next line. But it replace the UID-00058 area.

That will make some error of system when we run the application in flow.

Thanks for read. And hope that will fix soon.

@tuanngocptn
Copy link
Author

Hello @ashtonfei.
Did you read this issue.
Thanks

@ashtonfei
Copy link
Owner

@tuanngocptn Is it always replace the line above the actual response line? If it only happens to some responses, we'll need more investigation.

@tuanngocptn
Copy link
Author

tuanngocptn commented Jul 24, 2023

Hello Ashtonfei
I'm apply this form for my team. And hope that will fix soon.
Thanks @ashtonfei for response.

@ashtonfei
Copy link
Owner

@tuanngocptn Were the responses 58 and 59 submitted very closely? Like almost the same time?

@tuanngocptn
Copy link
Author

tuanngocptn commented Jul 24, 2023

This problem happens quite often.

image

.

.

And this is error is showing on the Executions report.

image

Thanks @ashtonfei

@tuanngocptn
Copy link
Author

Nope. I don't think so, Cus I checked in the timestamp column. Most of them are not in the same time.

image

@ashtonfei
Copy link
Owner

I updated the onOpen function to fix the permission issue on creating triggers. You will need to install the trigger manually.

function onOpen() {
  // const trigger = createTrigger(); // removed
  const ui = FormApp.getUi();
  const menu = ui.createMenu("Approval");
  menu.addItem("Reset UID", "resetUid");
  menu.addItem("Install trigger", "createTrigger"); // added
  menu.addToUi();
}

@tuanngocptn
Copy link
Author

tuanngocptn commented Jul 24, 2023

I updated the onOpen function to fix the permission issue on creating triggers. You will need to install the trigger manually.

function onOpen() {
  // const trigger = createTrigger(); // removed
  const ui = FormApp.getUi();
  const menu = ui.createMenu("Approval");
  menu.addItem("Reset UID", "resetUid");
  menu.addItem("Install trigger", "createTrigger"); // added
  menu.addToUi();
}

Hello.

I just added this trigger after changed the code.

image

I will send you the result after several days.

Really thanks @ashtonfei

@tuanngocptn
Copy link
Author

Hi @ashtonfei

after several day running.

Seem like problem still there

Do you have any idea for fix that.

image

Thanks

@tuanngocptn
Copy link
Author

Hello @ashtonfei. Are you still following this issue. Thanks

@ashtonfei
Copy link
Owner

@tuanngocptn I checked the code, I think there is a defect with the logic in my original design that the script is always checking the last row when there is a submission. Is response edit allowed in your form? In current logic, the response edit could trigger the script to overwrite the last row in the sheet.

@tuanngocptn
Copy link
Author

tuanngocptn commented Aug 8, 2023

@tuanngocptn I checked the code, I think there is a defect with the logic in my original design that the script is always checking the last row when there is a submission. Is response edit allowed in your form? In current logic, the response edit could trigger the script to overwrite the last row in the sheet.

Hello @ashtonfei

Is response edit allowed in your form? => sorry I don't get the point of this question. I just configure like your video in youtube.

I think there is a defect with the logic in my original design that the script is always checking the last row when there is a submission => Can we change to update by timestamp column instead of "last row". I think timestamp column is unique column now.

Thanks

@ashtonfei
Copy link
Owner

If form response edit is enabled, we have will have the issue on the last row when an edit submission happens. We'll need to change the trigger to Spreadsheet On Form Submit, in this type of trigger, we can access the row number which the response is saved to.
image

@tuanngocptn
Copy link
Author

tuanngocptn commented Aug 9, 2023

I just checked the Responses setting and It all have off already before. Seem like that is not the core problem
As you mention we need to change the trigger. For updating exactly the row.
So, Can I help you for do something? For dealing with this problem faster.
Thanks @ashtonfei

@prateek21865
Copy link

Hey @ashtonfei I want to import some other data from a sheet1 which is in the same spreadsheet having form responses 1. I want add 2 -3 data values in the task object. What I have to do.. please suggest me..and after approving the email the data gets reflected to that sheet only where the data is been Imported...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants