Solution and explanation on knowledge checks

On this page:

🚧 Update in progress. Updated solutions and explanations for knowledge checks can be found within each updated module.

Solution - Application code

Module 1 - Knowledge check: Upload data model

Which data is it the service owner wishes to collect here?

The data model consists of one main element: innflytter (newcomer). This element consists of some sub elements like Fornavn, Etternavn and Mellomnavn. Additionally there are some complex elements such as Adresse, Kontaktinformasjon and Arbeidsinformasjon.

Which effect has <minOccurs> in the data model? You may notice that the field has different value for Innflytter.Fornavn and Innflytter.Mellomnavn

minOccurs_ says something about how many times times the object must at least be mentioned.

minOccurs = 0 means that the field is not required, minOccurs=1 means that you expect the field to appear at least once in the model.

Which other properties is set on the field Innflytter.Mellomnavn?

nillable=trueis defined on the mellomnavn-field. This means that null is a legal value for middle name.

A .C#, .metadata.json and .schema.json file has been generated in addition to the .xsd file you uploaded. What is the correlation between these files?

The mentioned files are all generated from the xsd-description of the data model. They describe all the data and the data field’s properties. All properties are not necessarily transferred to all the files, but the sum of them should cover what is described in the xsd-file.

  • The C#-model is used by app backend to deserialize the data and make it available for processing and validation.
  • .metadata.json is used in Altinn Studio to easily connect components and dynamics to the data fields.
  • The .schema.json file is used by altinn-app-frontend for form validation on the client side.

Some restrictions from the data model is not transferred to the C#-file, which ones? Some new properties has also been added, which ones?

  • minOccurs, maxOccurs are not transferred to the model.
  • nillable is only transferred on some types e.g. decimal.
  • XmlElement.Order is introduced as a decoration on each property.
    • This ensures that the order of the elements will stay the same when the data is serialized to xml.

Module 1 - Knowledge check: Set up components

Can you locate the component connected to the email-field?

There are several ways to locate a field in FormLayout.json. The fastest way is often to search the name of the field that the component is attached to. You can find this under dataModelBindings.

Email in formlayout

What change is required in this file if the email-field is no longer required?

To make a field optional you can change “required=true” to “required=false”

By changing one line in FormLayout.json it is possible to change the component attached to middle name to an input field for a long answer. What change is required?

