REKA Scripting Reference
Comprehensive client-side, templating, and backend Lambda scripting references available within the REKA platform.
Scripting & APIs
Select a topic from the sidebar folder navigation to explore the detailed scripting functions.
Form Functions
$form$.canSave
Show/hide save button dynamically based on form state.
Syntax
$form$.canSave = <boolean>;
Example
if ($user$.groups['2235']) { $form$.canSave = true; }
$form$.canSubmit
Show/hide submit button dynamically based on validations or state.
Syntax
$form$.canSubmit = <boolean>;
Example
$form$.canSubmit = false;
$action$
Get the current facet/action in use (e.g., 'edit', 'view', 'add').
Syntax
let action = $action$;
Example
if ($action$ === 'edit') { /* logic */ }
$lookupList$.<field-code>
Get or override the lookup list array for a specific dropdown/lookup field.
Syntax
$lookupList$.<field-code> = [{code: <string>, name: <string>}];
Example
$lookupList$.country = [{code:'MY', name:'Malaysia'}];
$el$.<field-code>.<prop>
Access and manipulate field metadata. Properties include: label, hint, placeholder, size, hideLabel, hidden, readOnly, and v (validation).
Syntax
$el$.<field-code>.<property> = <value>;
Example
$el$.email.readOnly = true;
Refer to Form Item Properties section for properties that can be manipulated.
$activeIndex$
Get the index number of the currently selected tab or accordion.
Syntax
let currentActiveTab = $activeIndex$;
Example
let currentTab = $activeIndex$;
$activate$(<tab-index>)
Programmatically switch to and activate a selected tab/accordion by its index.
Syntax
$activate$(<integer>);
Example
$activate$(1); // Activates the second tab
$save$()
Trigger the save action for the entry data asynchronously.
Syntax
$save$().subscribe(res => { /* callback */ });
Example
$save$().subscribe(res => { $toast$("Saved!"); });
$saveAndView$()
Save the current entry data and automatically navigate to the 'view entry' screen.
Syntax
$saveAndView$();
Example
$saveAndView$();
$submit$(<resubmit?>)
Trigger the formal submit action for the entry, progressing its workflow.
Syntax
$submit$(<boolean>);
Example
$submit$();
// for resubmission, pass true as parameter
$submit$(true);
$$_[<tier-id>]
Retrieve workflow tier approval information directly from the form context.
Syntax
let tierData = $$_[<string>];
Example
if ($$_['151'].status === 'approved') { }
$$_.status
Access the tier approval status during a workflow process step.
Syntax
let status = $$_.status;
Example
if ($$_.status === 'rejected') { }
$$_.remark
Access the remark or comment left during the tier approval step.
Syntax
let remarkText = $$_.remark;
Example
console.log($$_.remark);
$$_.timestamp
Retrieve the timestamp of when the tier approval action occurred.
Syntax
let timestamp = $$_.timestamp;
Example
let approvedAt = $$_.timestamp;
$$.<field-code>
Direct data binding to access or mutate the current value of a form field.
Syntax
$$.<field-code> = <value>;
Example
$$.total = $$.price * $$.qty;
$prev$.<field-code>
Access to the data of the previous entry.
Syntax
let prevValue = $prev$.<field-code>;
Example
let previousProduct = $prev$.product_no;
$user$.name
Retrieve the full name of the currently logged-in user viewing the form.
Syntax
let name = $user$.name;
Example
let username = $user$.name;
$user$.email
Retrieve the email address of the currently logged-in user.
Syntax
let email = $user$.email;
Example
if ($user$.email.endsWith('@company.com')) { }
$user$.imageUrl
Retrieve the profile photo URL of the logged-in user.
Syntax
let avatar = $user$.imageUrl;
Example
$$.avatarUrl = $user$.imageUrl;
$user$.provider
Identify the identity provider (e.g., google, facebook, local) for the user.
Syntax
let prov = $user$.provider;
Example
if ($user$.provider === 'google') { }
$user$.providerId
Retrieve the unique User ID provided by the identity provider.
Syntax
let provId = $user$.providerId;
Example
let ssoId = $user$.providerId;
$user$.groups
Check if the logged-in user belongs to a specific REKA group ID.
Syntax
let belongsToGroup = $user$.groups[<string>];
Example
if ($user$.groups['1124']) { $form$.canSubmit = true; }
// given the Admin group id is 1124
$this$.<variable>
A transient local variable holder to store temporary data during the session.
Syntax
$this$.<variable-name> = <value>;
Example
$this$.tempCalculation = 100;
$this$ is transient and scoped to the active component. For global cross-component persistence, use $conf$.
$param$.<key>
Retrieve URL parameters passed to the current screen or form.
Syntax
let paramValue = $param$.<key>;
Example
let recordId = $param$.uid;
$baseUrl$
Get the base URL of the frontend UI.
Syntax
let host = $baseUrl$;
Example
let loginLink = $baseUrl$ + '/login';
$baseApi$
Get the base URL of the backend API system.
Syntax
let apiHost = $baseApi$;
Example
let customApi = $baseApi$ + '/webhook';
$web$.get
Perform an advanced HTTP GET request with support for custom headers and query parameters. Returns an observable.
Syntax
$web$.get(<string>, <object>);
Example
// Internal API request with query parameters
$web$.get('https://io.ireka.my/api/entry/by-params?formId=5537', {
params: {
"$.institusi.code": 'UNIMAS'
}
}).subscribe(res => {
$conf$.institusi = res.data;
});
Pass {headers: {clear: 'true'}} to ignore platform security headers when querying external 3rd-party services.
$web$.post
Perform an advanced HTTP POST request with support for custom headers and query parameters. Returns an observable.
Syntax
$web$.post(<string>, <object>, <object>);
Example
$web$.post('{{$base$}}/~cogna/process', {
msg: $.msg
}, {
headers: { 'X-Custom-Header': 'Value1' }
}).subscribe({
next: res => { /* logic */ },
error: err => { /* logic */ }
});
$http$
Perform a standard GET HTTP request to external services.
Syntax
$http$(<string>, <function>);
Example
$http$('https://api.ipify.org?format=json', res => { console.log(res.ip); });
$post$
Perform an HTTP POST request with a JSON body and handle the response/error.
Syntax
$post$(<string>, <object>, <function>, <function>);
Example
$post$('https://api.site.com', {data: 1}, res => {}, err => {});
$endpoint$
Securely request and trigger a pre-configured REKA backend endpoint.
Syntax
$endpoint$(<string>, <object>, <function>, <function>);
Example
$endpoint$('get_users', {limit: 10}, data => {}, err => {});
$update$
Patch or update specific entry data without needing to submit the entire form.
Syntax
$update$(<entryId>, <object>);
Example
$update$($.$id, {status: 'active'}).then(res => {});
$updateLookup$
Patch or update specific lookup entry data programmatically.
Syntax
$updateLookup$(<lookupEntryId>, <object>);
Example
$updateLookup$($.institusi.$id, {name: 'Updated'}).then(res => {});
echarts.init
Initialize and render an ECharts graph inside a specified DOM element.
Syntax
echarts.init(<element>, <object>);
Example
let myChart = echarts.init($q$('#chart'), { title: { text: 'Sales' } });
$q$
A query selector wrapper to safely target HTML elements within the custom screen.
Syntax
$q$(<string>);
Example
$q$('#myDiv').style.color = 'red';
onInit()
Lifecycle hook triggered immediately when the form or screen initializes.
Syntax
function onInit() { /* implementation */ }
Example
onInit();
onSave()
Lifecycle hook triggered right after the form data is saved.
Syntax
function onSave() { /* implementation */ }
Example
onSave();
onSubmit()
Lifecycle hook triggered right after the form data is formally submitted.
Syntax
function onSubmit() { /* implementation */ }
Example
onSubmit();
onView()
Lifecycle hook triggered when the entry is opened in view-only mode.
Syntax
function onView() { /* implementation */ }
Example
onView();
ServerDate.now()
Retrieve the current server timestamp, avoiding client-side time discrepancies.
Syntax
ServerDate.now();
Example
$$.createdAt = ServerDate.now();
ServerDate.offset
Get the time offset difference between the REKA server and the user's browser.
Syntax
ServerDate.offset;
Example
let localTime = ServerDate.now() - ServerDate.offset;
$merge$
Deep merge two JSON objects and return the combined object.
Syntax
$merge$(<object>, <object>);
Example
let combined = $merge$({a: 1}, {b: 2});
$loadjs$
Dynamically load an external JavaScript file/library and execute a callback upon load.
Syntax
$loadjs$(<string>, <function>);
Example
$loadjs$('https://cdn.js', () => { console.log('loaded'); });
$live$.watch
Subscribe and listen to real-time live updates from a specified websocket channel.
Syntax
$live$.watch(<array>, <function>);
Example
$live$.watch(['chat_room_1'], res => { console.log(res); });
$live$.publish
Publish a real-time message to a specified websocket channel.
Syntax
$live$.publish(<array>, <any>);
Example
$live$.publish(['chat_room_1'], 'Hello World');
$digest$
Force Angular/REKA to detect changes and update the UI if data was manipulated outside standard bindings.
Syntax
$digest$();
Example
$$.name = 'John';
$digest$();
$toast$
Display a non-blocking toast notification alert at the top-right of the screen.
Syntax
$toast$(<string>, <object>);
Example
$toast$('Success!', {classname: 'bg-success text-light'});
$go['<action-id>']
Generate a routing link to a specific screen action within the app.
Syntax
$go['<string-id>']
Example
<a href="{{$go['1221']}}">Go to Dashboard</a>
$pop['<action-id>']()
Trigger a specific screen action to open as an overlay Modal popup.
Syntax
$pop['<string-id>']().then(entry => { /* callback */ });
Example
<button onclick="$pop['1221']()">View User</button>
$this$.viewUser = function() {
$pop['1221']().then(entry => {
/* do something with the entry */
});
}
Template Functions
<x-foreach>
A block-level foreach loop used to iterate over lists and arrays in static HTML.
Syntax
<x-foreach $="item of list"> {{item}} </x-foreach>
Example
<x-foreach $="user of $this$.usersList">
{{user.name}}
</x-foreach>
<x-if>
A block-level conditional wrapper to render content only if the expression is true.
Syntax
<x-if $="condition"> </x-if>
Example
<x-if $="$.status == 'Active'">
<p>Active</p>
</x-if>
<x-else-if>
A chained conditional clause used immediately after an <x-if> block.
Syntax
<x-else-if $="condition"> </x-else-if>
Example
<x-if $="$.status == 'Active'">
<p>Active</p>
<x-else-if $="$.status == 'Pending'">
<p>Pending</p>
</x-if>
<x-else-if> must be specified within an <x-if></x-if> block.
<x-else>
The fallback conditional block used when preceding <x-if> conditions fail.
Syntax
<x-else/>
Example
<x-if $="$.status == 'Active'">
<p>Active</p>
<x-else/>
<p>Not Active</p>
</x-if>
<x-else> must be specified within an <x-if></x-if> block.
x-foreach
An inline attribute to turn any standard HTML element into an iterator.
Syntax
<div x-foreach="item of list"> </div>
Example
<ul>
<li x-foreach="item of $this$.itemList">{{item}}</li>
</ul>
x-if
An inline attribute to conditionally hide/show a standard HTML element.
Syntax
<div x-if="condition"></div>
Example
<div x-if="$.isValid">Valid Record</div>
x-for
An inline standard JS 'for' loop attribute for numeric iteration.
Syntax
<div x-for="initializer; condition; increment"></div>
Example
<div x-for="i=0;i<5;i++">
Item {{i}}
</div>
dayjs().format
Inline template execution of the DayJs date formatting utility.
Syntax
{{dayjs($.<field-code>).format('<format-string>')}}
Example
<span>{{dayjs($.created_at).format('DD MMM YYYY')}}</span>
{{<variable>}}
Print variable data. Can be combined with pipes (e.g., date, src, json, qr) for formatting.
Syntax
{{<variable-path>|<pipe-name>:<pipe-parameter>}}
Example
<h1>Welcome, {{$user$.name}}</h1>
[# script block #]
Script block within template.
Syntax
[# // JS code block #]
Example
<x-foreach $="user of $this$.entryList">
[#
let data = user.data;
let gender = data.gender?.name??'Not Specified';
#]
{{gender}}
</x-foreach>
<x-markdown>
To parse and display markdown template in the template.
Syntax
<x-markdown>
<!-- markdown text content -->
</x-markdown>
Example
<x-markdown>
Hi **{{$user$.name}}** ,
</x-markdown>
date pipe
Custom Date string formatting inside view template.
Syntax
{{$.<date-field>|date:"<format-string>"}}
Example
{{$.date_field|date:"DD-MM-YYYY"}}
src pipe
Inline source resolution (e.g., inline images/attachments, or media streaming).
Syntax
{{$.<attachment-field>|src:inline|stream}}
Example
{{$.attachment|src:inline}}
qr pipe
Generates a base64 encoded QR Code source string dynamically from data.
Syntax
{{$.<text-field>|qr}}
Example
{{$.filing_no|qr}}
number pipe
Formatted numeric string (e.g., fractional digits/separators).
Syntax
{{$.<number-field>|number:"minIntegerDigits.minFractionDigits-maxFractionDigits"}}
Example
{{$.amount|number:"1.2-3"}}
json pipe
Outputs formatted JSON text string representing object models.
Syntax
{{$.<object-field>|json}}
Example
{{$.profile_data|json}}
Lambda Functions
lookup_<lookup-id>
Iterate through the contents of a specific lookup dataset.
Syntax
lookup_<lookupId>.content.forEach(element => { /* logic */ });
Example
lookup_12110.content.forEach(le => { print(le.getCode()); });
You must include the specific lookup in the Lambda bindings.
dataset_<dataset-id>
Iterate through the records of a specific primary dataset.
Syntax
dataset_<datasetId>.forEach(entry => { /* logic */ });
Example
dataset_2100.forEach(e => { print(e.getId()); });
You must include the specific dataset in the Lambda bindings. Please note that including a dataset as a binding will load its entire entry list into memory during execution. For more control over dataset queries and better memory efficiency, use _entry.dataset instead.
_mail.send
Send a custom email directly from the backend execution flow.
Syntax
_mail.send({ to: <string>, subject: <string>, content: <string> }, _this);
Example
_mail.send({ to:'john@abc.com', subject:'Hello', content:'Test' }, _this);
_mail.sendWithTemplate
Send an email using a pre-configured REKA mailer template.
Syntax
_mail.sendWithTemplate(<string>, <object>, _this);
Example
_mail.sendWithTemplate('welcome_email', entry, _this);
_endpoint.run
Programmatically invoke another REKA endpoint from within the current Lambda and load its data.
Syntax
_endpoint.run(<string>, <object>, <object>, _this);
Example
_endpoint.run('fetch_data', { id: 1 }, {}, _this);
_mapper.convertValue
Cast or convert a generic Map/Object into a specific Java Class structure.
Syntax
_mapper.convertValue(<object>, <class>);
Example
let obj = _mapper.convertValue(myMap, Object.class);
_mapper.readTree
Parse a JSON string representation into a readable JsonNode object.
Syntax
_mapper.readTree(<string>);
Example
let node = _mapper.readTree('{"a":1}');
_user.name
Retrieve the full name of the currently authenticated user triggering the Lambda.
Syntax
let name = _user.name;
Example
let authorName = _user.name;
_user.email
Retrieve the email address of the currently authenticated user.
Syntax
let email = _user.email;
Example
let contactEmail = _user.email;
_user.imageUrl
Retrieve the profile picture URL of the currently authenticated user.
Syntax
let imgUrl = _user.imageUrl;
Example
let avatar = _user.imageUrl;
_user.provider
Identify the authentication provider (e.g., google, facebook) used by the user.
Syntax
let provider = _user.provider;
Example
let loginType = _user.provider;
_user.providerId
Retrieve the unique user ID assigned by the identity provider.
Syntax
let ssoId = _user.providerId;
Example
let ssoId = _user.providerId;
_token.clearAccessToken
Invalidate and clear the OAuth access token associated with a specific client ID.
Syntax
_token.clearAccessToken(<string>);
Example
_token.clearAccessToken('myapp:secret123');
_token.getAccessToken
Retrieve or generate a new OAuth access token using client credentials.
Syntax
_token.getAccessToken(<url>, <clientid>, <clientsecret>);
Example
let t = _token.getAccessToken('https://auth', 'my-new-app', '554$@889');
_io.write
Create or overwrite a file in the server's storage system with text content.
Syntax
_io.write(<string-content>, <string-path>);
Example
_io.write('log data', 'logs/today.txt');
_io.read
Retrieve and read the textual content of a file from the server storage.
Syntax
_io.read(<string-path>);
Example
let content = _io.read('logs/today.txt');
_io.path
Resolve the absolute URL path of an uploaded file within a storage bucket.
Syntax
_io.path(<string-path>);
Example
let docUrl = _io.path('bucket1/file.pdf');
_io.zip
Compress multiple file paths into a single zip archive and return the download URL.
Syntax
_io.zip(<array-of-paths>);
Example
let zipUrl = _io.zip(['b1/a.txt', 'b1/b.txt']);
_io.pathFromBucket
Retrieve a list of all file paths stored within a specific storage bucket.
Syntax
_io.pathFromBucket(<string-bucket-name>);
Example
let files = _io.pathFromBucket('bucket_images');
_sql.select
Execute a custom SQL SELECT query using named parameters. The last boolean parameter indicates whether to use native SQL (true) or JPQL (false).
Syntax
_sql.select(<string>, <object>, <boolean>);
Example
let rows = _sql.select('SELECT * FROM users WHERE age > :age', { age: 18 }, true);
_sql.count
Execute an SQL COUNT query. The last boolean parameter indicates whether to use native SQL (true) or JPQL (false).
Syntax
_sql.count(<string>, <object>, <boolean>);
Example
let total = _sql.count('SELECT count(*) FROM users', {}, true);
_http.GET
Perform a synchronous HTTP GET request to external APIs.
Syntax
_http.GET(<string-url>, <object-options>);
Example
let res = _http.GET('https://api.io/data', { headers: {} }).body();
_http.POST
Perform a synchronous HTTP POST request to external APIs with a body payload.
Syntax
_http.POST(<string-url>, <object-options>, <string-type>);
Example
let res = _http.POST('https://api.io/data', { headers:{}, body:{a:1} }, 'json').body();
_pdf.fromHtml
Convert an HTML string into a PDF document, returning it as a byte array.
Syntax
_pdf.fromHtml(<string-html>);
Example
let pdfBytes = _pdf.fromHtml('<h1>Monthly Report</h1>');
_entry.byId
Fetch a specific dataset record. Note: The ID parameter must be of type long (e.g., cast string params with +).
Syntax
_entry.byId(<long>, _this);
Example
let record = _entry.byId(+_param.entryId, _this);
A Lambda can only retrieve data within its own app.
_entry.save
Create and save a new record into a specified form or dataset.
Syntax
_entry.save(<object>, <long-form-id>, <any>, _this);
Example
_entry.save({
data: {
first_name: 'Mohd Razif',
timestamp: Date.now()
}
}, 10579, null, _this);
A Lambda can only save or update data within its own app. To modify an entry in another app, create a Lambda in the target app to process the data, and trigger it via an HTTP request (GET/POST).
_entry.relinkPrev
Establish a linkage between an entry and its previous entry.
Syntax
_entry.relinkPrev(<long>, <long>, _this);
Example
_entry.relinkPrev(612334, 612003, _this);
_entry.update
Modify existing data fields of a specific entry without replacing it.
Syntax
_entry.update(<long>, <object>, _this);
Example
_entry.update(612334, { status: 'Done' }, _this);
A Lambda can only save or update data within its own app. To modify an entry in another app, create a Lambda in the target app to process the data, and trigger it via an HTTP request (GET/POST).
_entry.approval
Programmatically approve or reject a record within a workflow tier process.
Syntax
_entry.approval(<long>, <object>, <string-email>, _this);
Example
_entry.approval(612334, { status: 'approved', tier: {id: 12110}, data: {} }, _user.email, _this);
_entry.submit
Transition a dataset record into a formally submitted state.
Syntax
_entry.submit(<long>);
Example
_entry.submit(612334);
_entry.chart
Execute a pre-configured chart aggregation and retrieve the dataset results.
Syntax
_entry.chart(<long-chart-id>, <object-params>, <string-email>, _this);
Example
let data = _entry.chart(21220, {}, _user.email, _this);
_entry.chartAsMap
Transform a raw chart data object into a standard, easier-to-manipulate Javascript Map.
Syntax
_entry.chartAsMap(<object>);
Example
let mapData = _entry.chartAsMap(chartData);
_entry.chartize
Dynamically generate ad-hoc aggregations and charts on a specified dataset.
Syntax
_entry.chartize(<long>, <object>, <string-email>, _this);
Example
let aggr = _entry.chartize(10732, {agg: 'sum', by: '$.department.name', value: '$.total', series: '$.category'}, _user.email, _this);
To generate a chart for multiple categories or values, pass the fields as a comma-separated string. Example: let aggr = _entry.chartize(10732, {agg: 'sum', by: '$.department.name', value: '$.total,$.cost,$.profit'}, _user.email, _this);
_entry.delete
Permanently remove a specific record from the database.
Syntax
_entry.delete(<long>, <string-email>, _this);
Example
_entry.delete(612334, _user.email, _this);
A Lambda can only delete data within its own app. To delete an entry in another app, create a Lambda in the target app to process the deletion, and trigger it via an HTTP request (GET/POST).
_entry.count
Retrieve the total count of records matching specific filter criteria within a dataset.
Syntax
_entry.count(<long>, <object>, <string-email>, _this);
Example
let userCount = _entry.count(21225, { '$.status': 'active' }, _user.email, _this);
_entry.dataset
Load a paginated list of records from a specified dataset.
Syntax
_entry.dataset(<long>, <object>, <string-email>, _this);
Example
let items = _entry.dataset(21225, { '$.status': 'active' }, _user.email, _this);
_entry.flatDataset
Retrieve a flattened list of dataset records without the standard API envelope overhead.
Syntax
_entry.flatDataset(<long>, <object>, <string-email>, _this);
Example
let items = _entry.flatDataset(21225, { '$.status': 'active' }, _user.email, _this);
_entry.streamDataset
Efficiently stream large dataset records for memory-friendly, batch processing. Returns a Stream<Entry>.
Syntax
_entry.streamDataset(<long>, <object>, <string-email>, _this);
Example
let items = _entry.streamDataset(21225, { '$.status': 'active' }, _user.email, _this);
_env.IO_BASE_API_URL
Retrieve the base URL for the backend API system.
Syntax
let apiBase = _env.IO_BASE_API_URL;
Example
let api = _env.IO_BASE_API_URL;
_env.IO_BASE_URL
Retrieve the base URL for the backend platform.
Syntax
let sysBase = _env.IO_BASE_URL;
Example
let url = _env.IO_BASE_URL;
_env.UI_BASE_URL
Retrieve the base URL for the frontend user interface.
Syntax
let webBase = _env.UI_BASE_URL;
Example
let link = _env.UI_BASE_URL + '/home';
_env.UPLOAD_DIR
Retrieve the server directory path where uploaded files are permanently stored.
Syntax
let path = _env.UPLOAD_DIR;
Example
let dir = _env.UPLOAD_DIR;
_env.TMP_DIR
Retrieve the server directory path used for storing temporary files during processing.
Syntax
let tmpPath = _env.TMP_DIR;
Example
let tmp = _env.TMP_DIR;
_param
Extract specific query parameters from the incoming HTTP request URL or function invocation.
Syntax
let p = _param.<key>;
Example
let queryId = _param.entryId;
_param._body
Extract request body from the incoming HTTP request URL or function invocation.
Syntax
let rawBody = _param._body;
Example
let requestBodyObj = JSON.parse(_param._body);
_request.getParameter
Extract specific query parameters from the incoming HTTP request URL.
Syntax
_request.getParameter(<string>);
Example
let queryId = _request.getParameter('id');
Always prefer _param instead of _request.getParameter(). _param works consistently whether the Lambda is triggered by a standard HTTP request or by a Cogna function call.
_out.put
Inject data key-value pairs into the final JSON output of the Lambda response.
Syntax
_out.put(<string>, <any>);
Example
_out.put('result', { success: true });
_response
Access the raw HTTP response object to manipulate status codes, headers, or buffers.
Syntax
_response.setStatus(<integer>);
Example
_response.setStatus(200);
_response.sendRedirect
Programmatically redirect the user to a different URL upon Lambda completion.
Syntax
_response.sendRedirect(<string>);
Example
_response.sendRedirect('https://google.com');
Output debug information or variables directly into the server or Lambda execution logs.
Syntax
print(<string>);
Example
print('Debug message: ' + value);
_secret
Retrieve secure stored secret credentials by key name.
Syntax
let apiKey = _secret.<key_name>;
Example
let key = _secret.openai_api_key;
_log.error
Log an error message to the server console or execution logs for debugging.
Syntax
_log.error(<string>);
Example
_log.error('Error parsing parameter');
_log.success
Log a success message to the server console or execution logs.
Syntax
_log.success(<string>);
Example
_log.success('Successfully parsed parameter');
_log.info
Log an informational message to the server console or execution logs.
Syntax
_log.info(<string>);
Example
_log.info('Initialize scheduled lambda');
_live.publish
Broadcast a real-time message payload to a specific WebSocket channel from backend Lambda process flows.
Syntax
_live.publish(<array-of-channels>, <string-payload>);
Example
_live.publish(['updated-ticket-info-' + entryId], JSON.stringify(updatedTicket));
_jsoup.connect
Native server-side Jsoup wrapper for backend web scraping, parsing, and structured DOM crawling.
Syntax
_jsoup.connect(<string-url>).get();
Example
var doc = _jsoup.connect("https://en.wikipedia.org/").get();
doc.select("#mp-itn b a").forEach(h => print(h.text()));
_cogna.prompt
To perform prompt on the Cogna. Cogna should be of type 'Generate Text'.
Syntax
_cogna.prompt(cognaId, {
prompt: text
}, email);
Example
_cogna.prompt(11213, {
prompt: "What is the largest planet?"
}, _user.email);
_cogna.extract
To perform data extraction using the Cogna. Cogna should be of type 'Extract Data'.
Syntax
_cogna.extract(cognaId, {
text: text,
docList: [] // array of file url
});
Example
_cogna.extract(11214, {
text: "My name is Razif Baital",
docList: ["12134_44565_razif-baital-cv.pdf"] // array of file url
});
_cogna.summarize
To perform text summarization using the Cogna. Cogna should be of type 'Generate Text'.
Syntax
_cogna.summarize(cognaId, text, pointCount);
Example
_cogna.summarize(11215, "Artificial intelligence is transforming industries...", 3);
_cogna.translate
To translate text into a target language using the Cogna. Cogna should be of type 'Generate Text'.
Syntax
_cogna.translate(cognaId, text, lang);
Example
_cogna.translate(11216, "Good morning, how can I help you today?", "ms-MY");
_cogna.txtgenField
To generate or manipulate text based on a specified action (must be one of 'generate', 'summarize', or 'translate') directly using Cogna assigned to the specified field. Cogna should be of type 'Generate Text'.
Syntax
_cogna.txtgenField(fieldId, text, action);
Example
_cogna.txtgenField(14501, "the product is good and works really well", "summarize");
_cogna.classify
To classify text into predefined categories using the Cogna. Cogna should be of type 'Classify Text'.
Syntax
_cogna.classify(cognaId, text);
Example
_cogna.classify(11217, "I want to report an unauthorized charge on my credit card.");
_cogna.classifyField
To automatically classify text and populate the result directly using Cogna assigned to the specified field. Cogna should be of type 'Classify Text'.
Syntax
_cogna.classifyField(fieldId, text);
Example
_cogna.classifyField(14502, "The screen cracked when I dropped it out of the box.");
_cogna.classifyWithLlm
To classify text using a Large Language Model by providing specific category keys, descriptions, and rules. Cogna should be of type 'Classify Text'.
Syntax
_cogna.classifyWithLlm(cognaId, {key, description}, what, text, multiple);
Example
_cogna.classifyWithLlm(11218, {key: "URGENT", description: "System outages"}, "Support Ticket Classification", "Our production server just went down!", false);
_cogna.classifyWithEmbedding
To classify text using vector embeddings based on semantic similarity and a minimum confidence score threshold. Cogna should be of type 'Classify Text'.
Syntax
_cogna.classifyWithEmbedding(cognaId, text, minScore, multiple);
Example
_cogna.classifyWithEmbedding(11219, "How do I reset my account password?", 0.85, true);
_cogna.generateImage
To generate an image from a natural language text prompt using the Cogna. Cogna should be of type 'Generate Image'.
Syntax
_cogna.generateImage(cognaId, text);
Example
_cogna.generateImage(11220, "A futuristic cyberpunk city in Malaysia at night, cinematic lighting, 4k resolution");
_cogna.findSimilarity
To find semantically similar items or text within a stored dataset using vector search. Cogna should be of type 'Similarity Search'.
Syntax
_cogna.findSimilarity(cognaId, search, maxResult, minScore);
Example
_cogna.findSimilarity(11221, "error connecting to database", 5, 0.75);
_cogna.generateImageField
To generate an image from a text prompt and directly bind or populate the resulting image using Cogna assigned to the specified field. Cogna should be of type 'Generate Image'.
Syntax
_cogna.generateImageField(fieldId, text);
Example
_cogna.generateImageField(14503, "Minimalist geometric background with dark blue and gold accents");
_krypta.call
To execute a smart contract function or transaction on the blockchain using a specified wallet.
Syntax
_krypta.call(walletId, functionName, args);
Example
_krypta.call(889, "transferFunds", ["0x71C...8947", 1000]);
_krypta.logs
To retrieve blockchain transaction logs or event emissions associated with a specific wallet or smart contract interaction.
Syntax
_krypta.logs(walletId, eventName);
Example
_krypta.logs(889, "PaymentReceived");
_krypta.verify
To verify the status, block confirmation, and authenticity of a blockchain transaction using its transaction hash.
Syntax
_krypta.verify(walletId, txHash);
Example
_krypta.verify(889, "0x5a2d71848f95c6130fd80718588f8d95155fbe91176bfa25492acfe107c6f09e");
_util.ocr
To perform Optical Character Recognition (OCR) to extract text from an image or document file URL in a specified language.
Syntax
_util.ocr(pathUrl, lang);
Example
_util.ocr("122212_12234_receipt.jpeg", "en");
_util.atob
To decode a Base64-encoded string back into standard text (ASCII/UTF-8).
Syntax
_util.atob(textToDecode);
Example
_util.atob("SGVsbG8sIFJhemlmIQ==");
_util.btoa
To encode a standard text string into a Base64-encoded representation.
Syntax
_util.btoa(textToEncode);
Example
_util.btoa("Hello, Razif!");
_util.hash
To generate a cryptographic hash of a given text using a specified algorithm (e.g., 'SHA-256', 'MD5').
Syntax
_util.hash(textToEncode, algorithm);
Example
_util.hash("my_secure_password_123", "SHA-256");
_util.readExcel
To read and parse data from an Excel spreadsheet file into a structured array or JSON format.
Syntax
_util.readExcel(filePath);
Example
_util.readExcel("files/uploads/2026_financial_report.xlsx");
_util.replaceMulti
To perform multiple string replacements simultaneously within a text using a key-value mapping object.
Syntax
_util.replaceMulti(text, {map});
Example
let newText = _util.replaceMulti("My name is Razif", {
"My": "Your",
"Razif": "Azmi"
});
// newText will be "Your name is Azmi"
Form Item Properties
label
Display label for the form item.
Syntax
$el$.<field-code>.label = <string>;
Example
$el$.first_name.label = "First Name";
hideLabel
Hide the label while keeping the field visible.
Syntax
$el$.<field-code>.hideLabel = <boolean>;
Example
$el$.first_name.hideLabel = true;
hidden
Completely hide the form item.
Syntax
$el$.<field-code>.hidden = <boolean>;
Example
$el$.first_name.hidden = true;
hint
Helper text shown below the field.
Syntax
$el$.<field-code>.hint = <string>;
Example
$el$.first_name.hint = "Please input matching official government records.";
placeholder
Placeholder text for inputs.
Syntax
$el$.<field-code>.placeholder = <string>;
Example
$el$.email.placeholder = "username@unimas.my";
readOnly
Make the field read-only.
Syntax
$el$.<field-code>.readOnly = <boolean>;
Example
$el$.username.readOnly = true;
size
Bootstrap column class (e.g. col-sm-6).
Syntax
$el$.<field-code>.size = <string>;
Example
$el$.first_name.size = "col-sm-6";
v.required
Marks field as required.
Syntax
$el$.<field-code>.v.required = <boolean>;
Example
$el$.first_name.v.required = true;
v.maxDate
Max date (UNIX timestamp) for date fields.
Syntax
$el$.<field-code>.v.maxDate = <long>;
Example
$el$.birth_date.v.maxDate = 1718000000; // Epoch timestamp for June 10, 2024
v.minDate
Min date (UNIX timestamp) for date fields.
Syntax
$el$.<field-code>.v.minDate = <long>;
Example
$el$.birth_date.v.minDate = 946684800; // Epoch timestamp for Jan 1, 2000
v.max
Maximum numeric value.
Syntax
$el$.<field-code>.v.max = <integer>;
Example
$el$.score.v.max = 100;
v.min
Minimum numeric value.
Syntax
$el$.<field-code>.v.min = <integer>;
Example
$el$.age.v.min = 18;
v.maxlength
Maximum length for text input.
Syntax
$el$.<field-code>.v.maxlength = <long>;
Example
$el$.first_name.v.maxlength = 250;
v.minlength
Minimum length for text input.
Syntax
$el$.<field-code>.v.minlength = <long>;
Example
$el$.reason.v.minlength = 15;
v.pattern
Regex pattern for text validation.
Syntax
$el$.<field-code>.v.pattern = <string>;
Example
$el$.postal_code.v.pattern = "^[0-9]{5}$";
v.maxSize
Max file size for uploads (in bits).
Syntax
$el$.<field-code>.v.maxSize = <long>;
Example
$el$.attachment.v.maxSize = 10485760; // 10MB in bits
v.mask
Input mask (formatting) pattern.
Syntax
$el$.<field-code>.v.mask = <string>;
Example
$el$.phone.v.mask = "+60 ##-### ####";
Date Format Options (dayjs)
Format options available for use with the dayjs() formatting utility.