Skip to main content
Version: 4.1 (2026-H2)

Connect Session Templates

This document function defines named, pre-initialized Connect sessions. The primedocs web app can launch such a session directly from a URL and pre-populate form and data values — ideal for triggering a partially filled document creation from a third-party system (GEVER, CRM, custom application).

Related topics: primedocs Connect, Connect Session API.

Launching via URL

The web app launches a session via:

https://{instanz}/app/web/session/template/{Name}?Forms.Subject=...&Data.CustomerId=...

{Name} matches the Name attribute of the ConnectSessionTemplate. The GET parameters of the launching URL are merged into the resulting Connect object (Forms.* → Forms, Data.* → Data) and are available to the initializers.

Basic structure

<ConnectSessionTemplatesConfiguration>
<ConnectSessionTemplate Name="Quote">
<Initializers>
<CodeDataProvider>
<Code>
function main() {
return {
Forms: { Subject: $.parameter('Forms.Subject') },
Data: {}
};
}
</Code>
</CodeDataProvider>
</Initializers>
</ConnectSessionTemplate>
</ConnectSessionTemplatesConfiguration>
Attribute / ElementRequiredDescription
ConnectSessionTemplate/@NameyesName of the template — used as the lookup key in the launching URL.
InitializersoptionalOrdered list of initializers (see below).
CommandsoptionalConnect commands attached to the session (see below).
GlobalInitializers/@KeyoptionalReference to a global initializers configuration. Mutually exclusive with inline Initializers (inline takes precedence).
GlobalCommands/@KeyoptionalReference to a global commands configuration. Mutually exclusive with inline Commands (inline takes precedence).

Initializers

The Initializers run in the defined order. Each initializer must return an object of the shape { Forms: { … }, Data: { … } }; the result is merged into the accumulating Connect object and is visible to the next initializer.

Available initializer types:

TypeDescription
CodeDataProviderEvaluates a JavaScript snippet and returns { Forms, Data } directly — without an external call.
HttpDataProviderRetrieves data via the DataService (OAuth/secret/multi-step HTTP logic). All URL parameters are automatically forwarded as search data.
SqlDataProviderExecutes a SQL query via the DataService.
ExcelDataProvider / CsvDataProviderReads an Excel or CSV file via the DataService.
GlobalDataProviders/@KeyInlines the initializers of a global configuration at this position.

The $ object inside CodeDataProvider/Code provides:

APIDescription
$.parameter(key)Returns a URL parameter of the launching URL (e.g. $.parameter('Forms.Subject')).
$.forms(key)Returns an already-set Forms value.
$.data(key)Returns an already-set Data value.
$.datasourceIdID of the current data source.
$.templateIdID of the template.
note

The service-based initializers (HttpDataProvider, SqlDataProvider, ExcelDataProvider, CsvDataProvider) use the same mechanism as the Select data interface. A Mapping configuration is not supported for initializers; the transformation happens in the Code element.

Commands

Commands attach Connect commands to the resulting session, grouped by the OnSuccess, OnExit, OnError and OnCancel events. In web sessions, the commands InvokeUrl (multi-step HTTP call to an external system) and ShowDialog (feedback dialog) are supported.

<Commands>
<OnSuccess>
<ShowDialog Title="Done" Message="The document has been created." ButtonLabel="OK" />
</OnSuccess>
</Commands>
info

InvokeUrl can require a connected service via the ConnectedServiceKey attribute. If the user is not signed in, the web app shows a login banner.