Codeunit Headlines
Various functions related to headlines functionality.
Payload - the main text of the headline. Qualifier - smaller text, hint to the payload. Expression property - value for the field on the page with type HeadlinePart.
Properties
| Name | Value |
|---|---|
| Access | Public |
| InherentEntitlements | X |
| InherentPermissions | X |
Methods
Truncate
Truncate the text from the end for its length to be no more than MaxLength. If the text has to be shortened, "..." is be added at the end.
procedure Truncate(TextToTruncate: Text, MaxLength: Integer): Text
Parameters
| Name | Type | Description |
|---|---|---|
| TextToTruncate | Text |
Text that be shortened in order to fit on the headline. |
| MaxLength | Integer |
The maximal length of the string. Usually obtained through
|
Returns
| Type | Description |
|---|---|
| Text |
The truncated text |
Emphasize
Emphasize a string of text in the headline. Applies the style to the text.
procedure Emphasize(TextToEmphasize: Text): Text
Parameters
| Name | Type | Description |
|---|---|---|
| TextToEmphasize | Text |
The text that the style will be applied on. |
Returns
| Type | Description |
|---|---|
| Text |
Emphasized text (special tags are added to the input). |
GetHeadlineText
Combine the text from Qualifier and Payload in order to get a single string with headline text. This text is usually assigned to Expression property on the HeadlinePart page.
procedure GetHeadlineText(Qualifier: Text, Payload: Text, var ResultText: Text): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| Qualifier | Text |
The text to be displayed on the qualifier (smaller text above the main one)
of the headline (parts of it can be emphasized, see |
| Payload | Text |
The text to be displayed on the payload (the main text of the headline)
of the headline (parts of it can be emphasized, see |
| ResultText | Text |
Output parameter. Contains the combined text, ready to be assigned to the Expression property, if the function returns 'true', the unchanged value otherwise. |
Returns
| Type | Description |
|---|---|
| Boolean |
'false' if payload is empty, or payload is too long, or qualifier is too long, 'true' otherwise. |
GetUserGreetingText
Get a greeting text for the current user relevant to the time of the day. Timespans and correspondant greetings: 00:00-10:59 Good morning, John Doe! 11:00-13:59 Hi, John Doe! 14:00-18:59 Good afternoon, John Doe! 19:00-23:59 Good evening, John Doe! if the user name is blank for the current user, simplified version is used (for example, "Good afternoon!").
procedure GetUserGreetingText(): Text
Returns
| Type | Description |
|---|---|
| Text |
The greeting text. |
ShouldUserGreetingBeVisible
Determines if a greeting text should be visible.
procedure ShouldUserGreetingBeVisible(): Boolean
Returns
| Type | Description |
|---|---|
| Boolean |
True if the user logged in less than 10 minutes ago, false otherwise. |
GetMaxQualifierLength
The accepted maximum length of a qualifier.
procedure GetMaxQualifierLength(): Integer
Returns
| Type | Description |
|---|---|
| Integer |
The number of characters, 50. |
GetMaxPayloadLength
The accepted maximum length of a payload.
procedure GetMaxPayloadLength(): Integer
Returns
| Type | Description |
|---|---|
| Integer |
The number of characters, 75. |