Requesting a document (persistent.getDocument)

You can use persistent.getDocument to get a document with a specific documentId

You can use the following method in your script

persistent.getDocument(ddName, documentId);
Parameter Type Required Description
ddName String Yes Name of the document definition
documentId String Yes The BizzStream (internal) ID of the document you request. Find out how you can find this ID here.

Examples

The following method allows you to search for the project with the BizzStream ID 2FwMgqxxPv6i4j8rc.

persistent.getDocument("project", "2FwMgqxxPv6i4j8rc");

The result is the following document, for example:

{
   "_id":"2FwMgqxxPv6i4j8rc",
   "_documentDefinitionId":"iaK8uBLxDqmTJzYdL",
   "_environmentId":"a83rh4aX5nzBsGL3S",
   "accessGroups":[],
   "code":"12345",
   "name":"Constructing Highway",
   "companyId":"a6PbuPzkoRp3Czqcv",
   "externalId":"bdr:200¡adm:05¡prj:6"
}

Tip: by using the console console.log('a message', variable) you can find the result in the logs.

//Start of the script
var document = persistent.getDocument("project", "2FwMgqxxPv6i4j8rc");
console.log('Give me the document with id 2FwMgqxxPv6i4j8rc', document)
//End of the script

Limits

The persistent.getDocument method is subject some limits. Click here to find out more.

results matching ""

    No results matching ""