Unable to create a new deal using pipeline with API

deals

#1

I am attempting creating a new deal based on form submit data however I get an error whenever I attempt to tie the deal to a pipeline.

For example I have a pipeline with id of “sales_pipeline” and a stage within that pipeline with an id of “appointmentscheduled”. However when I use these two in combination i get the following error;

Dealstage (appointmentscheduled) must exist within specified pipeline (sales_pipeline).

The error then goes on to list the possibly values, being;

appointmentscheduled, presentationscheduled, decisionmakerboughtin, contractsent, closedwon, closedlost,

appointmentscheduled being one of them.

Other parameters pased include;

	$newDeal->setProperty(['name' => 'dealname', 'value' => $title]);
	$newDeal->setProperty(['name' => 'pipeline', 'value' => 'sales_pipeline']);
	$newDeal->setProperty(['name' => 'dealstage', 'value' => 'appointmentscheduled']);
	$newDeal->setAssociatedId($userId);

Not too sure why this is happening, I am also attaching the deal to a user does the user also have to be assigned to this pipeline?

Any help greatly appreciated.


#2

@johnmackenzie91 The deal IDs sometimes don’t match the name of them. Is this your only pipeline? If not is it your main one? I’ve had success before using default as the sales pipeline ID>. Here is an example of my object in NodeJS

var deal2Create =  {
            "portalId": portalID,
            "properties": [
                {
                    "value": "Tim's Newer Deal",
                    "name": "dealname"
                },
                {
                    "value": "appointmentscheduled",
                    "name": "dealstage"
                },
                {
                    "value": "default",
                    "name": "pipeline"
                },
                {
                    "value": "60000",
                    "name": "amount"
                },
                {
                    "value": "newbusiness",
                    "name": "dealtype"
                }
            ]
        }