-
-
Save HeadStudios/98c8837c02a0fb8540e3e36333281945 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let inputConfig = input.config(); | |
// Get the record ID from the input | |
var recordId = inputConfig['rec_id']; | |
let table = base.getTable("Touchpoints"); | |
let fields = table.fields; | |
let view = table.getView("Callback List"); | |
let query = await table.selectRecordsAsync(); | |
let original = query.getRecord(recordId); | |
console.log(original.getCellValue('Email')); | |
const main = async (original) => { | |
let obj = {} | |
filteredFields.forEach(fld => { | |
switch(fld.name) { | |
case "Start Date/Time": | |
const startDate = new Date(original.getCellValue(fld.name)) | |
startDate.setHours(startDate.getHours() + utc_offset) | |
const newStartDate = new Date(startDate.getTime()) | |
newStartDate.setDate(newStartDate.getDate() + 1) | |
while (newStartDate.getDay() !== 1) | |
newStartDate.setDate(newStartDate.getDate() + 1) | |
const newEndDate = new Date(newStartDate.getTime()) | |
newEndDate.setDate(newEndDate.getDate() + 5) | |
obj["Start Date/Time"] = newStartDate | |
break | |
default: | |
obj[fld.name] = original.getCellValue(fld.name) | |
} | |
}) | |
await table.createRecordAsync(obj) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment