You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 139 Next »

When creating a widget, define its form, fields, and its behavior by using the template elements to specify the way it displays with HTML and Widget Attributes. Apply HTML tags to add and control elements such as buttons and various types of fields. 

Some SimpleTags implement portal widgets and are described in a dedicated article: Portal Simple Tags

When a widget is implementing, all tag attribute values are transmitted as a string regardless of the  attribute type; and during the processing phase, the attribute  value is applied in line with the type specified.



<attachment>

Adds a files attachment widget.

The following attributes are applicable:

AttributeTypeDescription
recordIdStringSpecify ID of the record to which this tag implementing attachment widget will be bound.
tableNameStringSpecify a name of the table for the record to which this tag will be bound.
attachment
<attachment tableName={data.table_name} recordId={data.record_id}</attachment>



<button>

Use this attribute to add a button to your widget form. This element behavior is similar as React does.

The following attributes are applicable:

AttributeTypeDescription
buttonTypeString

This attribute allows specifying button displaying style for forms and lists. Available attribute values are the same as database values for UI Action Form Style or List Style:

  • unstyled
  • primary
  • approve
  • destructive
  • secondary


Button
<button buttonType="approve" event-click="window.s_widget_custom.approve();">
  {data.approveBtnTitle}
</button>

<button buttonType="destructive" event-click="window.s_widget_custom.reject();">
  {data.rejectBtnTitle}
</button>


<checkbox>

This element allows adding and configuring the checkbox field.

The following attributes are applicable:

AttributeTypeDescription
classStringThis attribute allows defining CSS styles classes description and specifying.
isMandatoryBooleanThis attribute allows to set a mandatory status to field. For this, set it equal to 'true'.
isVisibleBooleanIf this attribute is equal to 'true' (by default), then the widget is displayed; otherwise, it is not displayed.
labelStringA field label with text information generally describing the field content.
modelStringThis attribute points to the client controller data object. When the model data changes, it is automatically transferred to data of the client script.
readOnlyBooleanThis attribute allows to set a read-only status to field. For this, set it equal to 'true'.
styleString

This attribute specifies the display settings (size, font, color, and etc.) of the widget elements using the CSS syntax.

valueStringSpecifies the default value of the field.
checkbox
<modal model="data.modal" title="{data.modalTitle}" isShow="{data.isShow}"
  doClose="window.s_widget_custom.closeModal();">

  <checkbox model="data.ignoreAutoCAB" label="{data.questionText}"></checkbox>

  <div simple-if="{data.showInput}" class="select-area">
    <multiselect label="{data.cabParticipantsTitle}" title="{data.cabParticipantsTitle}" model="data.CABparticipants"
      values="" options="{data.optionsValues}" event-change="s_widget_custom.optionsSelected();">
    </multiselect>
  </div>
</modal>



<codemirror>

The element adds a text field with the code formatting.

The following attributes are applicable:

AttributeTypeDescription
classStringThis attribute allows defining CSS styles classes description and specifying.
isMandatoryBooleanThis attribute allows to set a mandatory status to field. For this, set it equal to 'true'.
isVisibleBooleanIf this attribute is equal to 'true' (by default), then the widget is displayed; otherwise, it is not displayed.
labelStringA field label with text information generally describing the field content.
modelStringThis attribute points to the client controller data object. When the model data changes, it is automatically transferred to data of the client script.

readOnly

Boolean

This attribute allows to set a read-only status to field. For this, set it equal to 'true'.

styleString

This attribute specifies the display settings (size, font, color, and etc.) of the widget elements using the CSS syntax.

value

String

Specifies the default value for field.

Codemirror
<codemirror model="data.mirror" label="Code Editor" isMandatory="true"></codemirror>



<conditions>

Adds the condition builder widget.

The following attributes are applicable:

AttributeTypeDescription
classStringThis attribute allows defining CSS styles classes description and specifying.
modelStringThis attribute points to the client controller data object. When the model data changes, it is automatically transferred to data of the client script.
isMandatoryBooleanThis attribute allows to set a mandatory status to field. For this, set it equal to 'true'.
isVisibleBooleanIf this attribute is equal to 'true' (by default), then the widget is displayed; otherwise, it is not displayed.
labelStringA field label with text information generally describing the field content.

