TypeError: Cannot read properties of undefined (reading 'Parameters') doPost @ Code.gs:11

314 views
Skip to first unread message

Vishesh Patel

unread,
Jun 10, 2023, 5:39:11 AM6/10/23
to Google Apps Script Community
Can any one help me in this...here is my code
 

  let InvSheet = MySheet.getSheetByName("Inv");


function doPost(e) {

  var e;
 

  let inv = e.Parameters;
  let Qtys = inv.qty;

  InvSheet.appendRow([inv.inv_no[0], inv.inv_dt[0], inv.cust_nm[0], inv.inv_addr[0], inv.inv_city[0]]);

  Qtys.forEach(function (value, index){
    InvSheet.appendRow(["","","","","", inv.inv_nm[index], value, inv.inv_rate[index], inv.inv_amount[index]]);
  });

  return ContentService.createTextOutput("INVOICE SUBMITTED");
}

Jorge Forero

unread,
Jun 10, 2023, 7:29:16 AM6/10/23
to Google Apps Script Community
Replace e.Parameters with e.parameters

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/a1f63b54-4cf3-4f0a-b1da-7c8c9d8c73adn%40googlegroups.com.

Emerson Maia

unread,
Jun 10, 2023, 9:52:45 AM6/10/23
to google-apps-sc...@googlegroups.com
maybe something will solve

const InvSheet = MySheet.getSheetByName("Inv");

function doPost(e) {
  const inv = e.parameters;
  const Qtys = inv.qty;

  InvSheet.appendRow([inv.inv_no[0], inv.inv_dt[0], inv.cust_nm[0], inv.inv_addr[0], inv.inv_city[0]]);

  Qtys.forEach(function (value, index) {
    InvSheet.appendRow(["", "", "", "", "", inv.inv_nm[index], value, inv.inv_rate[index], inv.inv_amount[index]]);
  });

  return ContentService.createTextOutput("INVOICE SUBMITTED");
}

--

Brett Grear

unread,
Jun 10, 2023, 11:09:26 AM6/10/23
to Google Apps Script Community

When you call var e; I think that removes the parameters and reinitialises the e variable. Get rid of that line. Also think it should be parameters with a lower case p
Reply all
Reply to author
Forward
0 new messages