PDA

View Full Version : API - Getting fileds blank in object query


Lakshya Achievers1
November 29th, 2011, 11:31 AM
Hi,
I am trying to get the tickets with due date of less then today. I get a list of tickets but all the fields are blank in it(except due date). Please find my query code below:

CommitCRM.ObjectQuery<CommitCRM.Ticket> ticketSearch = new CommitCRM.ObjectQuery<CommitCRM.Ticket>();
ticketSearch.AddCriteria(CommitCRM.Ticket.Fields.D ueDate, CommitCRM.OperatorEnum.opLessThan, DateTime.Now);
List<CommitCRM.Ticket> dueTickets = ticketSearch.FetchObjects();

I get the of ticket but all the fields are blank except due date.
Regards
LA

Support Team
November 30th, 2011, 12:19 AM
The code snippet you posted is valid and actually works with the sample database. The API is constructed that way that if there was an error processing the call, the execution is interrupted by throwing an exception, which will (should) prevent damaged responses from the API library.

Here are couple of questions whose answers could possible lead us to the root of the problem:

Have you successfully initialized the API before making any of the quoted calls? Pointing the API to the correct DB folder?

Are these calls wrapped in try/catch block making sure you get notified about any exception that the API (could) returned (printing the error instead just ignoring it?).

We also wonder how many records do you get back in the dueTickets array?

Lakshya Achievers1
November 30th, 2011, 09:21 AM
Hi,
Yes I have successfully initialized the API, I am getting data for other queries like account, charges etc by similar query objects.

I dont get any error, I verified by having a breakpoint in vs ide and I am not using any try catch block, so the error must have been thrown.
I am getting a list of 100 elements

Support Team
November 30th, 2011, 10:58 AM
Can you set a breakpoint in the Object.cs file in RangerMSPLib project on line 369? This is a line below this:

string sResp = sbResponse.ToString();

We are interested in the content of the sResp variable. The execution should stop there for each of the record in the array (100 as you mention), but it is enough to make a record of the first 2-3. Of course, the above assumes the ticket fetch (ticketSearch.FetchObjects();) is the first call to the library. If this code takes place after querying for Accounts or Charges, then please skip these records and send us only the result for the ticket search operation.

Feel free to email us the XML if the XML in the response contains confidential information.

Thanks.

Lakshya Achievers1
December 1st, 2011, 09:08 AM
Hi,
Thanks a lot for your early response. I tried to get data as per the steps mentioned and after having the breakpoint in object.cs, moved the ticket calling function to topmost(just for my ease). To my surprise got the data in sResp so checked the ticket in ticketcollection and the proper data was there.
Then I again moved this function calling to 3-4 position i.e. fetched few other objects like account, charges etc and watched for data again. This time I got the same problem. I am pasting the xml in both cases, the first one when I dont get data and second one when I get data. I have made some changes in cdata to maintain confidentiality. If you require the exact xmls I will send it by mail.
Please review the xmls below.

<?xml version="1.0" ?>
<?commitcrmxmlgetrecorddataresponse version = "1.0" ?>
<CommitCRMGetRecordDataResponse>
<Status>SUCCESS</Status>
<ResultCodes></ResultCodes>
<ResultMessage></ResultMessage>
<RecordData></RecordData>
</CommitCRMGetRecordDataResponse>

