# Public Pages

# Hello World

## <span class="mw-headline" id="bkmrk-what-it-does-1">What it does</span>

Displays "Hello World" in a seperate page. Purpose is learning and testing.

## <span class="mw-headline" id="bkmrk-how-to-invoke-1">How to invoke</span>

Make a http request:

```
 .../main?command=<strong>dk.p2e.blanket.codeunit.common.PagePublicHelloWorld</strong>
```

## <span class="mw-headline" id="bkmrk-configuration-1">Configuration</span>

<span class="mw-headline">None</span>

## <span class="mw-headline" id="bkmrk-developer-info-1">Developer info</span>

- <span class="mw-headline">Type: [CodeunitPagecontentPublic](https://docs.tsnocode.com/books/codeunit-reference/chapter/pagecontentpublic)</span>
- <span class="mw-headline">Security: Public access</span>
- <span class="mw-headline">Classpath: dk.p2e.blanket.codeunit.common.PagePublicHelloWorld</span>

# PublicTokenBuilder

## <span class="mw-headline" id="bkmrk-what-it-does-1">What it does</span>

Usage example: Lets external users resend tokens for data they should have access to.

Builds a token for accessing records using configuration options and dynamic parameters. It requires a record that has a reference to an email, to whom the token will be sent.

Multimode operation based on supplied parameters

1. Email as parameter: Execute silently
2. No email supplied: 
    - Display form with email
    - Execute normally

The DataID of the record is collected by making a lookup on the email supplied (see: LookupSolution, LookupFieldName).

An email is then sent to the user with a token for the record in question

## <span class="mw-headline" id="bkmrk-how-to-invoke-1">How to invoke</span>

Make a http request:

```
main?command=dk.p2e.blanket.codeunit.common.PagePublicTokenBuilder
```

### <span class="mw-headline">Options</span>


The name of the following parameters are optional and configurable

- AltToken
- EmailMatch

```
main?command=dk.p2e.blanket.codeunit.common.PagePublicTokenBuilder&AltToken=0
```

```
main?command=dk.p2e.blanket.codeunit.common.PagePublicTokenBuilder&EmailMatch=foo@bar.com
```

```
main?command=dk.p2e.blanket.codeunit.common.PagePublicTokenBuilder&AltToken=0&EmailMatch=foo@bar.com
```

## <span class="mw-headline" id="bkmrk-configuration-1">Configuration</span>

If no interface (**TokenInterface**) is specified the codeunit will allways exit without doing anything.

The codeunit has the following options

### <span class="mw-headline" id="bkmrk-options-for-the-emai-1">Options for the email input form</span>

These options are required

- FormHeader: HTML before the form and resulting message
- FormFooter: HTML after the form and resulting message
- FormIntroduction: Help text displayed above the form
- FormSubmitButton: Text on submit button
- FormReponseSuccess: Message to user if email is sent succesfully
- FormReponseFailure: Message to user if email failed

### <span class="mw-headline" id="bkmrk-options-for-building-1">Options for building the token</span>

These options are required

- EmailMatch: Name of http parameter for setting the email
- TokenInterface: Interface to build the token for
- LookupSolution: System name of the solution which the token is built for
- LookupFieldName: Field in solution where email of the user can be found

These options are optional

- AltToken: Name of http parameter for selecting the alternative interface
- TokenInterfaceAlt: Interface used if the parameter **AltToken** is set to **1**

### <span class="mw-headline" id="bkmrk-options-for-the-emai-3">Options for the email message</span>

These options are required

- EmailHeader: Subject content
- EmailContent: Body of email

## <span class="mw-headline" id="bkmrk-developer-info-1">Developer info</span>

- <span class="mw-headline">Type: [CodeunitPagecontentPublic](https://docs.tsnocode.com/books/codeunit-reference/chapter/pagecontentpublic)</span>
- <span class="mw-headline">Security: Public accces (with some model restrictions)</span>
- <span class="mw-headline">Classpath: dk.p2e.blanket.codeunit.common.PagePublicTokenBuilder</span>

# MigrateFilesToChildren

## <span class="mw-headline" id="bkmrk-what-it-does-1">What it does</span>

<span class="mw-headline">Helps migrate from a [Files: Documents](https://docs.tsnocode.com/books/field-type-reference/page/documents) field to a related entity, with a Files: Documents field in single-file mode.</span>

<span class="mw-headline">Introduced in version 11879.</span>

## <span class="mw-headline" id="bkmrk-how-to-invoke-1">How to invoke</span>

<span class="mw-headline">Make a http request:</span>

```
.../main?command=com.tsnocode.codeunit.common.MigrateFilesToChildren
```

### <span class="mw-headline">Options</span>

Required parameters:

<table border="1" id="bkmrk-name-description-fro" style="border-collapse: collapse; width: 100%; height: 178.781px;"><colgroup><col style="width: 50%;"></col><col style="width: 50%;"></col></colgroup><tbody><tr style="height: 29.7969px;"><td style="height: 29.7969px;">**Name**</td><td style="height: 29.7969px;">**Description**</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">From</td><td style="height: 29.7969px;">Entity migrating files from</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">FromDocument</td><td style="height: 29.7969px;">Field to migrate files from in "From" entity</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">To</td><td style="height: 29.7969px;">Entity to migrate files to</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">ToParent</td><td style="height: 29.7969px;">Field that references "From" entity</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">ToDocument</td><td style="height: 29.7969px;">Field to migrate files to in "To" entity</td></tr></tbody></table>

Optional parameters:

<table border="1" id="bkmrk-dontkeepmetadata-don" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 50%;"></col><col style="width: 50%;"></col></colgroup><tbody><tr><td>DontKeepMetadata</td><td>Don't set CreatedAt and CreatedBy based on when and who uploaded the original file</td></tr><tr><td>TEST</td><td>Limit to first 10 records in "From" entity</td></tr></tbody></table>

All entity and field names are system names.

## <span class="mw-headline" id="bkmrk-developer-info-1">Developer info</span>

- <span class="mw-headline">Type: [CodeunitPagecontentPublic](https://docs.tsnocode.com/books/codeunit-reference/chapter/pagecontentpublic)</span>
- <span class="mw-headline">Security: requires admin</span>
- <span class="mw-headline">Classpath: com.tsnocode.codeunit.common.MigrateFilesToChildren</span>