Help

Re: Check Box Script

1330 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Jacob_Taylor1
4 - Data Explorer
4 - Data Explorer

UPDATE I was able to get it working with the below code. However, Interfaces does not allow buttons that run scripts, so I’m back to square one on finding a one-way trigger for the linked record creation.

We have an existing automation to create a linked record based on the action of a user checking a box in a specific field. The problem is that if the box is unchecked and checked again it creates a duplicate linked record.

I would like to replace the box-checking user action with a button, this way the button is one-directional, meaning it can check the box but it can’t uncheck the box. I’m new to scripts and I’m trying to understand how I can make a script that checks the box. I imagine this should be REALLY basic, but I’m struggling to figure it out based on other scripting tutorials I’ve found. I was trying to use the find and replace template as a starting point, but I’m not sure how I would find a null value for a checkbox and then replace it with a check. Any help would be really appreciated!

The script I’m trying is below. I’m getting an error (attached). It says invalid value for field “Move to Prospect” which is a checkbox. Do I need to define the field type?

let table = base.getTable("REQUEST");
let record = await input.recordAsync("Move To Prospect", table);
let recordId = record.id;
await table.updateRecordAsync(recordId, {
    "Move To Prospect" : "true",
})
1 Reply 1
Jacob_Taylor1
4 - Data Explorer
4 - Data Explorer

I was able to get the button working with the below. Unfortunately, I then learned that interfaces does not allow buttons that call any apps, including scripts.

let table = base.getTable("REQUEST");
let record = await input.recordAsync("Move To Prospect", table);
let recordId = record.id;
await table.updateRecordAsync(recordId, {
"Move To Prospect" : true,
})