<?xml version="1.0" ?>
<?commitcrmxmlgetrecorddataresponse version = "1.0" ?>
<CommitCRMGetRecordDataResponse>
<Status>SUCCESS</Status>
<ResultCodes></ResultCodes>
<ResultMessage></ResultMessage>
<RecordData>
<FLDSLPBILLKIND CmtRawData="B"><![CDATA[Billable]]></FLDSLPBILLKIND>
<FLDSLPENDTIME>11:39 AM</FLDSLPENDTIME>
<FLDSLPSTARTTIME>11:01 AM</FLDSLPSTARTTIME>
<FLDSLPBCCODE><![CDATA[System]]></FLDSLPBCCODE>
<FLDSLPBCRECID><![CDATA[BCTRECIDSYSTMDEFAULT]]></FLDSLPBCRECID>
<FLDSLPFEEITEMTYPE><![CDATA[Consulting]]></FLDSLPFEEITEMTYPE>
<FLDSLPUPDATEUSER CmtRawData="CRD931CJW3NLZ6PWSEG1"><![CDATA[abc]]></FLDSLPUPDATEUSER>
<FLDSLPUPDATEDATE>04/10/2011 02:39 PM</FLDSLPUPDATEDATE>
<FLDSLPCREATEUSER CmtRawData="CRD931CJW3NLZ6PWSEG1"><![CDATA[abc]]></FLDSLPCREATEUSER>
<FLDSLPCREATEDATE>04/10/2011 02:38 PM</FLDSLPCREATEDATE>
<FLDSLPSTAGE CmtRawData="B"><![CDATA[Billed]]></FLDSLPSTAGE>
<FLDSLPBILLTOTAL>60.00</FLDSLPBILLTOTAL>
<FLDSLPADJUSTPERCENT>0.00</FLDSLPADJUSTPERCENT>
<FLDSLPADJUSTAMOUNT>0.00</FLDSLPADJUSTAMOUNT>
<FLDSLPADJUSTTYPE CmtRawData="N"><![CDATA[without]]></FLDSLPADJUSTTYPE>
<FLDSLPTOTAL>60.00</FLDSLPTOTAL>
<FLDSLPPRICE>100.00</FLDSLPPRICE>
<FLDSLPQUANTITY>0.00</FLDSLPQUANTITY>
<FLDSLPHOURSAMOUNT>0.60</FLDSLPHOURSAMOUNT>
<FLDSLPDESC>
<![CDATA[There is a long description here in original data ...........................................]]>
</FLDSLPDESC>
<FLDSLPITEMUNITISHOUR><![CDATA[Y]]></FLDSLPITEMUNITISHOUR>
<FLDSLPITEMTYPEGROUP CmtRawData="F"><![CDATA[Labor]]></FLDSLPITEMTYPEGROUP>
<FLDSLPEXPITEMTYPE><![CDATA[Consulting]]></FLDSLPEXPITEMTYPE>
<FLDSLPITEMID><![CDATA[ITMI3H3F7L58033VSFH4]]></FLDSLPITEMID>
<FLDSLPCARDID><![CDATA[CRDCQEKZYP7D3Y8IBKP8]]></FLDSLPCARDID>
<FLDSLPWORKERID CmtRawData="CRD931CJW3NLZ6PWSEG1"><![CDATA[abc]]></FLDSLPWORKERID>
<FLDSLPSLIPDATE>04/10/2011 11:01 AM</FLDSLPSLIPDATE>
<FLDSLPRECID><![CDATA[SLPX21PYRXDCH9YZTHVZ]]></FLDSLPRECID>
<FLDSLPTICKETID><![CDATA[TKTEWYIXZDRH411GUJAI]]></FLDSLPTICKETID>
<FLDSLPADJUST CmtRawData="N"><![CDATA[without]]></FLDSLPADJUST>
<FLDSLPPRODITEMTYPE><![CDATA[Consulting]]></FLDSLPPRODITEMTYPE>
<FLDSLPCONTACTID><![CDATA[CRDCQEKZYP7D3Y8IBKP8]]></FLDSLPCONTACTID>
<FLDSLPUSER1></FLDSLPUSER1>
</RecordData>
</CommitCRMGetRecordDataResponse>

Support Team
December 1st, 2011, 12:43 PM
All seem valid and it does work well here without this issue.

Please log into RangerMSP and using the Help > Technical Support menu in RangerMSP send us your RangerMSP log files for analysis.

Thanks.