System.FormatException: Input string was not in a correct format.

Status
Not open for further replies.

David Argles

Joined
Oct 22, 2018
Messages
29
Reaction score
1
Can someone help this dev?

"Hello All,

I am trying to integrate 3CX with Odoo v.8 by using the 3CX Template Generator. When I try to test the generated template it returns an exception (Added as an attachment to this message).
From the message, I can see that it is related to a wrong variable format but not sure where and why.

I am using OAuth2 authentication. Here is the documentation for the REST API module that I am using:

If you need additionally I can share the calls that I am using and the responses that should be returned for them.

I would really appreciate any help.

Thank you."
 

Attachments

We will need the full logs to understand what's going on. However, please note that in order to test a template using OAuth2 authentication from the tool, you will need to upload it to 3CX, do the authorization phase from there, and once you have the RefreshToken, use it as a parameter in the tool. Otherwise the authentication will always fail.
 
Thanks for the feedback. From what I can see is that the error is happening when is prepared the request for the Contact Lookup.
The reason why I think that is because when I go on the Lookup and click "Auth" I can see the Request/Response for it. As a response I have:
JSON:
{"access_token": "....", "token_type": "....", "access_token_validity": 1800, "refresh_token": "...."}

but when I click on "Matching Scenario" the "Request/Response" tab is empty so I guess the request is not sent at all.

Furthermore I have the info for the refresh_token from Odoo so its value is already inserted in the parameters' values.

We will need the full logs to understand what's going on
Sorry but couldn't find the logs for the 3CX Template Generator, where are usually stored?

As example I am sharing the URL that I am using for the Contact Lookup, maybe it can help:

https://<domain>/restapi/1.0/object/res.partner?domain=[('phone','=',[Number])]&fields=['name','phone','email','mobile','id']

and the expected response is in format:
JSON:
{
   "res_partner":[
      {
         "name":"Test Name",
         "firstname":"Test",
         "mobile":false,
         "lastname":"Name",
         "id":24680,
         "phone":"1234567890",
         "email":"[email protected]"
      }
   ]
}
 
The tool doesn't generate logs. You will see logs if you test it from the console. In that case you will see the interactions in the file 3cxSystemService.log.

Can you send me a private message with screenshots from the tool and the full text from the Request/Response output for all the scenarios, so I take a look?
 
Hello @DNV,

Thanks for sending the information via private message as requested.

I can see that the problem is that, in the "Auth" scenario, you're defining the variable "ExpiresIn" as follows:
XML:
        <Variable Name="ExpiresIn" Path="expires_in">
          <Filter />
        </Variable>

However, the CRM response doesn't have "expires_in" in the JSON response. Instead, it has the value "access_token_validity". So you need to edit that variable to take the value from there.

Once you do that, 3CX will know for how long this access token is valid.
 
@edossantos thanks a lot, it solved the issue. I had few other issues with complex URLs processing but at the end, I have resolved them on the Odoo side so now all is working on the 3CX Template Generator. Few other things that wanted to confirm if not a problem:
  1. Using the template in the 3CX means when the system gets a call and the contact is not in the 3CX, it sends a request to the CRM in our case Odoo and gets the contact info from there, right? If that is true what happens if:
    1. The result returns more than one contact with the same phone number would that raise an error?
    2. Would the contact be stored in 3CX?
    3. If the contact is edited in 3CX will it be automatically synced to Odoo
  2. Is it possible to initiate mass sync of contacts using this template or it works just like case 1?


 
Using the template in the 3CX means when the system gets a call and the contact is not in the 3CX, it sends a request to the CRM in our case Odoo and gets the contact info from there, right?
This actually depends on the configuration. You can configure the CRM to query always (even if the contact is in 3CX), or just when the contact is not found in 3CX contacts.

The result returns more than one contact with the same phone number would that raise an error?
In this case the first match is returned. So you should order your scenarios or queries according to this. For example, if you have a scenario that queries contacts and another that queries leads, you should put these in the desired order in your template, because the first matching record will be returned, and the others will be ignored.

Would the contact be stored in 3CX?
Yes, the first matching record only.

If the contact is edited in 3CX will it be automatically synced to Odoo
No, the synchronization happens from the CRM to 3CX only. We never update records from the CRM.

Is it possible to initiate mass sync of contacts using this template or it works just like case 1?
No, contacts are only synchronized when they call in.
 
@edossantos thanks for your latest feedback. We have set up the template into 3CX and everything is looking good with the app, but when a user is receiving a call using the web client, right after the ringing starts the caller URL is opened in a popup. Is there any configuration that prevents this to happen?
 
Yes, go to the Web Client > Settings > Integration, and you can disable the popups from there.
 
Status
Not open for further replies.

Latest Posts

Forum statistics

Threads
112,324
Messages
591,897
Members
165,475
Latest member
lastshadow