Update an existing row on a table in area120 via a form

I have a request process outlined

1. Form filled out adds a row of information - Status: New Request

2. New Request Status activates a bot that generates an email to review/update

3. Status changed to Reviewed/Updated

4. Reviewed/Updated Status change activates a bot to send an email with an approval form to the approver

Problem:

The form does not update the Status it adds new row with the Status: Approved or Denied.

I'm trying to get the Approver to be able to Approve or Deny via email generated from the Status change and update the correct row.

I've tried a few things... but nothing has worked... I'm trying to write a script but no luck yet.

Solved Solved
0 8 1,405
1 ACCEPTED SOLUTION

The solution which was found collaborating with @cwlind was a Bot which activated an App Script. Sample Code below. Many thanks to Clark for his continued help in my pursuit of solutions.

Process:

A Form is filled out and submitted from Table B

The addition of a row in Table B activates a bot and the script to update a specific column in a specific row in Table A.

function approval_date_process(tableId,recordIdnewValue) {
  var linkedRecordName = 'tables/' + tableId + "/rows/" +  recordId;
  var columnName = 'Approval Date';            
  var newValue = newValue;
  update_recordlinkedRecordNamecolumnName,newValue);
}

//no changes below this line
function update_record(recordNamecolumnNamenewValue){
  Logger.log('update:'recordNamecolumnNamenewValue);

  // We need to pass along an object that specifies the column we want to
  // update, and what the new value of the column is.
  var updatedColumnValues = {};
  updatedColumnValues[columnName] = newValue;
;

  // We call the Tables API using the Area120Tables Apps Script bean.
  var response = Area120Tables.Tables.Rows.patch({valuesupdatedColumnValues}, recordName);
  Logger.log("response:" + JSON.stringify(response)); // Log the response
}
and Job Done.

View solution in original post

8 REPLIES 8

I can look at it.. But I am not working in sheets. I am working in Tables. I'm trying to adapt this (https://support.google.com/area120-tables/answer/10621982) to my needs right now, I just can't get the values correct for a type:dropdown and then have it update the correct table, without using different tables and adding rows and deleting rows. If I was a coder it would be easier, I'm just researching and fumbling through it. I appreciate your suggestion.

Unfortunately I donโ€™t believe Tables are support as core products, as is the case with most Area120 tools so I am not that familiar with them but it looks like it is using app scripts. Users like @dominik and others are pretty good with app scripts but I am not ๐Ÿ˜”

Thank you for the input and user suggestion good with app scripts

So Google Tables are not (yet) part of the Google Cloud core services but Google did say that the Cloud Team is taking this over.  I do believe that rather than building a new product, Google will implement its functionality in Google Sheets. 

And as Google Tables is not really supported across the globe (I have to use a VPN :|) I have not worked with it yet. 

I believe that it may be possible with Google Sheets and Apps Script though.  Sadly I haven't been working on scripts much, recently. 

Thank you for the quick response. I'll keep working at it.

The solution which was found collaborating with @cwlind was a Bot which activated an App Script. Sample Code below. Many thanks to Clark for his continued help in my pursuit of solutions.

Process:

A Form is filled out and submitted from Table B

The addition of a row in Table B activates a bot and the script to update a specific column in a specific row in Table A.

function approval_date_process(tableId,recordIdnewValue) {
  var linkedRecordName = 'tables/' + tableId + "/rows/" +  recordId;
  var columnName = 'Approval Date';            
  var newValue = newValue;
  update_recordlinkedRecordNamecolumnName,newValue);
}

//no changes below this line
function update_record(recordNamecolumnNamenewValue){
  Logger.log('update:'recordNamecolumnNamenewValue);

  // We need to pass along an object that specifies the column we want to
  // update, and what the new value of the column is.
  var updatedColumnValues = {};
  updatedColumnValues[columnName] = newValue;
;

  // We call the Tables API using the Area120Tables Apps Script bean.
  var response = Area120Tables.Tables.Rows.patch({valuesupdatedColumnValues}, recordName);
  Logger.log("response:" + JSON.stringify(response)); // Log the response
}
and Job Done.

This is a little more complex than what I'm trying to do, but would love to understand it more so that maybe it can help me with functions I'm trying to make. I'm having difficulty understanding the basic code as I'm a super noob. I've only done Dart and Flutter coding tutorials so far, so I'm having trouble following the variables in your solution. 

Where do the inputs for your functions come from? Are they coming from the bot function parameters from your Tables? Sorry if this is so basic, but I'm finding it hard to find tutorials, maybe because its still beta.