# How to Sync Actions using Code Editor?

To ensure your custom method becomes available for use in SimplifyQA test cases, you need to sync the action after writing your code.

### Prerequisites

1. You must have [privilege to sync the actions](/code-editor/configuring-privileges-for-sync-actions.md)
2. The Code Editor should be properly installed and set up, and the user should be working with annotated methods using `@SyncAction`.

### Syncing Global and Project-Level Actions in SimplifyQA

* **Global (Customer-Level) Actions:**\
  These are reusable actions that are available across all projects under a single customer account.&#x20;
* **Project-Level Actions:**\
  These are specific to an individual project and are not accessible across other projects. They are useful for project-specific logic or customizations.

The user can choose to sync the custom method either from the [SimplifyQA platform](#sync-the-custom-method-from-simplifyqa) or from the [SimplifyQA Code Editor.](#sync-the-custom-method-from-code-editor)

### Sync the Custom Method from SimplifyQA

1. **Use the `@SyncAction` Annotation**\
   While writing your custom method in the Code Editor, ensure the method is annotated with `@SyncAction`.\
   This annotation helps SimplifyQA recognise and register the method as an action that can be reused in test steps.
2. The syntax for Sync annotation should be as follows:

```
@SyncAction(uniqueId = "[unique id]",groupName = "Generic",objectTemplate = @ObjectTemplate(name = TechnologyType.GENERIC,description = "This action belongs to GENERIC"))
```

Below is the explanation of sync annotation,

* **uniqueId**: A unique identifier for the action to avoid conflicts during syncing.
* **groupName**: The category under which the custom action will appear in test cases in SimplifyQA.
* **@ObjectTemplate**: Defines the platform type and description for the custom action.

3. Use `build.bat` to compile the code and navigate to SimplifyQA.
   * Go to **Profile > Settings > Configurations**

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

* Navigate to '**Actions'** tab and locate '**Sync**' button.&#x20;
* Click **Sync Action.**

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

* SimplifyQA will fetch the latest methods annotated with `@SyncAction` from the code editor. User can accept or reject the sync actions from here.

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

* Now your custom method is available to use in **any test case**

### Sync the Custom Method from Code Editor

1. Ensure the method is correctly annotated using `@SyncAction`.
2. The code must be built successfully using `build.bat` (for Windows) or `./macBuild.sh` (for macOS).
3. Post which run the command : `sync.bat`  (for Windows) or  `/macSync.sh`  (for macOS).
4. This will sync all methods that include the `@SyncAction` annotation into SimplifyQA, making them available for use in test cases.

Syncing actions ensures that custom methods written in the Code Editor are recognized by SimplifyQA and become available for use in test automation. By using the `@SyncAction` annotation and regularly syncing after publishing, teams can extend their testing capabilities with reusable, project-specific logic in a structured and efficient way.

### Frequently Asked Questions (FAQs)

<details>

<summary>What happens if I forget the <code>@SyncAction</code> annotation?</summary>

If you do not include `@SyncAction`, the method will not be available in SimplifyQA’s action list even if the code is pushed and published.

</details>

<details>

<summary>How often should I sync actions?</summary>

You should sync actions every time you write a new custom methods or modify existing ones to make them available in SimplifyQA.

</details>

<details>

<summary>Can multiple custom methods be synced at once?</summary>

Yes, all methods annotated with `@SyncAction` will be synced together when you run the Sync Action from SimplifyQA.

</details>

<details>

<summary>Do I need admin access to sync actions?</summary>

No, syncing actions can be done by users with appropriate privilege. However, configuring the Code Editor requires admin privileges.

</details>


---

# 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://docs.simplifyqa.ai/code-editor/how-to-sync-actions-using-code-editor.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.
