Documentation Index
Fetch the complete documentation index at: https://docs.codenullapp.com/llms.txt
Use this file to discover all available pages before exploring further.
A submit datasource allows a Form component to save the data.
You can perform two types of actions
Automatic generation
This feature is helpful if you don’t want to start from scratch to configure your submit datasource
Entities: Choose the entity you want to save/update
Fields: Choose the fields you want to save in the submit datasource
Query type: choose create or update
Then click on the Generate button. This will generate the basic submit datasource configuration for you
There are two main configurations needed to configure a submit action
Query
Here, you should define the GraphQL mutation you want to execute during the submit action
mutation createPersona($data: PersonaInput) {
createPersona(data: $data) {
Id
Foto
Identificacion
NombreCompleto
Edad
Sexo
Telefono
Email
}
}
Datasource variables
Generate Variables Using Context Value: If true, the datasource will take all values in the form context and submit them
Variables List: Here, you can add all data values you want to send in the request. You can combine this option with the Generate variables using context value.
Other settings
Refetch Queries: Allows to execute a query, which is helpful, for instance, when you want to refresh the datasource of the form and get the data from the server after the submit is completed
Data Path: This is useful when you want to use the Generate Variables Using Context Value
On Completed Configurations: This will determine the behaviour after the submit action is completed
Mutation examples
Submit a single entity
mutation createPersona($data: PersonaInput) {
createPersona(data: $data) {
Id
Foto
Identificacion
NombreCompleto
Edad
Sexo
Telefono
Email
}
}
Submit an entity with child entities (Array)
Codenull allows the creation of multiple entities in the same request. You need to make sure to send all data in the same way as the tables are related to each other.
In the next example, a Seguimiento has multiple Etapas
# This mutation will create a Seguimiento but also the Etapas child´s entity
mutation createSeguimiento($data: SeguimientoInput) {
createSeguimiento(data: $data) {
Id
Nombre
IglesiaId
Etapas {
Id
SeguimientoId
Nombre
Descripcion
}
}
}
The variable data.Etapas should have the array of Etapas that will be created among the Seguimiento
This is how the request data should look
The next is a full example of a subimt with a parent and child entities:
// Query
mutation createUsuario($data: UsuarioInput) {
createUsuario(data: $data){
Id
Nombre
Apellidos
Correo
IglesiaId
PersonaId
RolesxUsuarios{
Id
UsuarioId
RoleId
}
}
}
// Variables
[
{
"type": "nested",
"name": "data",
"variables": [
{
"type": "context",
"name": "Nombre",
"value": "Nombre"
},
{
"type": "context",
"name": "Apellidos",
"value": "Apellidos"
},
{
"type": "context",
"name": "Identificacion",
"value": "Identificacion"
},
{
"type": "session",
"name": "IglesiaId",
"value": "user.IglesiaId"
},
{
"type": "context",
"name": "PersonaId",
"value": "PersonaId"
},
{
"type": "context",
"name": "Correo",
"value": "Correo"
},
{
"type": "context",
"name": "Clave",
"value": "Clave"
},
{
"type": "context",
"name": "RolesxUsuarios",
"value": "RolesxUsuarios"
}
]
}
],
}
Submit an entity with a parent entity
Query
mutation createUser($data: UsuarioInput) {
signUp(data: $data) {
Id
IglesiaId
Correo
Iglesia {
Id
Nombre
Telefono
Direccion
Pais
Personas{
Id
IglesiaId
Identificacion
NombreCompleto
Clasificacion
Perfil
FechaNacimiento
Edad
Email
}
}
RolesxUsuarios {
Id
RoleId
}
}
}
Variables List
Agent Instructions: Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.
Perform an HTTP GET request on the current page URL with the ask query parameter:
GET https://codenull.gitbook.io/dev/configurations/components/datasources/submit-datasource-graphql.md?ask=<question>
The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.
Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.