Get a Field Value Action with Task or Appointment
After performing the initial steps, get values from the Task and Appointment objects
with getRecordByContext and getFieldValue global
functions.
const getFieldValue = await $modules.uiEventsFramework.getFieldValue('ObjectName.FieldName', callGetRecordByContext.response);
The following action chain listens for the OnChildRecordOpen event
and retrieves the Subject value from an Appointment child record.
When a Task or Appointment create or edit page opens, the event provides the child
record’s objectId and objectType. The action chain
uses these values with getRecordByContext to obtain the child
record’s UEF context. It then uses that context to retrieve the
Appointment.Subject field value.
define([
'vb/action/actionChain',
'vb/action/actions',
'vb/action/actionUtils',
], (
ActionChain,
Actions,
ActionUtils
) => {
'use strict';
class recordLevelEventListener extends ActionChain {
/**
* @param {Object} context
* @param {Object} params
* @param {{data:any,eventName:string,recordType:string}} params.event
*/
async run(context, { event }) {
const { $page, $flow, $application, $base, $extension, $constants, $variables, $modules } = context;
switch (event.eventName) {
case 'OnChildRecordOpen':
const callGetRecordByContext = await $modules.uiEventsFramework.getRecordByContext($variables.uefContext,
{ objectId: event.data.objectId, objectType: event.data.objectType });
const callGetFieldValue = await $modules.uiEventsFramework.getFieldValue('Appointment.Subject', callGetRecordByContext.response);
break;
}
}
}
return recordLevelEventListener;
});
| Parameter | Description |
|---|---|
event.eventName |
Identifies the received UEF event. The action chain handles
OnChildRecordOpen. |
event.data.objectId |
Unique ID of the opened Task or Appointment record. |
event.data.objectType |
Business object type of the opened child record. |
getRecordByContext |
Retrieves the UEF context for the opened child record. |
callGetRecordByContext.response |
The returned UEF context for the child record. |
getFieldValue |
Retrieves a field value using the child record’s UEF context. |
Appointment.Subject |
The field identifier for the Appointment Subject field. |