RangerMSP Business Automation for successful ITs


Go Back   RangerMSP Forums > RangerMSP Software Discussion Forum (CCRM)

Thread Tools Search this Thread
 
October 7th, 2015, 11:04 AM
jakogut
 
Posts: 29
I'm writing a python interface for the CommitCRM low-level API. Currently, I'm working on read/update functionality, and I've successfully loaded the functions exported from CmtDbEng.dll.

I can connect to a test DB with CmtInitDbEngDll(), and the return status is 1.

However, when I try to call CmtInsUpdRec() with the same data and buffers as in the (C++ example), I get the return status of 1014, which, based on the CommitCRM documentation on (error codes), would indicate a problem with the record ID buffer.

According to the Python documentation, the create_string_buffer() function I use is the correct way to create a mutable buffer to be passed to a native function.

I had considered that there was an incompatibility between the way that Python was creating the buffer, and what CmtInsUpdRec() was expecting, so I used Cython to create the buffer in the exact same way that the C++ sample did, and compiled the whole program to machine code. I received the same error.

I tried looking for the "CmtDBEng.h" header that was included by the C++ sample for clues on what argument types the function was expecting, but I could not find it.

For anyone who is interested, my Python code is here: https://gist.github.com/jakogut/b18b40160b6b5390231b
 
October 7th, 2015, 12:58 PM
Support Team
 
Posts: 7,520
Thank you for posting this and for providing all details. It's hard to say what's the root cause for this and we're not Python experts... We noticed that the buffer length for the RECID is 64 bytes. The ID is 20 character long so maybe a buffer of 21 bytes (20 for the ID and the last one holds ascii 0) would work. Or, you can try appending your existing buffer with ascii 0, just after the RECID so it'll 'end' the RECID string. We're not sure whether this will work but please give it a try.

Hope this helps.
 
October 7th, 2015, 01:03 PM
Support Team
 
Posts: 7,520
One more thing - in case it does not help please use the Help > Technical Support menu in RangerMSP to email us your RangerMSP's log files with Outlook. Maybe something will get logged there.
 
October 7th, 2015, 03:10 PM
jakogut
 
Posts: 29
Thanks for the quick reply.

I thought it was interesting that the C++ example used a 64-byte buffer for a 20 character string, but I just copied it.

I went ahead and tried your suggestion of NULL terminating the RECID buffer, and lowering the size to 21 bytes, and I received the same error code.

If I understand the API correctly, CmtInsUpdRec() should populate that buffer with the RECID of the record that I create/update, so it can and should be empty and writable when I call the function.

As a test, I went ahead and filled the buffer with a RECID of an existing account before passing it to CmtInsUpdRec(), and after the function returned, the buffer was again zeroed out, and the same length as before. This tells me that the buffer is writable by the function, but it's failing some sort of sanity check before it actually creates the record.
 
October 8th, 2015, 06:03 AM
Support Team
 
Posts: 7,520
The log files were analyzed. The error you see means that:
Software name is less than 3 characters long. Make sure you specify your software name has 3 to 15 characters.
(The error code in the documentation was incorrect and we fixed that)

When looking at the Python code, we suspect that the application name was not initialized.
For example in C++ it should be like :

config.AppName = "C++ Demo"


Hope this helps.
 
October 8th, 2015, 09:59 AM
jakogut
 
Posts: 29
Fantastic, that worked!

If you guys would like, I can add a Python code sample to the wiki as a show of thanks.
 
October 8th, 2015, 10:34 AM
Support Team
 
Posts: 7,520
This is great! Thanks for the update.
Yes, we would love to include the sample onour Wiki. Please email a "final" version to our support@ and it'll get published. Thanks!
Reply





All times are GMT -6. The time now is 10:51 PM.

Archive - Top    

RangerMSP - A PSA software designed for MSPs and IT Services Providers
Forum Software Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.