readOnly

Boolean

This attribute allows to set a read-only status to field. For this, set it equal to 'true'.

styleString

This attribute specifies the display settings (size, font, color, and etc.) of the widget elements using the CSS syntax.

tableIdBig IntegerConnection with a table by the ID.
tableNameStringConnection with a table by its name.

value

String

Specifies the default value for field.


Conditions
<conditions model="data.condition" tableName="itsm_incident" tableId="155964310500000569"></conditions>



<datetime>

The element provides a data input of the datetime format. 

The following attributes are applicable:

AttributeTypeDescription
beginDateStringSpecify a date in this field defining a period beginning.
classStringThis attribute allows defining CSS styles classes description and specifying.
endDateStringSpecify a date in this field defining a period ending.
isMandatoryBooleanThis attribute is responsible for specifying whether this input field is mandatory or not.
isVisibleBooleanIf this attribute is equal to 'true' (by default), then the widget is displayed; otherwise, it is not displayed.
labelStringA field label with text information generally describing the field content.
modelStringThis attribute points to the client controller data object. When the model data changes, it is automatically transferred to data of the client script.

readOnly

Boolean

This attribute allows to set a read-only status to field. For this, set it equal to 'true'.

styleString

This attribute specifies the display settings (size, font, color, and etc.) of the widget elements using the CSS syntax.

value

String

Specifies the default value for field.

beginDate
<datetime model="data.dueDate" label="data.dueDateTitle" isMandatory="true" beginDate="{data.beginDate}" endDate="{data.endDate}"></datetime>
Server Script
const nowDate = new SimpleDateTime();
data.beginDate = nowDate.getDate();
nowDate.addDays(3);
data.endDate = nowDate.getDate();

<daysofweek>

The element adds a field that allows selecting days of week.

The following attributes are applicable:

AttributeTypeDescription
classStringThis attribute allows defining CSS styles classes description and specifying.
isMandatoryBooleanThis attribute allows to set a mandatory status to field. For this, set it equal to 'true'.
isVisibleBooleanIf this attribute is equal to 'true' (by default), then the widget is displayed; otherwise, it is not displayed.
labelStringA field label with text information generally describing the field content.
modelStringThis attribute points to the client controller data object. When the model data changes, it is automatically transferred to data of the client script.

readOnly

Boolean

This attribute allows to set a read-only status to field. For this, set it equal to 'true'.

styleString

This attribute specifies the display settings (size, font, color, and etc.) of the widget elements using the CSS syntax.

value

String

Specifies the default value for field.

daysofweek
<daysofweek model="data.daysofweek" label="Calendar Widget" isMandatory="true" isVisible="true" readOnly="false" value="Mon,Tue,Wed,Thu,Fri,Sat,Sun"></daysofweek>



<duration>

The tag adds a field counting the time duration.

The following attributes are applicable:

AttributeTypeDescription
classStringThis attribute allows defining CSS styles classes description and specifying.
isMandatoryBooleanThis attribute allows to set a mandatory status to field. For this, set it equal to 'true'.
isVisibleBooleanIf this attribute is equal to 'true' (by default), then the widget is displayed; otherwise, it is not displayed.
labelStringA field label with text information generally describing the field content.
modelStringThis attribute points to the client controller data object. When the model data changes, it is automatically transferred to data of the client script.

readOnly

Boolean

This attribute allows to set a read-only status to field. For this, set it equal to 'true'.

styleString

This attribute specifies the display settings (size, font, color, and etc.) of the widget elements using the CSS syntax.

value

String

Specifies the default value for field.

duration
<duration model="data.absence" label="Absence" isMandatory="true" value="3600000"></duration>



<htmlEditor>

This widget adds an HTML input field with text formatting options.

The following attributes are applicable:

AttributeTypeDescription
classStringThis attribute allows defining CSS styles classes description and specifying.
isMandatoryBooleanThis attribute allows to set a mandatory status to field. For this, set it equal to 'true'.
isVisibleBooleanIf this attribute is equal to 'true' (by default), then the widget is displayed; otherwise, it is not displayed.
labelStringA field label with text information generally describing the field content.
modelStringThis attribute points to the client controller data object. When the model data changes, it is automatically transferred to data of the client script.

