function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
philbophilbo 

Perl - WWW::Salesforce - special chars in upsert'ed fields

Hey,

 

Hopefully someone out there can help me on this (and is alertly reading this dev board).

 

I have a Perl script that uses WWW::Salesforce to read data in from a SFDC org, do a whole bunch of transformation, and write data back in via upsert().  The structure and flow all seems fine, and all aspects of SFDC connectivity are functional.  EXCEPT when trying to write non-ASCII chars back to SF.  The use case is as follows:

 

1. Use 'query()' to pull a record from a custom Salesforce object.  The record's Name is 'Québec'.  Note the accented char, whose hex value appears to be 'c3a9' by the time it is pulled into my Perl script.

 

2. Assign this value to the Name field of a brand new record of another custom SF object, and use 'upsert()' to write this record to Salesforce.

 

This fails, with the following information in $result->envelope->{Body}->{upsertResponse}->{result}->{errors}:

 

errors->{fields} : Name

errors->{message} : <objLabel>: value not of required type: core.filemanager.ByteBlobValue@<hexNum>

errors->{statusCode} : INVALID_TYPE_ON_FIELD_IN_RECORD

 

I have tried encoding and decoding the field six ways to Sunday, using everything available in the Encode module (ascii, ascii-ctrl, iso-8859-1, null, utf-8-strict, utf-8), to no avail.  I even tried HTML::Entities and 'encode_entities()', but that changes the accented 'e' character to '&eacute;' which then gets passed verbatim to SF, which clearly I don't want (and should have expected).

 

My WWW::Salesforce module version is 0.12.

 

How can I get fields with characters like this into Salesforce from my Perl script?

 

Thanks.

 

 

 

ianb1469ianb1469

Does something like this help?

 

$WWW::Salesforce::Constants::TYPES{account}->{MY_FIELDS} = 'xsd:string';

 

It gets rid of the error message for me, but doesn't put the data in..
 

philbophilbo

Nah.  I abandoned the WWW::Salesforce approach altogether and wound up writing a whole Perl library sitting on top of DataLoader.  Works like a charm!