---
title: "Switching and Toggling"
canonical: "https://support.appfire.com/space/SUPPORT/80878070/Switching%20and%20Toggling"
format: markdown
---
## Update The Value of a Custom Field Based on Another

This is an example for changing the value of a text field based on user input. For full documentation, please see this [page](https://appfire.atlassian.net/wiki/spaces/JJUPIN/pages/13240209) on configuring Live Fields.

**Main Script**

> ⚠️ Note that lfInstantHook() is necessary when running this script from the create view.

|  |
| --- |
| ```
lfInstantHook("issueType", "LiveFields/hook.sil");
lfWatch("issueType", "issueType", "LiveFields/hook.sil");
``` |

> ℹ️ Note that there are no forward slashes at the beginning of a relative path. Dot slash notation “./” is not supported.

**Hook Script**

|  |
| --- |
| ```
if (argv["issueType"] == "Task") {
    lfSet("textField", "This issue is a Task");
} else if (argv["issueType"] == "Bug") {
    lfSet("textField", "This issue is a Bug");
}
``` |


![image](media://836dc324-6a9b-4602-b653-9c42b069e41f)

## Hiding and Disabling Custom Fields Based on Selection

**Main Script**

|  |
| --- |
| ```
lfInstantHook("issueType", "LiveFields/hook.sil");
lfWatch("issueType", "issueType", "LiveFields/hook.sil");
``` |

**Hook Script**

|  |
| --- |
| ```
if (argv["issueType"] == "Task") {
    lfHide("textField");
} else if (argv["issueType"] == "Bug") {
    lfShow("textField");
}
``` |


![image](media://2c924c09-f2bb-4853-a2e2-257adb773e8b)


## Additional Help

Need help implementing this script? Talk to me directly to me by clicking on the bot on this page.

## Related articles



> Macro (contentbylabel)

> Macro (details)
> 
> | Related issues |  |
> | --- | --- |