> ## Documentation Index
> Fetch the complete documentation index at: https://doc.lucidworks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Tips for scripts and code fields

export const LwTemplate = ({title = "Key questions to get you started", icon = "sparkles", cta = "Powered by Agent Studio", linkHref = "https://lucidworks.com/demo/?utm_source=docs&utm_medium=referral&utm_campaign=docs_cta_ai"}) => {
  const [isLoaded, setIsLoaded] = useState(false);
  useEffect(() => {
    const timer = setTimeout(() => {
      setIsLoaded(true);
    }, 500);
    return () => clearTimeout(timer);
  }, []);
  return <div className="lw-template-container">
      <Card title={title} icon={icon}>
        {isLoaded && <span dangerouslySetInnerHTML={{
    __html: `<lw-template id="a029c1a9-28be-427e-b0e1-5d918920246a"></lw-template
            >`
  }} />}
        <Link href={linkHref} className="agent-studio-link text-left text-gray-600 gap-2 dark:text-gray-400 text-sm font-medium flex flex-row items-center hover:text-primary dark:hover:text-primary-light group-hover:text-primary group-hover:dark:text-primary-light">Powered by Lucidworks Agent Studio</Link>
      </Card>
    </div>;
};

[old doc.lw link]: https//doc.lucidworks.com/fusion/5.9/o72zno

[localhost link]: http://localhost:3000/docs/5/fusion/operations/config-sync/objects/scripts

[mintlify link]: https://doc.lucidworks.com/docs/5/fusion/operations/config-sync/objects/scripts

ConfigSync can be set up to automatically detect and separate fields containing scripts or code.
By moving these bits of code into separate files, it makes them much easier to view, edit, and manage.

<LwTemplate />

## Setting up inline fields

Setup is done through a configuration that specifies which fields to inline based on their type and location.
Here are the basics:

* **Selectors**: These are like filters that tell ConfigSync which types of objects and fields it should look for.\
  For example, you might have a selector for SQL templates within spark jobs.
* **Extensions**: This tells ConfigSync what file extension to use when it creates a new file for the inlined content, like `.sql` for SQL scripts or `.scala` for Scala scripts.
* **Properties**: These are the specific fields within your JSON objects that contain the script or code you want to inline.

## Default configuration

It can be found in the `application.yml` file.

## How it works

For every piece of content that matches a selector, ConfigSync creates a new file in a subfolder named after the object ID and the property name, with the specified extension.
This means your scripts get their own dedicated file, making them much easier to work with.

## Example in action

Imagine you have a JSON file for a spark job that includes a Scala script.
ConfigSync can automatically detect this script and move it into a separate `.scala` file, based on your configuration.

* **Original JSON file**: `spark-jobs/export_aad_acls.json` might contain a Scala script under the script property.
* **Inline setup**: According to the config, since it’s a type=script, ConfigSync creates a new file at `spark-jobs/scala/export_aad_acls/script.scala`, containing just the script.
* **The benefit**: You can now edit the Scala script directly in its own file, which is much simpler than editing inline JSON.

## Managing changes

You can make changes either directly in the new script file or in the original JSON.
However, if there are changes in both places, ConfigSync prioritizes the changes made in the separate script file.
