# 데이터소스 설정

**Lookup 또는 Line-Item 데이터에 부가적으로 관련 개체나 외부 데이터를 표현해주고 싶을 때 사용됩니다.**

### Builder에서 데이터 소스 추가

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

1. Lookup에 Data Source를 설정하는 경우: 검색 설정(Setup Lookup Selector) 단계로 이동합니다.\
   Line-Item의 Data Source를 설정하는 경우: 편집기 설정(Setup Line-Item Editor) 단계로 이동합니다.
2. Add data sources 버튼을 눌러 Data Source 편집 레이아웃을 열어줍니다.

{% hint style="warning" %}
Line-Item 편집기는 Evaluation Event를 필수로 설정해주어야 합니다.\
Evaluation Event는 아래와 같이 제공됩니다.

* On Initialization : Line-Item 레코드가 새로 추가되었을 때 실행됩니다.
* On Loading : Line-Item 화면이 로드될 때마다 실행됩니다.
* Before Save : Line-Item 레코드들이 저장되기 전 실행됩니다.

<img src="/files/44sJpPgEaaF1p5fKKtDo" alt="" data-size="original">
{% endhint %}

### 데이터소스 유형

### [Internal](/ko/smallbuilder-line-items/builder/setup/datasource/internal.md)

Salesforce 내 관련 개체를 조회하여 데이터를 같이 표현하고 싶을 때 사용됩니다.

예를 들어 Lookup이 Product2로 지정된 경우 PricebookEntry에 있는 단가를 같이 표시하고 싶을 때 내부 데이터소스를 이용해 조건에 맞는 PricebookEntry를 조회하여 제품과 단가를 같이 표현할 수 있습니다.

### [External](/ko/smallbuilder-line-items/builder/setup/datasource/external.md)

주로 외부 서버에서 데이터를 조회하여 같이 표현해주고 싶을 때 사용됩니다. 사용자가 작성한 Apex Class를 이용해 데이터소스를 가져오기 때문에 내부 데이터소스에 비해 자유롭게 데이터를 가져올 수 있는 장점이 있습니다.

예를 들어 외부 서버에서 실시간 재고를 가져와 화면에 같이 표시하고 싶은 경우 Apex Class에서 Rest API 코드를 작성하여 외부 데이터소스에 지정하면 Line-Item Configurator에서 해당 데이터를 보실 수 있습니다.


---

# Agent Instructions: 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:

```
GET https://help.smallbuilder.com/ko/smallbuilder-line-items/builder/setup/datasource.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
