Community
Showing results for 
Search instead for 
Do you mean 
Reply

Creating a new Opportunity via API

New Member
Posts: 8
Country: United_Kingdom

Creating a new Opportunity via API

[ Edited ]

Hi

I am completely new to Act developing. I am submitting a JSON to the appropriate URL (see Figure 1 below). You can see that the "customFields" are filled in. The API then returns a confirmed copy of the inserted record (see Figure 2 below). This has a generated ID from the Act software. As you can see, all of the "customFields" data is missing. Also the "contactNames" data is also missing. The "name" and "status" fields appear to be the only fields which are being saved. My field names completely match the return JSON field names. No error message is being given as to why this information is not being saved. Also, despite this returning a confirmation-response with a server generated ID field (proving it has been processed), I cannot find this record anywhere in the Act portal in Opportunities. Any ideas what is going wrong? Act Verion: 18.2.64.0

Figure 1:
{
"name": "344238",
"status": 1,
"actualCloseDate": "2016-12-12T00:00:00+00:00",
"estimatedCloseDate": "2016-12-12T00:00:00+00:00",
"grossMargin": 0.00,
"isPrivate": false,
"isPublic": true,
"openDate": "2016-12-12T00:00:00+00:00",
"probability": 100,
"productTotal": 0.00,
"weightedTotal": 0.00,
"totalPerContact": 0.00,
"totalPerGroup": 0.0,
"totalPerCompany": 0.0,
"contactNames": "Test Name",
"competitor": null,
"source": null,
"reason": null,
"opportunityRelation": null,
"customFields": {
"quantity": "1",
"total discount": "0.00",
"invoice address 1": "1 Test Road",
"event code": "66177",
"price": "22.00",
"billing city": "",
"billing address 1": "1 Test Road",
"billing postcode": "A1 1AA",
"invoice city": "",
"invoice address 2": "",
"billing country": "United Kingdom",
"event type": "Partypack",
"event date": "02-02-2017 00:00:00",
"invoice postcode": "A1 1AA",
"billing address 3": "",
"invoice country": "United Kingdom",
"billing address 2": ""
},
"opportunityRelation": {
"productsAdded": [
{
"name": "partypack",
"price": 11.00,
"quantity": 2,
"total": 22.00
}
]
}
}

Figure 2:
{
"id": "e36ed0c7-7c52-4495-8f2e-9e6c0e756cc0",
"name": "344238",
"creator": "Test User",
"manager": "Test User",
"daysOpen": 0,
"status": 1,
"actualCloseDate": "2016-12-12T00:00:00+00:00",
"estimatedCloseDate": "2016-12-12T00:00:00+00:00",
"grossMargin": 0.00,
"isPrivate": false,
"isPublic": true,
"openDate": "2016-12-12T00:00:00+00:00",
"probability": 100,
"productTotal": 0.00,
"weightedTotal": 0.00,
"totalPerContact": 0.0,
"totalPerGroup": 0.0,
"totalPerCompany": 0.0,
"contactNames": "",
"created": "2016-12-12T22:04:17+00:00",
"edited": "2016-12-12T22:04:17+00:00",
"competitor": null,
"source": null,
"reason": null,
"opportunityRelation": null,
"customFields": {
"opportunity_field_1": null,
"quantity": null,
"total discount": null,
"invoice address 3": null,
"opportunity_field_8": null,
"invoice address 1": null,
"event code": null,
"price": null,
"billing city": null,
"billing county": null,
"billing address 1": null,
"billing postcode": null,
"invoice city": null,
"opportunity_field_7": null,
"invoice address 2": null,
"billing country": null,
"event type": null,
"event date": null,
"invoice postcode": null,
"opportunity_field_2": null,
"invocie county": null,
"billing address 3": null,
"invoice country": null,
"opportunity_field_3": null,
"billing address 2": null,
"booking date": null,
"opportunity_field_6": null,
"opportunity_field_5": null,
"opportunity_field_4": null
},
"editedBy": "Test User",
"recordOwner": "Test User"
}

Employee
Posts: 22
Country: USA

Re: Creating a new Opportunity via API

  1. It appears that custom fields are not being saved when creating an opportunity, however updates (PUT) seem to be working. I will create a task to have this fixed.

 

  1. The contact name property is a read only field and it only displays the first contact associated to the opportunity. We did introduce several new properties in build .117 that allows you to associate companies, contacts, and groups when creating and updating an opportunity.

 

{
    "id": "string",
    "name": "string",
    "companies": [  {
 	"id": "300CD574-1F3A-46C3-A640-FE32F503B290"
    } ],
    "contacts": [ {
        "id": "676FFB51-1ABC-4CDA-95F2-0782803E4CC5",
"id"; "399FB383-2CBB-3838-3F32-993882C388B1"
} ], "groups": [ { "id": "8EA472FF-CBFB-4ABD-A7F9-6F662CDB2F94" } ], … }

 

 

 

New Member
Posts: 8
Country: United_Kingdom

Re: Creating a new Opportunity via API

Hi

 

I've tried sending a "PUT" with just the custom fields however these are still not being saved:

{
"customFields": {
"quantity": "1",
"total discount": "0.00",
"invoice address 1": "1 Street Road",
"event code": "66803",
"price": "65.00",
"billing city": "",
"billing address 1": "1 Street Road",
"billing postcode": "A1 1AA",
"invoice city": "",
"invoice address 2": "",
"billing country": "United Kingdom",
"event type": "Partypack",
"event date": "04-02-2017 00:00:00",
"invoice postcode": "A1 1AA",
"billing address 3": "",
"invoice country": "United Kingdom",
"billing address 2": ""
}
}

 

This custom fields structure matches the initial structure response from the server when I created the Opportunity.  When I send this PUT update, the response is empty, no confirmation or error.

New Member
Posts: 8
Country: United_Kingdom

Re: Creating a new Opportunity via API

Is anyone able to help?  Let me know if you need any more information from me.

Employee
Posts: 22
Country: USA

Re: Creating a new Opportunity via API

You are using Act! version 18.2.64.0, but what version of the API are you on.

New Member
Posts: 8
Country: United_Kingdom

Re: Creating a new Opportunity via API

API Version: 1.0.80.0

Employee
Posts: 22
Country: USA

Re: Creating a new Opportunity via API

The current version of the API is 1.0.117.  Could you try upgrading to the latest version.  We are releasing a new version soon that fixes this issue on the create:

 

https://www.act.com/download/download-act!-premium-v18

Employee
Posts: 22
Country: USA

Re: Creating a new Opportunity via API

I was trying to configure my Act! database like the JSON structure in your request (custom fields with spaces in them) and I am getting exceptions during PUT request.  Not saying this is the issue, but it might have something to do with it.  Let me research this to see If I can find a better answer for you today.  If you are able to upgrade .117, I would still recommend it.  Sorry, I don't have a better answer for you right now, but I will post something when I have an answer.

New Member
Posts: 8
Country: United_Kingdom

Re: Creating a new Opportunity via API

Thanks for your help so far.  I have contacted my Act host and they are looking into upgrading the API. It sounds like this upgrade will resolve most of the issues so I will hold out hope for that.  Thanks

Employee
Posts: 22
Country: USA

Re: Creating a new Opportunity via API

We will be releasing build 1.0.137.0 this week (target is Wednesday).  This build fixes your issue as well as the bug that I found looking at this issue. 

Thanks for reporting this