Signature

global static void documentMapper(
  List<Types.DocumentMapperPayload> payloads,
  String runAs
)
Parameters
ParameterDescription
payloads requiredOne entry per mapper run. Each Types.DocumentMapperPayload names the configuration, the document or documents, and the record to write to.
runAs
String
optionalEmail Id of the user on whose behalf the function should run. To run the action as the automation user, supply integrationUser.

Return Type

void. The run happens in the background. CloudFiles publishes a Document Mapper Run event when it finishes, carrying your context, or a DocumentMapperRunError event if it fails.

Example

cldfs.Resource invoice = new cldfs.Resource(
  '01KEHAKUXCQ6YIOFLOPJHJN57Y5EYQTJMZ', // file Id
  'file',
  null,
  'sharepoint',
  'b!nJBtPq_z5UeJtFrj_f24XEQqlPUD8vtFsg7GBcrXJepiUn9bkb_7QbDPtqHVD-cP'
);

List<cldfs.Types.DocumentMapperPayload> payloads = new List<cldfs.Types.DocumentMapperPayload>{
  new cldfs.Types.DocumentMapperPayload(
    '68f1c2a9e4b0d35a7c9e1f20', // Document Mapper configuration Id
    invoice,
    '006dL000005H4srQAC', // record to write to
    'invoice-intake' // context, returned on the event
  )
};

cldfs.Client.documentMapper(payloads, 'integrationUser');
How this differs from the Document Mapper Flow action

The Document Mapper Flow action creates a CloudFiles DocAI Run record for every run, and the run status and review screen are built on that record. This method sends the request straight to CloudFiles and creates no run record, so its runs do not appear there. If you need run tracking or review, start the run from the Flow action.

The Flow action also rejects an input that sets both a single resource and a set of resources, or a set with an entry that has no Id. This method does not check: when a set is given, the single resource is ignored. Set exactly one of them.