Author Topic: CustomerAdd - Dates error  (Read 1752 times)

Vattas

  • Member
  • *
  • Posts: 6
CustomerAdd - Dates error
« on: October 02, 2012, 01:47:29 PM »
I am completing the scripting to run the AddCustomer function.  I am receiving an error at all the date fields, e.g. JobStartDate and OpenBalanceDate.  The FM fields are defined as date fields and contain no values.

The error:
CODE: -1000
SEVERITY: failed validation
MESSAGE: Error at JobStartDate
Rason: Union doesn't support this value.
The element 'JobStatusDate' with value '0-00-00' failed to parse.

Field Value:     0-00-00


What is causing this error and how can I avoid it?

Thanks


Geoffrey Gerhard

  • Guru
  • Member
  • ****
  • Posts: 468
Re: CustomerAdd - Dates error
« Reply #1 on: October 02, 2012, 02:15:27 PM »
Wrapping the date value you're trying to pass in the PCQB_SFormatString function with a qbType of "DATETYPE" should do the trick.

HTH!

Geoffrey Gerhard
Creative Solutions Incorporated
14000 Creekside Drive
Matthews, NC  28105
704) 814-6852

Vattas

  • Member
  • *
  • Posts: 6
Re: CustomerAdd - Dates error
« Reply #2 on: October 02, 2012, 03:06:13 PM »
Thank you for the quick reply, Geoffey!

I changed the line from
PCQB_RqAddFieldWithValue( "OpenBalanceDate" ; Customers::OpenBalanceDate_d ) to
PCQB_RqAddFieldWithValue( "OpenBalanceDate" ; PCQB_SFormatString( Customers::OpenBalanceDate_d ; "DATETYPE" ) )

The same value, 0-00-00, and error are returned with the change.  If I add a date to the field, 10/31/2012, it returns as 2031-2012-10.

The Request
<?xml version="1.0" encoding="ISO-8859-1" ?>
<?qbxml version="8.0" ?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<CustomerAddRq>
<CustomerAdd>
<Name>c_Test Company</Name>
<IsActive>1</IsActive>
<CompanyName>Test Company</CompanyName>
<Salutation></Salutation>
<FirstName></FirstName>
<MiddleName></MiddleName>
<LastName></LastName>
<BillAddress>
<Addr1>Test Company</Addr1>
<Addr2>123 Main Street</Addr2>
<Addr3></Addr3>
<Addr4></Addr4>
<Addr5></Addr5>
<City>SomeTown</City>
<State>AB</State>
<PostalCode></PostalCode>
<Country>Canada</Country>
<Note></Note>
</BillAddress>
<ShipAddress>
<Addr1></Addr1>
<Addr2></Addr2>
<Addr3></Addr3>
<Addr4></Addr4>
<Addr5></Addr5>
<City></City>
<State></State>
<PostalCode></PostalCode>
<Country></Country>
<Note></Note>
</ShipAddress>
<Phone>800-555-1234</Phone>
<AltPhone></AltPhone>
<Fax>800-555-1235</Fax>
<Email>info@someisp.com</Email>
<Contact></Contact>
<AltContact></AltContact>
<CustomerTypeRef>
<ListID></ListID>
<FullName></FullName>
</CustomerTypeRef>
<TermsRef>
<ListID></ListID>
<FullName></FullName>
</TermsRef><SalesRepRef>
<ListID></ListID>
<FullName></FullName>
</SalesRepRef>
<OpenBalance>0.00</OpenBalance> // No value in field.
<OpenBalanceDate>0-00-00</OpenBalanceDate> // No value in field.
<SalesTaxCodeRef>
<ListID></ListID>
<FullName></FullName>
</SalesTaxCodeRef>
<ItemSalesTaxRef>
<ListID></ListID>
<FullName></FullName>
</ItemSalesTaxRef>
<SalesTaxCountry></SalesTaxCountry>
<AccountNumber></AccountNumber>
<CreditLimit>0.00</CreditLimit> // No value in field.
<PreferredPaymentMethodRef>
<ListID></ListID>
<FullName></FullName>
</PreferredPaymentMethodRef>
<CreditCardInfo>
<CreditCardNumber></CreditCardNumber>
<ExpirationMonth></ExpirationMonth>
<ExpirationYear>0</ExpirationYear> // No value in field.
<NameOnCard></NameOnCard>
<CreditCardAddress></CreditCardAddress>
<CreditCardPostalCode></CreditCardPostalCode>
</CreditCardInfo>
<JobStatus></JobStatus>
<JobStartDate>0-00-00</JobStartDate> // No value in field.
<JobProjectEndDate></JobProjectEndDate>
<JobEndDate>0-00-00</JobEndDate> // No value in field.
<JobDesc></JobDesc>
<JobTypeRef>
<ListID></ListID>
<FullName></FullName>
</JobTypeRef>
<Notes></Notes>
<PriceLevelRef>
<ListID></ListID>
<FullName></FullName>
</PriceLevelRef>
<TaxRegistrationNumber></TaxRegistrationNumber>
<CurrencyRef>
<ListID></ListID>
<FullName></FullName>
</CurrencyRef>
</CustomerAdd>
</CustomerAddRq>
</QBXMLMsgsRq>
</QBXML>


As I look through the Request I notice various fields with populated value that are not in the FM fields. There does not seem to be a conclusive pattern as JobProjectEndDate does not contain the 0-00-00 value of the other DATETYPE fields.

Secondly, the CreditCardInfo::ExpirationMonth, INTTYPE, does not populate with '0' as does the CreditCardInfo::ExpiritionYear, INTTYPE.  ExpirationMonth is also erring out.

Have you encountered this before?

Geoffrey Gerhard

  • Guru
  • Member
  • ****
  • Posts: 468
Re: CustomerAdd - Dates error
« Reply #3 on: October 03, 2012, 06:37:57 AM »
I've seen the issue with data fields crop up when using a localized version of FileMaker that has an internal date format that's not the US standard Month/Day/Year. I believe this has come up on this forum before, but I can't recall whether or not it was solved.

As for the formatting applied to empty fields: are you wrapping the value in PCQB_SFormat? If not, it may be that the plug-in contains logic to recognize that an empty OpenBalance element (and the others you've identified as empty but containing a value) won't work and it inserts 0.00 (or 0-00-00) on its own.

You might try amending your Request creation process to omit those elements that have no value and see what happens.

HTH!


Geoffrey Gerhard
Creative Solutions Incorporated
14000 Creekside Drive
Matthews, NC  28105
704) 814-6852

Vattas

  • Member
  • *
  • Posts: 6
Re: CustomerAdd - Dates error
« Reply #4 on: October 12, 2012, 04:39:19 PM »
Thanks Geoffrey,

I am using the date entry method of MM/DD/YYYY.

I tested using the PCQB_SFormat( ) function with no success.

I did an If( IsEmpty( ) ; ; ) test to omit the 'OpenBalanceDate', 'JobStartDate', and 'JobEndDate' child elements.

I corrected a spelling error in the 'JobProjectedEndDate' child element.

I also added a If( IsEmpty( ) ; ; ) test to the 'CreditCardInfo::ExpirationMonth'.  The auto-populated value is a Return character (Unicode 13) if the value is left blank which causes the error in the INTTYPE field.

I also added If( IsEmpty( ) ; ; ) tests to all the ListID fields as they return an error on the Response if an empty value is sent.

So far it is working, thanks.

Mark