Technical¶
Components¶
- Endpoints
- Web components
- Action pad app
Table and Field Definitions Lime CRM¶
- The protocol is the the protocol instance that is added to the parent. It contains answers.
- The answers are the protocol items (including answer type).
- The parent can be anything that a protocol could be attached to.
The table for protocols is not configurable.
limetype | property | option key | type | configurable |
---|---|---|---|---|
limepkg_form_protocol | No | |||
limepkg_form_protocol | key | text | No | |
limepkg_form_protocol | title | text | No | |
limepkg_form_protocol | description | text | No | |
limepkg_form_protocol | limepkg_form_anwer | hasmany (limepkg_form_answer) | No | |
limepkg_form_protocol | parent | belongsto (parent) | Yes |
The table for answers is not configurable.
limetype | property | option key | type | configurable |
---|---|---|---|---|
limepkg_form_answer | No | |||
limepkg_form_answer | title | text | No | |
limepkg_form_answer | description | text | No | |
limepkg_form_answer | answer | text | No | |
limepkg_form_answer | comment | text | No | |
limepkg_form_answer | mandatory | yesno | No | |
limepkg_form_answer | type | text | No | |
limepkg_form_answer | options | text | No | |
limepkg_form_answer | multiselect | yesno | No | |
limepkg_form_answer | limepkg_form_protocol | belongsto (limepkg_form_protocol) | No |
The table for the parent could be anything. It just needs a relation to the protocols.
limetype | property | option key | type | configurable |
---|---|---|---|---|
parent | Yes | |||
parent | limepkg_form_protocol | hasmany (limepkg_form_protocol) | Yes |
Internal Endpoints¶
Getting all forms/protocols with answers on a lime object¶
/limepkg-form/<limetype_name>/<limeobject_id>/'
GET
Response
{
"protocols": [
{
"id": "",
"key": "",
"title": "",
"description": "",
"items": [
{
"id": "",
"title": "",
"description": "",
"type": "",
"options": [""],
"mandatory": false,
"multiselect": false,
"answer": "",
"comment": ""
}
],
},
]
}
Create and attach a new form/protocol for a lime object¶
/limepkg-form/
POST
Payload
{
"limeobject": {
"id": 1001,
"limetype": "workorder"
},
"forms_config": [
{
"key": "",
"title": "",
"description": "",
"items": [
{
"title": "",
"description": "",
"type_": "",
"options": [""],
"mandatory": false,
"multiselect": false,
}
]
}
]
}
Response
{
"message": "..."
}
Update the answers on a form/protocol¶
/limepkg-form/
PUT
Payload
{
"PROTOCOL_ID" : {
"ITEM_ID": ""
}
}
Response
{
"message": "..."
}
Remove a form/protocol from a lime object¶
/limepkg-form/<limetype_name>/<limeobject_id>/<protocol_id>/
DELETE
Response
{
"message": "..."
}
Web Components¶
lwc-limepkg-form¶
Intended to be used in the web client as a tab on the parent object.
lwc-limepkg-form-dialog¶
Allows the user to search for protocols and add them to the parent object.
Commands¶
Command default behavior can be overridden subscribing to the command.received
event. See platform docs for details.
Add Picture Command¶
The limepkg_form.addpicture
command is used to attach a picture to a protocol
item and is not intended to be used from other places than as an action in
form protocols.
property | type | description |
---|---|---|
context | LimeWebComponentContext | |
formInfo | FormInfo | The limel-form data |
import { FormInfo } from '@limetech/lime-elements';
import {
Command,
LimeWebComponentContext,
} from '@limetech/lime-web-components-interfaces';
import { FormItemAction } from '../../components/interface/config';
@Command({
id: 'limepkg_form.addpicture',
})
export class AddPictureCommand implements FormItemAction {
formInfo: FormInfo;
context: LimeWebComponentContext;
}
Events¶
Application events can be subscribed to using the event dispatcher service in the platform. See platform docs for details.
limepkg-form
does not yet provide any application level events that can be
subscribed to.
Action Pad¶
The limepkg-form
action pad app makes it possible to add and delete protocols on parents as well as view the answers.
To add the app to an action pad just copy in this:
<div
data-app="{
app:'limepkg_form',
config:{}
}"
></div>