readOnly

Boolean

This attribute allows to set a read-only status to field. For this, set it equal to 'true'.

styleString

This attribute specifies the display settings (size, font, color, and etc.) of the widget elements using the CSS syntax.

value

String

Specifies the default value for field.

html
<htmlEditor label="Description" model="data.description" isMandatory="true"></htmlEditor>



<modal>

This tag allows implementing a modal window.

The following attributes are applicable:

AttributeTypeDescription
classStringThis attribute allows defining CSS styles classes description and specifying.
doCloseFunction

Specify actions to perform after one of the predefined patterns is selected:

  • click
  • context
  • mouseOver
isMandatoryBooleanThis attribute allows to set a mandatory status to field. For this, set it equal to 'true'.
isShowBooleanIf this attribute is equal to 'true', then the modal window is displayed.
isVisibleBooleanIf this attribute is equal to 'true' (by default), then the widget is displayed; otherwise, it is not displayed.
labelStringA field label with text information generally describing the field content.

readOnly

Boolean

This attribute allows to set a read-only status to field. For this, set it equal to 'true'.

styleString

This attribute specifies the display settings (size, font, color, and etc.) of the widget elements using the CSS syntax.

titleStringSpecifies the modal window title.

value

String

Specifies the default value for field.


modal
<modal
  title="{data.modalTitle}"
  isMandatory="true"
  isShow="{data.isShow}"
  doClose="window.s_widget_custom.countClosing();">
</modal>



<multiselect>

Provides multiple choice selection for widgets.

The following attributes are applicable:

AttributeTypeDescription
canExcludeAllBooleanThis parameter is responsible for items deselecting; if it's equal to TRUE, then bulk item selection cancellation is available.
classStringThis attribute allows defining CSS styles classes description and specifying.
isMandatoryBooleanThis attribute allows to set a mandatory status to field. For this, set it equal to 'true'.
isVisibleBooleanIf this attribute is equal to 'true' (by default), then the widget is displayed; otherwise, it is not displayed.
labelStringA field label with text information generally describing the field content.
modelStringThis attribute points to the client controller data object. When the model data changes, it is automatically transferred to data of the client script.
optionsString

This field type matches database values with what will be displayed. Specify options available for selecting using the CodeMirror JSON formatting to set the options you need.

You can put as much options into drop-down menu as you need, but after the sixth one is placed, a vertical scroll appears.

readOnly

Boolean

This attribute allows to set a read-only status to field. For this, set it equal to 'true'.

styleString

This attribute specifies the display settings (size, font, color, and etc.) of the widget elements using the CSS syntax.

valuesStringSpecify values for the selection.


multiselect
<multiselect model="data.values" canExcludeAll="true" values='["1", "2"]' options='[{"database_value":"","display_value":""},{"database_value":"1","display_value":"First"},{"database_value":"2","display_value":"Second"}]'></multiselect>



<reference>

This element adds a reference field to a widget for establishing connections with data tables by a custom reference.

The following attributes are applicable:

AttributeTypeDescription
classStringThis attribute allows defining CSS styles classes description and specifying.
conditionStringSpecify a condition query.
isFixedBooleanWhen this attribute is equal to 'true', then the condition value cannot be changed.
isMandatoryBooleanThis attribute allows to set a mandatory status to field. For this, set it equal to 'true'.
isVisibleBooleanIf this attribute is equal to 'true' (by default), then the widget is displayed; otherwise, it is not displayed.
labelStringA field label with text information generally describing the field content.
modelStringThis attribute points to the client controller data object. When the model data changes, it is automatically transferred to data of the client script.

readOnly

Boolean

This attribute allows to set a read-only status to field. For this, set it equal to 'true'.

styleString

This attribute specifies the display settings (size, font, color, and etc.) of the widget elements using the CSS syntax.

tableNameStringConnection with a table by its name.

value

String

Specifies the default value for field.


