Creating a blank record via code studio

In the code studio I can use to create a new record. I can’t figure out how to do this however where I don’t want to set any properties in the record. The data input is required for, and passing an empty value for this causes the function to return no result.

I have several examples where I need to do this because the record itself has no properties (for example a record that exists only to define a set of relationships, or an API request object). The way that I’ve been working around this so far is to add a “dummy” property to the object and set a value in that, but this seems a very basic thing to need to workaround and clutters up my code. Is there another way to do this? Something that I’m missing here?

Hi Dylan,

You can pass in an object with the ‘id’ key set to null to create an empty record. I’ve put below the code for the function that we use to create empty records.

function createEmptyRecord(objectID) {
    let saveResult =, {':id': null});
    let newRecordID = saveResult.records.base.record_id;
    return cs.record(newRecordID);

Happy with that solution, thanks Ewan!

1 Like