# Copy an Application

{% hint style="danger" %}
Prior to copying the App, please check the "**Update Big Button code of all Production Apps in Knack"** [**#24411**](https://github.com/cityofaustin/atd-data-tech/issues/24411) epic to see if you need to update the big button code. If so, follow instructions for the [Big Button](https://atd-dts.gitbook.io/atd-knack-operations/knack-code/functionality/big-buttons) code in GitBook and submit a pull request (PR).\
\
You can read on how to submit a PR in our [GitBook](https://atd-dts.gitbook.io/atd-knack-operations/knack-code/code-version-control).
{% endhint %}

{% hint style="warning" %}
If you are copying the "**Mobility Services Portal**" application, do ***not*** copy records. Instead, export existing records and remove PII. Afterwards, import records into the test application. You can read about it in this [page](https://atd-dts.gitbook.io/atd-knack-operations/mobility-services-portal/creating-a-test-environment-application)
{% endhint %}

<details>

<summary>If you are updating Big Button code</summary>

1. Go to the Production app and follow all instructions for [Copy an Application](https://app.gitbook.com/o/-LzDQOVGhTudbKRDGpUA/s/-LzNSSXajDFpzOv2IhIv/~/changes/823/knack/copy-an-application)
2. After app is duplicated, go to the *copied test app* and update the JavaScript following the GitBook instructions for [Big Buttons](https://app.gitbook.com/o/-LzDQOVGhTudbKRDGpUA/s/-LzNSSXajDFpzOv2IhIv/~/changes/823/knack-code/functionality/big-buttons)
   * **Make sure to test that big buttons are working on the test version of the app!**
3. Submit a pull request (PR) by following instructions in [Github Version Control](https://app.gitbook.com/o/-LzDQOVGhTudbKRDGpUA/s/-LzNSSXajDFpzOv2IhIv/~/changes/823/knack-code/code-version-control) and link the PR to the related sub issues
4. After PR is approved, make sure to copy the code used in the PR to the Production version of the App
   * **Make sure to test that big buttons are also working on the production version of the app!** It should be the same as test.
5. Close sub issue and ✅ checkmark the list of apps below to signify it is done.

</details>

{% stepper %}
{% step %}

### Notify Apps Team using Slack channel **`#atd-knack`**

<figure><img src="https://3087753818-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LzNSSXajDFpzOv2IhIv%2Fuploads%2FmRnebaFO7Axj3h0BPMxk%2F1_CopyApp.png?alt=media&#x26;token=352bcf99-10b5-4965-bf22-86915305e860" alt=""><figcaption></figcaption></figure>

Above is the message used in the slack channel when copying apps.
{% endstep %}

{% step %}

### Log **into Knack Builder using the Transportation Data Enterprise account**&#x20;

This will be the **(Knack Builder – Primary Account)** available on 1Password.
{% endstep %}

{% step %}

### Search for the application you want to copy

<figure><img src="https://3087753818-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LzNSSXajDFpzOv2IhIv%2Fuploads%2Ff6RhPRTlUx1rUaurBL80%2FSnag_19ca275.png?alt=media&#x26;token=5dd9e354-73a0-4c92-a2ef-9e553fcda327" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### From the ... icon dropdown, select "Duplicate App"

You will want to duplicate from a production application. It will follow this naming convention.

* `APP ACRONYM` | `APPLICATION NAME` | PRODUCTION

<figure><img src="https://3087753818-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LzNSSXajDFpzOv2IhIv%2Fuploads%2FfUjuRMrQ7Mc2ojKkEcR3%2FSnag_19dd4db.png?alt=media&#x26;token=c4a7fc39-c144-46b5-93bc-4994f2521a6e" alt="" width="563"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Change app name to TEST | `APP ACRONYM` | DD MMM YYYY | `APPLICATION NAME`

Knack will automatically append "Copy" to the end of the name. We want to change this name.

* Edit this out and use the format:
  * TEST | `APP ACRONYM` | DD MMM YYYY | `APPLICATION NAME`

<figure><img src="https://3087753818-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LzNSSXajDFpzOv2IhIv%2Fuploads%2F6EgrGPcpkx5lJkq2DaZ4%2FSnag_19f5eb7.png?alt=media&#x26;token=3eb58e23-e6f8-44e9-9eb4-01fc422e6c82" alt="" width="373"><figcaption></figcaption></figure>

{% hint style="warning" %}
Optionally you may pause tasks if you do not want them to run in test.

If you wish to speed up the copying process you may also uncheck duplicate records **but this will make it significantly harder to test as there will be no records to work with.**
{% endhint %}

The new duplicate app will show up on the list with a yellow dot next to the name signifying that it is in the process of getting copied.

<figure><img src="https://3087753818-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LzNSSXajDFpzOv2IhIv%2Fuploads%2F1GsAGiYqGQnlSVPQMFii%2FSnag_1a1fd3f.png?alt=media&#x26;token=e4ea4290-c0e9-4cdc-a9ae-cc336cc9a4eb" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Notify Service Desk Primary of email notification

Copying the app will take time. Knack will send an email to the Transportation Data Enterprise account when it is done.

<figure><img src="https://3087753818-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LzNSSXajDFpzOv2IhIv%2Fuploads%2FriFNRnTqGI9BDBQtMvY5%2F7_CopyApp.png?alt=media&#x26;token=26520cbf-5cc3-4007-b898-ee41f78afe22" alt=""><figcaption></figcaption></figure>

You want to let the service desk primary know that you’re expecting the email confirmation from Knack so they will notify when the copying process is done.
{% endstep %}

{% step %}

### After App is done copying, from the ... icon dropdown select "Manage Builders"

Add builders and the PM assigned to this application to the new duplicate app by selecting "Manage Builders"

<figure><img src="https://3087753818-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LzNSSXajDFpzOv2IhIv%2Fuploads%2F7zx05H1FFJP3OqvzVmsJ%2Fimage.png?alt=media&#x26;token=2942691d-46f4-4838-82b8-c127243bc819" alt="" width="563"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Add new environment to the [**DTS Portal**](https://atd.knack.com/dts#applications) **listing of Applications**

This is used to keep track of all our knack applications. Select the PRODUCTION environment you have copied and **Add Environment**.

<figure><img src="https://3087753818-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LzNSSXajDFpzOv2IhIv%2Fuploads%2FloGhCDNOa8Eeh8Hb0Hvy%2F8_CopyApp.png?alt=media&#x26;token=711404a7-00b8-4544-81d9-0fa3bfe610b2" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Add details about the new environment in DTS Portal

To find the Application ID, go to the Knack App > Settings > API and Code.

<figure><img src="https://3087753818-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LzNSSXajDFpzOv2IhIv%2Fuploads%2FVSNgdII83NwBRplBY045%2F9_CopyApp.png?alt=media&#x26;token=104479e6-e63a-4eec-94a6-c81775e7d000" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Optional: Delete old test environment from Knack and add Date Deleted record in DTS Portal

If applicable, delete the old test app and add the new one to DTS Portal.
{% endstep %}
{% endstepper %}
