# \_new

Creates a new Opportunity.

### Parameters

#### userID

The ID of the User which the Opportunity is for.

#### form\_id

The ID of a Form which the Opportunity is linked to.

#### customerID

The ID of the Customer linked to the Opportunity.

#### value

The value of the Opportunity.

#### notes

A string variable for notes within the created Opportunity.

#### source

The ID of a Source the Opportunity will be linked to.

#### createdDate

The date which the Opportunity was created on. (YYYY-MM-DD)

### Example

```
FM_api('Opportunity_new',[
  'userID'=>'92447',
  'form_id'=>'460775',
  'customerID'=>'712758',
  'value'=>'4',
  'notes'=>'New Opportunity',
  'source'=>'7',
  'createdDate'=>'2024-04-01'
]);
```

### Results

#### On Success

```
{"ok":"1","id":60003}
```

#### On Failure

If the "userID" parameter is not set:

```
{"error":"missing or invalid parameter: userID"}
```

If the "customerID" parameter is not set:

```
{"error":"missing or invalid parameter: customerID"}
```

If the "value" parameter is not set:

```
{"error":"missing or invalid parameter: value"}
```

If the "notes" parameter is not set:

```
{"error":"missing or invalid parameter: notes"}
```

If the "source" parameter is not set:

```
{"error":"missing or invalid parameter: source"}
```


---

# 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.fieldmotion.com/fieldmotion-api-docs/opportunity/_new.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.
