> For the complete documentation index, see [llms.txt](https://docs.agilecase.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.agilecase.com/developer-documentation/case-scripting/on-load-scripts/add-custom-field-data-to-main-case-panel.md).

# Add Custom Field Data To Main Case Panel

This example demonstrates a script that adds data from one of your custom fields to the main case panel.

You can copy this script into your own system, but you will need to edit it to select your own custom fields.

This script is useful if you want to provide users with immediate access to custom field content that would usually be hidden under several layers of tabs.

## Script

```javascript
//The first row specifies the field you wish to pick out. You can do this by changing "Customer Rating" to your own field.
$.get('/api/case/' + caseid + '/data?getValues=Custom.CustomerRating', function( data ) {
	
	var name = data.data.customFields[0].name;
	var value = data.data.customFields[0].value;

	$('.well table tbody').append('<tr><th>' + name + '</th><td>' + value + '</td><th></th><td></td></tr>')
});
```

The script above picks out a custom field you have specified and displays it on the main case panel.

## Before

<figure><img src="/files/yhzfSNNs59VN5f02orGI" alt=""><figcaption></figcaption></figure>

Before the script is applied to the case type, the main case page will look like this.

## After

<figure><img src="/files/dIEgT8AJMXwQX1YzKVrE" alt=""><figcaption></figcaption></figure>

After the script has been applied, the "Customer Rating" field and its value are present on the main case page.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.agilecase.com/developer-documentation/case-scripting/on-load-scripts/add-custom-field-data-to-main-case-panel.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
