Dec 17, 2022 10:17 AM
My record has a field that's named 'Automation history' which is where i want my scripts to keep a log whenever it does some changes, i keep this to identify errors etc. But the issue is that it get's replaced, is there any way to .push that value there instead of overwrite? All the other code i want to keep as is.
This is my code:
let createOpportunity = await tableOpportunities.createRecordAsync({
'Opportunity Name': orgName,
'Organization number': orgNumber,
'Company Type': orgType,
'Foretaksregistret': orgRegisterDate,
'Kommune': orgKommune,
'Postnummer': orgPostNummer,
'Automation history': "Record created at " + yyyy + '-' + mm + '-' + dd + " , fetching infomation from this link: " + opportunityGenerator + "\n "
});
Solved! Go to Solution.
Dec 17, 2022 09:31 PM
Hi @Ruben_Rossvold ,
Your code seems to be creating a new record. If you would like to append to it some information you could do it this way:
let updateOpportunity = await tableOpportunities.createRecordAsync(record.id,{
'Automation history': "Update to record automation history: " + updatevalue +"\n" + record.getCellValue("Automation history")
});
This update will replace the value of 'Automation history' with new value, but you are also attaching the old value to it so, it will keep the historical content.
Let me know if this helps?
Dec 17, 2022 09:31 PM
Hi @Ruben_Rossvold ,
Your code seems to be creating a new record. If you would like to append to it some information you could do it this way:
let updateOpportunity = await tableOpportunities.createRecordAsync(record.id,{
'Automation history': "Update to record automation history: " + updatevalue +"\n" + record.getCellValue("Automation history")
});
This update will replace the value of 'Automation history' with new value, but you are also attaching the old value to it so, it will keep the historical content.
Let me know if this helps?
Dec 18, 2022 07:28 AM
Heh grabbed the wrong line there sorry, the above one is the one which is creating the record, and this below calls another api to update some of the created records one week later.
await tableOpportunities.updateRecordAsync(record, {
'Owner': personNavn + " " + personEtternavn,
'Automation history': record.getCellValue("Automation history") + yyyy + '-' + mm + '-' + dd + "\n " + "Added owner name \n"
})
}
I did like you wrote and it worked, thanks so much!