UXP Script DataMerge

Hello everybody,

I am beginner with UXP Script for Indesign. I have a problem with function Data Merge. I don’t know how change settings for ONE RECORD from list

In ExtendScript this is OK: doc.dataMergeProperties.dataMergePreferences.recordSelection = RecordSelection.ONE_RECORD;

but in uxp not function.

Can you help my please?
Thank you for answer.

The correct location of RecordSelection object must be referenced.

const InDesign = require('indesign') ;
const { app } = InDesign ;
const doc = app.activeDocument ;
doc.dataMergeProperties.dataMergePreferences.recordSelection = InDesign.RecordSelection.ONE_RECORD ;

or

const InDesign = require('indesign') ;
const { app, RecordSelection } = InDesign ;
const doc = app.activeDocument ;
doc.dataMergeProperties.dataMergePreferences.recordSelection = RecordSelection.ONE_RECORD ;

Thank you very much for help, this code is worked well.

1 Like