Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation for create new copy #914

Merged
merged 4 commits into from
May 10, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion content/api/models/app-metadata/_index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,16 @@ Only one of the two settings should be used at a time.

## CopyInstanceSettings

Configure if copying data from an archived instance is allowed and what datatypes and datafields that should be excluded in the new instance
Configure if copying data from an archived instance is allowed and what datatypes and datafields that should be excluded in the new instance.

| Name | Description |
| ------------------ | -------------------------------------------------------------------------------- |
| enabled | true/false if its possible to create a copy of an instance. |
| excludedDataTypes | List of DataTypes that should be excluded when a new copy is made. |
| excludedDataFields | List of fields in the DataModel that should be excluded when a new copy is made. |

The portal message box will show a link called [Create new copy](/app/development/configuration/messagebox/create_copy/) when the user selects an archived instance.

## OnEntry

Configure how the application behaves when a user opens the application without an instance id set
Expand Down
2 changes: 2 additions & 0 deletions content/api/models/app-metadata/_index.nb.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ Configure if copying data from an archived instance is allowed and what datatype
| excludedDataTypes | List of DataTypes that should be excluded when a new copy is made. |
| excludedDataFields | List of fields in the DataModel that should be excluded when a new copy is made. |

Meldingsboksen i portalen vil hvise en link med teksten [Lag ny kopi](/nb/app/development/configuration/messagebox/create_copy/) hvis brukeren velger en arkivert instans.

## OnEntry

Configure how the application behaves when a user opens the application without an instance id set
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
title: Create new copy
linktitle: Create copy
description: This page will be about how to configure the create new copy functionality in an app.
SandGrainOne marked this conversation as resolved.
Show resolved Hide resolved
weight: 200
---

## Description
The primary purpose of the create new copy feature is to make it easy for a user of the portal to start a new submission by copying a previously completed submission. The user just need to navigate to the instance they would like to copy and then click on the link Create new copy". The App will then create a new instance and openit in the browser ready for form filling with fields already filled in with data from the original.

## Configuration

{{% notice info %}}
The configuration has a retroactive effect and will also apply to previously created instances.
{{% /notice %}}

In addition to turning the functionality on and off, it is possible to exclude data types and data fields in a schema from being copied.

| Name | Description |
| ------------------ | -------------------------------------------------------------------------------- |
| enabled | true/false if its possible to create a copy of an instance. |
| excludedDataTypes | List of DataTypes that should be excluded when a new copy is made. |
| excludedDataFields | List of fields in the DataModel that should be excluded when a new copy is made. |

### Exclusion of data types

It is possible to provide a list of data types you don't want to be copied over to the new copy, but which data type that can be copies are already fairly limited. This list of excluded data types have therefor limited effect. The copy feature will only copy data elementes related to a schema/form. This means that no attachments will be copied. I addition to this the data type being copied needs to be associated with the first step in the process for the app.
SandGrainOne marked this conversation as resolved.
Show resolved Hide resolved

### Exclusion of data fields

The list of excluded fields can be used to indicate which fields you don't want to be copied over to the new data element. The prupose of this feature is to empty fields you know will need to vary from one submission to the next. This could be a field that indicate which quarter of the year the submission is relevant for. Here the app developer will need to consider the different fields, the usage of the app and what would be the best for the user. The selected fields should be indicated with dot-notation in the same way as when doing data binding in layout files.
SandGrainOne marked this conversation as resolved.
Show resolved Hide resolved

## Examples

COnfiguration for turning the *Create new copy* feature on and off.
SandGrainOne marked this conversation as resolved.
Show resolved Hide resolved

```json
"copyInstanceSettings": {
"enabled": true
}
```

Configuration where the Create new copy is activated and where two fields in two separate groups within the model is being excluded.

```json
"copyInstanceSettings": {
"enabled": true,
"excludedDataFields": [
"group1.felt2",
"group23.felt21"
]
}
```
## Programing interface

