> For the complete documentation index, see [llms.txt](https://docs.ohmyapp.io/main/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ohmyapp.io/main/guide/develop_app/command-execute-function/create-logic/conditions/detailed-processing-conditions/afteraction.md).

# @afterAction

* 새로운 로직을 발생시켜요.
* 사용자가 원하는 컬렉션 명과 이벤트 타입의 로직을 발생시킬 수 있어요.

ex) 예약 정보가 있으면(if) 예약 정보를 업데이트 시키고, 예약 정보가 없으면(if) 예약 정보를 생성시키는 경우.

**사용 방법**

<figure><img src="/files/9L2gvyl2YzNy7ikD67o8" alt=""><figcaption></figcaption></figure>

* 로직 설정 ➡︎ If When, Where에 원하는 값 입력 ➡︎ New data query 를 펼쳐 주세요. &#x20;
* Event에서 @afterAction을 드래그앤드롭하여 원하는 위치(flows, #ifTrue, #ifFalse, @for)에 넣어주세요.
* 아래의 이미지와 같이 preDocument, newDocument, tmpDocument, eventType, collectionName에 필요한 값을 작성해 주세요.

<div align="left"><figure><img src="/files/2yB964k1jEmatD0HMfFZ" alt="" width="563"><figcaption></figcaption></figure></div>

**필드 설명**

* eventType(String) (필수) : 이벤트 타입을 정의해요.&#x20;
* collectionName(String) (필수) : 컬렉션 명을 정의해요.&#x20;
* metaCode(String) (필수) : 메타 코드를 정의해요.&#x20;
* preDocument(Object, 동적 키, 동적 Object) => (최종형 Object or Null) (필수)

  : 발생되는 로직에서 사용할 preDocument를 정의해요.
* newDocument(Object, 동적 키, 동적 Object) => (최종형 Object or Null) (필수)

  : 발생되는 로직에서 사용할 newDocument를 정의해요.
* tmpDocument(Object, 동적 키, 동적 Object) => (최종형 Object or Null) (필수)

  : 발생되는 로직에서 사용할 tmpDocument를 정의해요.

2024.03.13 Jinny


---

# 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.ohmyapp.io/main/guide/develop_app/command-execute-function/create-logic/conditions/detailed-processing-conditions/afteraction.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.