reference
<reference label="Configuration Item" model="data.element" tableName="cmdb" isMandatory="true" condition="{data.condition}"></reference>



<rem>

This widget is used to add model attributes to a form. The use case is when administrator needs to extend a record form in the agent interface. The tag must be specified in the Template field of the widget.

The following attributes are applicable:

AttributeTypeDescription
isUserScriptsBooleanThis attribute allows to enable client scripts execution. The default value is 'true'.
isPortalBooleanThis attribute allows declaring that this widget should be displayed on the portal.
modelIdStringThis attribute allows to specify RE model ID.
recordIdStringThis attribute allows to specify an ID of existing record to extend.
styleString

This attribute specifies the display settings (size, font, color, and etc.) of the widget elements using the CSS syntax.

tableNameStringThis attribute allows to specify a table containing the extending record.
rem
<rem modelId="{data.model_id}" tableName="{data.table_name}" recordId ="{data.record_id}" />
( () => {
    window.s_widget_custom = window.s_widget_custom || {};
    const modelId = new URLSearchParams(window.location.search).get('model_id'); // Getting model id from URL
    //Setting model from model_id URL parameter so new record knows from which model to add attributes
    s_widget.setFieldValue('model_id', modelId);
    // Setting table name and record ID of existing record in order to find a model
    s_widget.setFieldValue('table_name', window.s_form.getTableName());
    s_widget.setFieldValue('record_id', window.s_form.getUniqueValue());
})();



<remform>

This tag allows adding to portal a form consisting of model attributes.

The following attributes are applicable:

AttributeTypeDescription
isPortalBooleanThis attribute allows declaring that this widget should be displayed on the portal. In the case of the <remform> SimpleTag, it is recommended to set the value of this attribute to 'true'.
isUserScriptsBooleanThis attribute allows to enable client scripts execution. The default value is 'true'.
recordIdStringThis attribute allows to specify an ID of existing record to extend.
saveButtonCaptionStringSpecify text displayed on the Save button.
styleString

This attribute specifies the display settings (size, font, color, and etc.) of the widget elements using the CSS syntax.

tableNameStringThis attribute allows to specify a table containing the extending record.
remform
<remform modelId="{data.model_id}" isPortal="true" tableName="rem_table" saveButtonCaption="Save" />
remform widget code
(() => {
    window.s_widget_custom = window.s_widget_custom || {};
    const modelId = new URLSearchParams(window.location.search).get('model_id');
    s_widget.setFieldValue('model_id', modelId); // Provide form of new record with model id
})();



<report>

Add this SimpleTag to display a particular report.

The following attributes are applicable:

AttributeTypeDescription
classStringThis attribute allows defining CSS styles classes description and specifying.
conditionStringSpecify a condition to build a report.
isMandatoryBooleanThis attribute allows to set a mandatory status to field. For this, set it equal to 'true'.
isVisibleBooleanIf this attribute is equal to 'true' (by default), then the widget is displayed; otherwise, it is not displayed.
labelStringA field label with text information generally describing the field content.
modelStringThis attribute points to the client controller data object. When the model data changes, it is automatically transferred to data of the client script.

readOnly

Boolean

This attribute allows to set a read-only status to field. For this, set it equal to 'true'.

styleString

This attribute specifies the display settings (size, font, color, and etc.) of the widget elements using the CSS syntax.

reportIdStringSpecify the report with the appropriate ID to display.

value

String

Specifies the default value for field.

When placing two or more conditions into the condition string, merge them with the carat symbol ( ^ ). The condition syntax will look like this:

Condition wordNotationExample
AND^emailLIKE-group^state=active
OR^ORimpact=high^ORurgency=high

To know more about possible condition operators, please refer to the Condition Operators article.

report
<report reportid="{data.monthBarReportId}" condition="(group.nameLIKEdesk^ORstate=active)/>



<select>

A field that allows selecting items.

The following attribute is applicable:

AttributeTypeDescription
classStringThis attribute allows defining CSS styles classes description and specifying.
isMandatoryBooleanThis attribute allows to set a mandatory status to field. For this, set it equal to 'true'.
isVisibleBooleanIf this attribute is equal to 'true' (by default), then the widget is displayed; otherwise, it is not displayed.
labelStringA field label with text information generally describing the field content.
modelStringThis attribute points to the client controller data object. When the model data changes, it is automatically transferred to data of the client script.

