I think you could just write this as:
```js
var contactIds = dataset.contactId || null;
```