The solution is to change the type field from Input to TextArea as shown below

  "id": "mellomnavn",
  "type": "TextArea",
  "textResourceBindings": {
    "title": "innflytter.mellomnavn"
  "dataModelBindings": {
    "simpleBinding": "Innflytter.Mellomnavn"
  "required": true,
  "readOnly": false

Module 1 - Knowledge check: Edit texts

How do you implement english language support in the application?

_resources.nb.json will be autogenerated in all new repositories in the folder config/texts. To support english in an application, the file resources.en.json must be created. Note that the language property at the top of the file must be set to en.

"language": "en",
"resources": []

If we one day were to support ukrainian, which language code would you then need to annotate the file with?

According to the list of ISO 639-1 codes, the code for Ukrainian is uk.

If a text key referred to in FormLayout.json does not exist in the text resources, what will appear on the screen?

If said text key does not exist in the text resource file, the text key will be displayed instead.

Module 2 - Knowledge check: Add info page

Which file in the application repository has to be adjusted if you wish to manually change the page order of existing pages?

In App/ui/Settings.json you can find the page order.

To adjust the page order, the list under pages.order must be changed to represent desired order.

If you wish to rename a page, but Altinn Studio is not available, which files will need to be updated?

  • Settings.json: change the name of the page under pages.order
  • App/ui/layouts: change the file name of the page that you’re changing the name of

How can you get a text to break if the text string is not long enough to break naturally?

All text resources support markdown and thus html-notation, so by using <br/> you will be able to force text breaks.

Module 2 - Knowledge check: Alternative workflow

If a user goes back and changes their answer on the info page, will they then be displayed the data collecting pages? If not, what changes can you introduce to support this in your application?

In App/logic/App.cs you can find the method GetPageOrder. This is called on from the frontend when you leave a component that has configured "triggers": ["calculatePageOrder"] in the layout file.

Take a look at the solution for this module to see how this is done. Files of interest are App/ui/layouts/info.json and App/logic/App.cs.

If dynamic tracks is implemented further into the workflow and a user changes a choice, what will happen with the form data that was filled out prior to this, if the page is now hidden from the user?

If you have implemented this type of logic in an application where you can continue to submitting for multiple tracks, the data on the page(s) that are now hidden for the user should be nulled.

Module 2 - Knowledge check: Prefill of personal information

Is it possible to change a prefilled value once it is set?

Yes, if you don’t make any changes a standard component wih prefilled data will be editable.

How can you prevent a user from changing a prefilled value?

The component can be set to readonly. Alternatively you can run validations of the data server side to verify that the data in the field matches the data from the prefill page. This can be done in the process- or validation logic of the application.

Not all norwegian citizens have a social security number, some get assigned a D-number. How will you have to adjust your code to take this into account if for example age is based on a F-number or D-number that the user themselves enter?

A D-number is eleven digit, like normal social security numbers, and consists of a modified six digit birthdate and a five digit personal number. The birth date is modified by adding 4 to the first digit: a person born january 1st 1980 will then get the birth date 410180, while one born january 31st 1980 will get 710180.

One way to go from any f- or d-number to a string for birth date on the format dd-MM-yy is:

public static string GetDOB(string fOrDNumber){
  List<string> firstCharsInDNumber = new(){"4", "5", "6", "7" };

  var fOrDNumberArray = fOrDNumber.ToCharArray();

  char[] dobArray = new char[6];
  Array.Copy(fOrDNumberArray, dobArray, 6);

  char firstChar = dobArray[0];
  int firstInt = 0;

    firstInt = firstChar - 4;
    dobArray[0] = (char)firstInt;

  string dobString = $"{dobArray[0]}{dobArray[1]}.{dobArray[2]}{dobArray[3]}.{dobArray[4]}{dobArray[5]}";
  // verify that it is a valid date
  DateTime.ParseExact(dobString, "dd.MM.yy", CultureInfo.InvariantCulture);
  return dobString;

Module 3 - Knowledge check: Deploy application

Is it possible to have two versions of one application in TT02 at the same time?

No, it is only possible to have one version of the application out in the environment at once. If you deploy a different version, the existing version of the application will be overwritten.

What happens if you deploy the same version of the application to the environment once more?

All operations connected to deploy will run again. Resource texts and other metadata are saved in Altinn Platform, and deploy pipeline to toll out the application to the cluster will also run.

However, no new pods will be spun up in connection to this since there are now real changes on the service running in the environment.

Will the application be available immediately after deployment?

Yes, the service will be immediately available after deployment. If the status is green in Altinn Studio you will be able to run the application.

Is it possible to remove an application from the environment after deployment?

As of March 2022 it is not possible for a service owner to remove an application from an environment themselves once it has been deployed. The service owner would have to contact support. By the end of the year a function where the service owner themselves can do this will be made available.

Module 4 - Knowledge check: Collection of work information

What is the difference between static and dynamic options?

Static options are defined build time and will, as the name suggests, be static during their lifetime. Dynamic options are collected runtime and can therefore get a value based on the time of the day or other dynamic values.

What will the area of use be for secured dynamic options?

Options are by default openly available and the API will be reachable for those who are not logged in to the app. There are also no restrictions on roles or anything else. In some cases you might want to expose options that are sensitive. This is where safe dynamic options come in, where you get automatic verification that the person making the call has Instance.Read rights.

Module 4 - Knowledge check: Differentiated data base for public and private sector

If a list of options is set up with mapping towards the data model - what happens when the field in question changes value?

If a field in the mapping is updated, the app-frontend will make another call to retrieve the options list. This opens up for the possibility to dynamically show options that are tailored to the user’s previously submitted data.

What happens with the chosen value on a field connected to an option-list that is retrieved over again from the server side?

If the user e.g. has chosen a municipality from a dropdown list containing municipalities set up with mapping on Fylke , then returns and changes the field Fylke, the answer in the municipality list will be removed.

Module 4 - Knowledge check: Tailored offer for IT competence

If you add a new function to RuleHandlerHelper - where will these functions run? Would dynamic work without this defined?

Functions defined in RuleHandlerHelper.js run as support functions when you set up the dynamic in Altinn Studio. Dynamics can be set up without these defined and will still work if you have configured the functions in RuleHandlerObject.js and the definitions are in RuleConfiguration.json.

If you were to add a new function to RuleHandlerHelper.js - where will these functions run? Would dynamic work without this defined?

Functions defined in RuleHandlerObject.js are actually dynamic uploaded by app-frontend and runs as part om the application flow for the user. Dynamics will not work without this defined.

What is the correlation between functions defined in RuleHandlerObject and the file RuleConfiguration.json?

RuleConfiguration.json is a configuration that says something about which fields the actual rule in RuleHandlerObject should be used on and possibly which effect it should have. A function defined in RuleHandlerObject can be set up multiple times in RuleConfiguration.json. You can almost think of it as “instances” of the function.

Module 5 - Knowledge check: Expand process with confirmation step

Which Altinn-specific traits are on every process task?

altinn:tasktype is defined for each task.

Which limitations would an external BPMN editor have when editing the process description of an Altinn app?

Altinn-specific traits would probably not be imported or exported when working on the model.

Is it possible for the process flow to go both ways? From filling in to confirmation and from confirmation to filling in?

SequenceFlow in the bpmn-file only describes the flow going one way, from filling out to confirmation. Therefore the flow cannot go both ways.

Module 5 - Knowledge check: Add authorization rules for confirmation step

What will happen when the process flow proceeds to the confirmation step without the authorization rules being updated?

The application will display “Unknown error” when the usr presses the Submit button.

What happens if you don’t specify which roles are allowed to perform an action in an authorization rule?

Then all users, with or without roles, will be allowed to perform the confirm operation for the application.

Module 5 - Knowledge check: Validation of submitter

Which change would you suggest for the client to be able to meet this requirement without adding custom validation at this step?

By rather changing policy so that only the role PRIV, which is only delegated by a private person on behalf of themselves, has the permission to perform the action confirm, the authorization rules will do the check, which currently is set up as custom validation, automatically.

Module 6 - Knowledge check: Repeating groups

What field in the data model decides if an element is repeating?

The field maxOccurs in the xsd-model says something about weather a field is repetitive. If maxOccurs > 1

How many repetitions are allowed for the field TidligereBosteder?

10 repetitions are allowed for TidligereBosteder.

Module 6 - Knowledge check: Validation

When are validations server-side running?

Validations on the server side are run as standard only when the user chooses to move on from a step. This behaviour can be overrun, and it is possible to trigger validations both on single fields and e.g. when switching between different pages.

Why should validations added on the client side also be duplicated server-side?

Client-side validations should be considered as an aid for better user experience and not as a guarantee that data is delivered in the correct format. People who don’t mean well can get past these validations, and client-side validations will not be run if, for example, you use the APIs directly. Therefore, validations placed on the front-end should always be reflected in the back-end logic.

Module 6 - Knowledge check: Data processing

When is data processing running?

Data processing is run every time the user either reads or writes data. That is, every time the user changes a given field, the logic will run. This therefore requires that the app developer optimizes the code that is executed and avoid heavy and complex operations on each calculation.

What separates ProcessDataWrite and ProcessDataRead?

ProcessDataWrite is run once the user writes data, i.e. when the user has filled in a field or updates an existing value. ProcessDataRead is run once the user reads data from the data base, e.g. when navigating to a previous instance of the application and retrieving previously filled in data.

What is the difference between DataProcessing and Calculations?

DataProcessing and calculations are two different names to the same concept. In the nuget-packets pre 4.7.0, this went under the name calculations or kalkuleringer, while it is now referred to as DataProcessing.