readOnly

Boolean

This attribute allows to set a read-only status to field. For this, set it equal to 'true'.

optionsStringThis field type matches database values with what will be displayed. Specify options available for selecting using the CodeMirror JSON formatting to set the options you need.
styleString

This attribute specifies the display settings (size, font, color, and etc.) of the widget elements using the CSS syntax.

value

String

Specifies the default value for field.


select
<select label="Class" isMandatory="true" model="data.class" options='[{"database_value":"","display_value":""},{"database_value":"155964310500000004","display_value":"Server"},{"database_value":"155964310500000006","display_value":"Database"}]'></select>



<string>

In a widget, use this attribute to designate an input field for text information. The element is similar to the React component.

The following attributes are applicable:

AttributeTypeDescription
classStringThis attribute allows defining CSS styles classes description and specifying.
isMandatoryBooleanThis attribute allows to set a mandatory status to field. For this, set it equal to 'true'.
isVisibleBooleanIf this attribute is equal to 'true' (by default), then the widget is displayed; otherwise, it is not displayed.
labelStringA field label with text information generally describing the field content.
modelStringThis attribute points to the client controller data object. When the model data changes, it is automatically transferred to data of the client script.

readOnly

Boolean

This attribute allows to set a read-only status to field. For this, set it equal to 'true'.

styleString

This attribute specifies the display settings (size, font, color, and etc.) of the widget elements using the CSS syntax.

value

String

Specifies the default value for field.

string
<h1>{data.fullname}</h1>
<string model="data.firstname" event-change="s_widget_custom.updateFullname();"></string>
<string model="data.lastname" event-change="s_widget_custom.updateFullname();"></string>
Client Script
;
(() => {
  window.s_widget_custom.updateFullname = async function () {
    const firstname = s_widget.getFieldValue('firstname') || '';
    const lastname = s_widget.getFieldValue('lastname') || '';
    s_widget.setFieldValue('fullname', lastname + ' ' + firstname);
  } 
})();



<template>

This element is used to create form templates with a particular set of fields.

The following attributes are applicable:

AttributeTypeDescription
classStringThis attribute allows defining CSS styles classes description and specifying.
modelStringThis attribute points to the client controller data object. When the model data changes, it is automatically transferred to data of the client script.
isMandatoryBooleanThis attribute allows setting a mandatory status to field. For this, set it equal to 'true'.
isVisibleBooleanIf this attribute is equal to 'true' (by default), then the widget of the type from the list below is displayed; otherwise, it is not displayed.
labelStringA field label with text information generally describing the field content.

readOnly

Boolean

This attribute allows setting a read-only status to field. For this, set it equal to 'true'.

styleString

This attribute specifies the display settings (size, font, color, and etc.) of the widget elements using the CSS syntax.

tableIdBig IntegerConnection with a table by the ID.
tableNameStringConnection with a table by its name.

value

String

Specifies the default value for field.




<textarea>

A multi-line text field.

The following attributes are applicable:

AttributeTypeDescription
classStringThis attribute allows defining CSS styles classes description and specifying.
isMandatoryBooleanThis attribute allows to set a mandatory status to field. For this, set it equal to 'true'.
isVisibleBooleanIf this attribute is equal to 'true' (by default), then the widget is displayed; otherwise, it is not displayed.
labelStringA field label with text information generally describing the field content.
modelStringThis attribute points to the client controller data object. When the model data changes, it is automatically transferred to data of the client script.
placeholderStringSpecifies the placeholder for text field.

readOnly

Boolean

This attribute allows to set a read-only status to field. For this, set it equal to 'true'.

styleString

This attribute specifies the display settings (size, font, color, and etc.) of the widget elements using the CSS syntax.

value

String

Specifies the default value for field.


textarea
  <textarea model="data.name" label="Name" placeholder="Your search request" value=""></textarea>
  <textarea model="data.description" label="Description" value="" placeholder="Your search request"></textarea>

  • No labels