twinfield

Using the Browse option


I'm writing an application for Twinfield. I login to an account with 4 administrations in it. I would like to retrieve all information belonging to not payed invoices.

With the search opttion I get al open invoices for a certain office.

string[][] finderOptions = new string[2][];

switch (office)
{
    case 0:
       finderOptions[0] = new string[] { "office", "xxxx01-01" };
       break;
    case 1:
       finderOptions[0] = new string[] { "office", "xxxx03-01" };
       break;
}
finderOptions[1] = new string[] { "dim1", "1300" };
TwinfieldFinder.MessageOfErrorCodes[] errorCodes = xmlFinder.Search(hdrXml, "IVT", "*", 0, 1, 0, finderOptions, out findResult);

This works. But it retuns the invoicenumber and I also need the transaction number. Therefore I perform a Browse to find the traansaction number.

Maybe there is another way to find the complete transaction using the invoicenumber iso the transactionnumber?

The Browse call looks like this:

 TwinfieldProcessXml.ProcessXmlSoapClient xmlClient = new 
 TwinfieldProcessXml.ProcessXmlSoapClient("ProcessXmlSoap", cluster + "/webservices/processxml.asmx?wsdl");                                            
 TwinfieldProcessXml.Header hdrXml2 = new TwinfieldProcessXml.Header();
                hdrXml2.CompanyCode = finderOptions[0][1];
                hdrXml2.AnyAttr = hdr.AnyAttr;
                hdrXml2.SessionID = hdr.SessionID;

It doens't matter if I user the CompanyCode in the headers It alwasy return the informatie belonging to the first office: xxxx01-01.


Solution

  • When using the browse codes in Twinfield, make sure to do the SoapCall to select the right company, as documented there:

    https://c3.twinfield.com/webservices/documentation/#/FAQ

    Otherwise you will get the data back for the default company:

    Q. When using the Browse Data functionality, in the response I get data from a different company. What is wrong?
    A. In the browse data request there is no option to set the current company. Before sending the request, make sure the correct company is set by using the SelectCompany function. See also Web Services Authentication.
    

    To get the open invoices the best way is to use the browse codes. Select code 100 and add a filter on the column matchstatus, here is an example:

    https://gist.github.com/alexjeen/d4ef3295820dc98c7f0171e47294dbfe