Save action with Task and Appointment
After getting response from getRecordByContext, trigger the save
action Save Task and Appointment objects with SaveRecord global
function.
const callSaveAction = await $modules.uiEventsFramework.SaveRecord(callGetRecordByContext.response);
The following action chain listens for the OnChildRecordOpen event and
saves the 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. Users can Perform save operation with the UEF Context.
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 setFieldValue = await $modules.uiEventsFramework.setFieldValue('Task.Subject', 'Value to SET', callGetRecordByContext.response);
const callSaveAction = await $modules.uiEventsFramework.SaveRecord(callGetRecordByContext.response);
break;
}
}
}
return recordLevelEventListener;
});
| Parameters | 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. |
setFieldValue |
Updates a field value using the child record’s UEF context. |
Task.Subject |
The field identifier for the Appointment Subject field. |