Help

Create new record in table based on conditions in other table

Topic Labels: Extensions
Solved
Jump to Solution
1653 1
cancel
Showing results for 
Search instead for 
Did you mean: 
Alissa_Chisholm
5 - Automation Enthusiast
5 - Automation Enthusiast

Hello!

I’ve got a few questions that I’m having a hard time figuring out the best approach to solve or if it can be solved easily (very much not a JS person)… I want to create a record in a table based on conditions from the original table. The new record should copy information from the original table that are held as different field types.

Something like this:

Conditions for new record:
If xTeam is in thisField, then create new record in otherTable

Data to be copied:
thisTable.launchDate = otherTable.liveDate
thisTable.activityDescription = otherTable.description
thisTable.launch = otherTable.launch --> (this is currently a lookup between the two tables where otherTable looks up thisTable)
thisTable.activityOwner = otherTable.requestor --> (this is currently a lookup from a 3rd table)

write otherTable.status as request

Is this feasible in the scripting block? and are there any good examples/resources on the types of functions to write to execute this?

I’m also concerned about duplicate records, I would want to run this script weekly - is it possible to only run a script on a particular view (e.g. filtering for records created within a certain time period)

1 Solution

Accepted Solutions
kuovonne
18 - Pluto
18 - Pluto

This is quite possible with scripting block.

When you get the records from thisTable, you can get records from only a specific view. Use SelectRecordsAsync on the view instead of the table.

Are the lookup values the ones that will change field type? What is the new field type? You might have to play around a bit to get the lookup values in the format you want. The documentation used to state that the read format of lookup fields was unstable. It now says that the read format of lookups is an array.

See Solution in Thread

1 Reply 1
kuovonne
18 - Pluto
18 - Pluto

This is quite possible with scripting block.

When you get the records from thisTable, you can get records from only a specific view. Use SelectRecordsAsync on the view instead of the table.

Are the lookup values the ones that will change field type? What is the new field type? You might have to play around a bit to get the lookup values in the format you want. The documentation used to state that the read format of lookup fields was unstable. It now says that the read format of lookups is an array.