I created a table that has cells with email templates I want to send. The email templates in specific cells have tags that reference specific records I have chosen. I am trying to pass the email templates to an If Then statement in a script but the output it puts is with the tags instead of the record information.
Below you can see the script, followed by the output, followed by the output I want. Do you have any idea how to fix this?
SCRIPT
// Change this name to use a different table
let deals = base.getTable(“Deals”);
let templates = base.getTable(“Templates”);
// Prompt the user to pick a record from deals then from templates
// If this script is run from a button field, this will use the button’s record instead.
output.text(“Templates matched with Records”)
let record = await input.recordAsync(‘Select a record to use’, deals);
let temp = await input.recordAsync(‘Select a template to use’, templates);
// You can use temp.getCellValue("Field name") to access the template
var selectedTemp = temp.getCellValueAsString(“written template”);
console.log(selectedTemp)
// Customize this section to handle the selected record
if (record) {
// cell values from the template
output.markdown(selectedTemp);
} else {
let record = await input.recordAsync(‘Select a record to use’, deals);
}
OUTPUT
Congrats you have been approved for: ${record.name}.
At lease signing we will need the following certified bank checks:
- ${record.getCellValueAsString(“Price”)} made out to “${record.getCellValueAsString(“Entity (from Property Info)”)}” for the first month of rent
- ${record.getCellValueAsString(“Price”)} made out to “${record.getCellValueAsString(“Entity (from Property Info)”)}” for the one month security deposit
Thanks,
OUTPUT I WANT
Congrats you have been approved for: 555 East 78th Street.
At lease signing we will need the following certified bank checks:
- $5000 made out to “REAL ESTATE ENTITY” for the first month of rent
- $5000 made out to “$REAL ESTATE ENTITY” for the one month security deposit
Thanks,
