App Script and Data

Hi All, I am trying to recall a data item in the App Script. Here is what I have:

 

var timeZone = Session.getScriptTimeZone();
var Data = {
Id: Id
}
const payload = JSON.stringify({ text: "Site Manager - DMS Services - Please Re-Synchronise - TEST POST - "+ Data + " "+Utilities.formatDate(new Date(), timeZone, "dd-MM-yyyy | HH:mm:ss")});
 
Domearian_0-1710835259966.png

What do I need to set in the Data variable to read the parameter [Id]?

Solved Solved
1 2 66
1 ACCEPTED SOLUTION

I did actually manage to resolve the issue. To recall the data this is what is required:

function sendMessage(ID,DATEI){
 
The data needs to be called within the function call. Then the data can be fed into the const:
const payload = JSON.stringify({ text: "Site Manager - DMS Services - Please Re-Synchronise - "+ (ID) + " - "+(DATEI)+"

View solution in original post

2 REPLIES 2

In your script, you access the value that was passed into the parameter through the parameter argument:

  • In your example: Parameter1

So your code to build the data object would be:

var Data = {
Id: Parameter1
}

_______________________________________________________________________

Here's a link to the first of a series of apps that shows how to create an app that integrates generative Ai: https://www.appsheet.com//templates/ChatGPT-in-AppSheet?appGuidString=07b05f62-3865-4e9a-823c-a08640...

Inside there you can see:

  • How the app is configured to call the script
  • How the script is configured to accept the values from AppSheet
  • How the script returns values (in case you need to do that too)
  • How AppSheet accepts values back

NOTE: this app is built around an older OpenAi model that's no longer in use.  But that's not the point; the point is to demonstrate how to use scripts. ๐Ÿ˜‰ 

I did actually manage to resolve the issue. To recall the data this is what is required:

function sendMessage(ID,DATEI){
 
The data needs to be called within the function call. Then the data can be fed into the const:
const payload = JSON.stringify({ text: "Site Manager - DMS Services - Please Re-Synchronise - "+ (ID) + " - "+(DATEI)+"
Top Labels in this Space