During the copying of an instance the logic will perform a method call to **IInstantiationProcessor.DataCreation**. This makes it possible to add programatic changes to the data as it's being copied.
SandGrainOne marked this conversation as resolved.
Show resolved Hide resolved
Under kopiering av skjema vil logikken utføre metode kall mot **IInstantiationProcessor.DataCreation**. Dette skal gjøre det mulig å gjøre programatiske endringer i data som blir kopiert. [Programatic prefill](/app/development/data/prefill/custom/).
SandGrainOne marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
title: Lag ny kopi
linktitle: Lag kopi
description: Denne siden vil handle om hvordan man konfigurerer lag ny kopi funksjonaliteten i en app.
SandGrainOne marked this conversation as resolved.
Show resolved Hide resolved
weight: 200
---

## Beskrivelse
Hovedhensikten med **Lag ny kopi** funksjonaliteten er at det skal være enkelt for en bruker av portalen å starte på en ny innsending ved å kopiere en tidligere fullført innsending. Brukeren skal bare måtte navigere seg frem til instansen vedkommende ønsker å kopiere for så å klikke på linken Lag ny Kopi. Appen vil lage en kopi og åpne den i nettleseren klar for utfylling med felter ferdig utfylt med data fra orginalen.

## Konfigurasjon

{{% notice info %}}
Konfigurasjonen har tilbakevirkende kraft på tidligere arkiverte instanser.
{{% /notice %}}

I tillegg til at funksjonaliteten kan skrues av og på er det mulig å ekskludere data typer og data felter i et skjema fra å bli kopiert.

| Navn | Beskrivelse |
| ------------------ | ---------------------------------------------------------------------------------------------------- |
| enabled | true/false for å indikere om funksjonaliteten er skrudd på eller ikke. Standard verdi er av(false). |
| excludedDataTypes | Liste med navn på data typer som ikke skal kopieres over. |
| excludedDataFields | Liste med navn på felter som ikke skal opieres over. |

### Ekskludering av data typer

Det er mulig å angi en liste over data typer man ikke ønsker at skal kopieres over i ny kopi, men hva man kan kopiere av data typer er allerede meget begrenset. Denne listen med data typer har derfor begrenset funksjon i dagens løsning. Kopierings funksjonaliteten vil bare kopiere data elementer relatert til et skjema. Dette betyr at det ikke blir laget kopier av vedlegg. I tillegg må data typen må være knyttet til første steg i prosessen til appen.
SandGrainOne marked this conversation as resolved.
Show resolved Hide resolved

### Ekskludering av felter

I listen med ekskluderte felter kan man angi navnene på felter man ikke ønsker å kopiere over i ny kopi. Hensikten med denne funksjonaliteten er å få tømt data i felter man vet må variere fra en innsending til en annen. Det kan for eksempel være et felt som indikerer hvilke kvartal i året den nye innsendingen skal gjelde for. Her må apputvikler vurdere behovene og hva slags type bruk som blir mest vanlig. Felter angis ved hjelp av dot-notasjon på samme måte som man gjør ved data binding i layout filer.
SandGrainOne marked this conversation as resolved.
Show resolved Hide resolved

## Eksempler

Konfigurasjon for å skru på *Lag ny kopi* uten ekskluderinger.

```json
"copyInstanceSettings": {
"enabled": true
}
```

Konfigurasjon hvor Lag ny kopi blir aktivert samtidig som det legges til ekskludering av to ulike felter fra to modeller i skjema.

```json
"copyInstanceSettings": {
"enabled": true,
"excludedDataFields": [
"group1.felt2",
"group23.felt21"
]
}
```
## Programatiske endringer

Under kopiering av skjema vil logikken utføre metode kall mot **IInstantiationProcessor.DataCreation**. Dette skal gjøre det mulig å gjøre programatiske endringer i data som blir kopiert. [Programatisk prefill](/nb/app/development/data/prefill/custom/).