Metadata

Last modified by mko on 08.03.2017

Sometimes you need to get access to the data of the current user such as his username or mail address, the data of the current form record, such as the form's ID or current state, or the current time of the Xima® Formcycle server. This data is available in the JavaScript object window.XFC_METADATA. The following provides you with a quick overview of all the available data.

Viewing the window.XFC_METADATA object in the Firefox add-on firebug.

Structure of the meta data object

Metadata field                   Description 

XFC_METADATA

The object containing all the meta data. 

 - attachments

Array of all available attachments. 

 - currentClient

Name and ID of the client to which this form belongs to. 
- idThe client's ID. 
- nameThe client's name. 
 - currentLanguageThe language in which the form was opened. Can be changed by the parameter "lang".

 - currentProcess

Data of the current form record. Empty when the form was not submitted yet. 
- idThe ID of the form record. 

- processId

The unique process ID of the form record. 
- statusThe current status of the form record.

 - currentProjekt

Contains data of the the current form. 

- id

The ID of form. 
- titleThe title of this form. 
- descriptionThe description of this form as entered in the form menu. 
- currentFormVersion of the form. 
- idID of the form version. 
- versionNumberThe version number.
 - currentSessionIDThe current session ID of the user. 

 - currentUser

Contains data of the current user. Dummy data when the user is not logged in. 

- title

The user's form of address. Possible values: MISTER, MISS 

- forename

The user's given name. 

- surename

The user's family name. 

- username

The user's  user name. 

- email

The user's mailing adress. 

- mandant

The name of the client to which this user belongs to. 

- active

Whether the user is active. Possible values: ACTIVE, LOCKED, DELETED 

- role

The role to which this user belongs to. 

- phonenumber

The user's telephone number.

- usergroups

An array containing all the user groups which he is a member of. 

- inbox

The current inbox of this form record. 
- ldapA JavaScript object with the LDAP structure of the user. Empty when the user did not authenticate via NTLM, See also example data structure in firebug. 
 - pluginResultsA JavaScript object with results of pre-render plugins. 

 - serverTime

JavaScript date object with the current server time.  

 - urlParams

A JavaScript object containing all URL parameters of the current URL. 
- urlsA JavaScript object containing relative URL for various different servlets. 
- attachmentServlet for accessing attachments, eg: "/formcycle/attachment/form/". 
- contextThe current context path of the Xima┬« Formcycle application, eg. "formcycle" 
- dataquery_dbServlet for accessing database queries, eg. "/formcycle/datenabfragedb/". 
- dataquery_ldapServlet for accessing LDAP queries, eg "/formcycle/datenabfrageldap/". 
- datasource_csvServlet for accessing CSV data sources, eg "/formcycle/datenquellecsv/". 
- datasource_jsonServlet for accessing JSON data sources, eg "/formcycle/datenquellejson/".
- datasource_xmlServlet for accessing XML data sources, eg "/formcycle/datenquellexml/". 
- pluginServlet for accessing servlet action plugins, eg "/formcycle/plugin/". 
- previewActionServlet used when previewing the form, eg "/formcycle/form/preview/3601/1/". 
- submitActionServlet used when submitting the form, eg "/formcycle/form/process/3601/1/?lang=de&frid=3819ffe0-4117-45b8-bf81-3933f2dd3414".
- requestTypeSpecifies the context of the current form call
possible and usable values: provide (form delivery), preview (form preview), process (processing the form), print (Printing a form over e.g. PhantomPrinter), review (form delivery inside the inbox)
for internal use: alias, copy, aliascopy, publish, forward
 

Examples

Access a form-specific resource

When there is a file named myData.json uploaded as form-specific resource, you can access it as follows:
// Get the URL.
function getResourceURL(filename){
   var pid = String(window.XFC_METADATA.currentProject.id);
   var url = XFC_METADATA.urls.context + "includes/ressource?pid=" + pid + "&name=" + encodeURI(filename);
   return url;
}
// Get the data.
$.get(getResourceURL("myData.json"), function(data){
 // Do something with the data.
});

Get the user name of the current user:

var benutzername = XFC_METADATA.currentUser.username;

Get the LDAP user of the current user. Must have signed in via LDAP.

var urlParameter = XFC_METADATA.currentUser.ldap;

Get the value of the URL parameter named parameter.

var urlParameter = XFC_METADATA.urlParams.parameter;

Get the current server and set it as the value of an input field named tfServertime.

$('[name=tfServertime]').val(XFC_METADATA.serverTime.toString());
Tags:
Created by superadmin on 18.09.2015
Translated into en by superadmin on 08.06.2016
  
Copyright 2000-2016