Implements Process Services form methods
import { FormService, FormEvent, FormFieldEvent } from '@alfresco/adf-core';
@Component(...)
class MyComponent {
constructor(formService: FormService) {
formService.formLoaded.subscribe(
(e: FormEvent) => {
console.log(`Form loaded: ${e.form.id}`);
}
);
formService.formFieldValueChanged.subscribe(
(e: FormFieldEvent) => {
console.log(`Field value changed. Form: ${e.form.id}, Field: ${e.field.id}, Value: ${e.field.value}`);
}
);
}
}
Name | Args Type | Description |
---|---|---|
formLoaded | FormEvent | Raised when form has been loaded or reloaded |
formFieldValueChanged | FormFieldEvent | Raised when input values change |
taskCompleted | FormEvent | Raised when a task is completed successfully |
taskCompletedError | FormErrorEvent | Raised when a task is completed unsuccessfully |
taskSaved | FormEvent | Raised when a task is saved successfully |
taskSavedError | FormErrorEvent | Raised when a task is saved unsuccessfully |
executeOutcome | FormOutcomeEvent | Raised when a form outcome is executed |
formEvents | Event | You can subscribe to this event to listen : ( click, blur, change, focus, focusin, focusout, input, invalid, select) of any elements in the form , see doc below |
validateForm | ValidateFormEvent | Raised each time a form is validated. You can use it to provide custom validation or prevent default behaviour. |
validateFormField | ValidateFormFieldEvent | Raised each time a form field is validated. You can use it to provide custom validation or prevent default behaviour. |
parseForm(json: any, data?:
FormValues,
readOnly: boolean = false):
FormModel
Parses JSON data to create a corresponding Form
model.
json
- JSON to create the formdata
- (Optional) Values for the form fieldsreadOnly
- Should the form fields be read-only?createFormFromANode(formName: string):
Observable
<any>
Create a Form
with a field for each metadata property.
formName
- Name of the new formcreateForm(formName: string):
Observable
<any>
Create a Form
.
formName
- Name of the new formsaveForm(formId: string, formModel: FormDefinitionModel):
Observable
<any>
Saves a form.
formId
- ID of the form to save formModel
- Model
data for the formsearchFrom(name: string):
Observable
<any>
Search for a form by name.
name
- The form name to search forgetForms():
Observable
<any>
Gets all the forms.
getProcessDefinitions():
Observable
<any>
Get Process Definitions
getProcessVariablesById(processInstanceId: string):
Observable
<any[]>
Get instance variables for a process.
processInstanceId
- ID of the target processgetTasks():
Observable
<any>
Gets all the tasks.
getTask(taskId: string):
Observable
<any>
Gets a task.
taskId
- Task IdsaveTaskForm(taskId: string, formValues: FormValues):
Observable
<any>
Save Task Form
.
taskId
- Task IdformValues
- Form
ValuescompleteTaskForm(taskId: string, formValues:
FormValues,
outcome?: string):
Observable
<any>
Complete Task Form
getTaskForm(taskId: string):
Observable
<any>
Get Form
related to a taskId
taskId
- Task IdgetFormDefinitionById(formId: string):
Observable
<any>
Get Form
Definition
formId
- Form
IdgetFormDefinitionByName(name: string):
Observable
<any>
Returns form definition with a given name.
name
- The form namegetStartFormInstance(processId: string):
Observable
<any>
Get start form instance for a given processId
processId
- Process definition IDgetProcessInstance(processId: string):
Observable
<any>
Gets a process instance.
processId
- ID of the process to getgetStartFormDefinition(processId: string):
Observable
<any>
Get start form definition for a given process
processId
- Process definition IDgetRestFieldValues(taskId: string, field: string):
Observable
<any>
Gets values of fields populated by a REST backend.
taskId
- Task identifierfield
- Field identifiergetRestFieldValuesByProcessId(processDefinitionId: string, field: string):
Observable
<any>
Gets values of fields populated by a REST backend using a process ID.
processDefinitionId
- Process identifierfield
- Field identifiergetRestFieldValuesColumnByProcessId(processDefinitionId: string, field: string, column?: string):
Observable
<any>
Gets column values of fields populated by a REST backend using a process ID.
processDefinitionId
- Process identifierfield
- Field identifiercolumn
- (Optional) Column identifiergetRestFieldValuesColumn(taskId: string, field: string, column?: string):
Observable
<any>
Gets column values of fields populated by a REST backend.
taskId
- Task identifierfield
- Field identifiercolumn
- (Optional) Column identifiergetUserProfileImageApi(userId: number): string
Returns a URL for the profile picture of a user.
userId
- ID of the target usergetWorkflowUsers(filter: string, groupId?: string): Observable<UserProcessModel[]>
Gets a list of workflow users.
filter
- Filter to select specific usersgroupId
- (Optional) Group ID for the searchgetWorkflowGroups(filter: string, groupId?: string): Observable<GroupModel[]>
Gets a list of groups in a workflow.
filter
- Filter to select specific groupsgroupId
- (Optional) Group ID for the searchgetFormId(res: any): string
Gets the ID of a form.
res
- Object representing a formtoJson(res: any): any
Creates a JSON representation of form data.
res
- Object representing form datatoJsonArray(res: any): any
Creates a JSON array representation of form data.
res
- Object representing form datahandleError(error: any):
Observable
<any>
Reports an error message.
error
- Data object with optional `message` and `status` fields for the error© 2023 Alfresco Software, Inc. All Rights Reserved.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.