salesforce - mule db2 sfdc account data loading -
my java code is:
public class db2sfdc { public map<string, object> getpayloaddata(@payload string src){ hashmap<string, object> sfdcfields = new hashmap<string, object>(); map<string, object> payloadmap = new hashmap<string, object>(); list<map<string, object>> objects = new arraylist<map<string,object>>(); sfdcfields.put("client_alert_description__c", "mule interation"); sfdcfields.put("client_status_reason__c","poc update"); sfdcfields.put("credit_terms__c", "poc terms"); objects.add(sfdcfields); payloadmap.put("type", "account"); payloadmap.put("objects", objects); return payloadmap ; }
mule flows:
<flow name="db2accountflow1" doc:name="db2accountflow1"> <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="db2account" doc:name="http"/> <invoke name="sfdcmap" object-ref="db2sfdc" method="getpayloaddata" methodarguments="#[message.payload]" methodargumenttypes="java.lang.string" doc:name="invoke"/> <sfdc:upsert config-ref="salesforce__basic_authentication" externalidfieldname="client status" type="account" doc:name="salesforce"> <sfdc:objects ref="#[payload.objects]"/> </sfdc:upsert> </flow>
error message @ browser:
failed invoke upsert. message payload of type: hashmap
console error:
error 2015-05-11 18:58:38,090 [[sfdc].connector.http.mule.default.receiver.04] org.mule.retry.notifiers.connectnotifier: failed connect/reconnect: work descriptor. root exception was: null. type: class com.sforce.soap.partner.fault.invalidfieldfault error 2015-05-11 18:58:38,094 [[sfdc].connector.http.mule.default.receiver.04] org.mule.exception.defaultmessagingexceptionstrategy: ******************************************************************************** message : failed invoke upsert. message payload of type: hashmap code : mule_error--2 -------------------------------------------------------------------------------- exception stack is: 1. null (com.sforce.soap.partner.fault.invalidfieldfault) sun.reflect.nativeconstructoraccessorimpl:-2 (null) 2. [invalidfieldfault [apiqueryfault [apifault exceptioncode='invalid_field' exceptionmessage='no such column 'client_alert_description__c' on entity 'account'. if attempting use custom field, sure append '__c' after custom field name. please reference wsdl or describe call appropriate names.' ] row='-1' column='-1' ] ] (java.lang.runtimeexception) org.mule.modules.salesforce.api.salesforceexceptionhandleradapter:69 (null) 3. failed invoke upsert. message payload of type: hashmap (org.mule.api.messagingexception) org.mule.devkit.processor.devkitbasedmessageprocessor:128 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/messagingexception.html) -------------------------------------------------------------------------------- root exception stack trace: [invalidfieldfault [apiqueryfault [apifault exceptioncode='invalid_field' exceptionmessage='no such column 'client_alert_description__c' on entity 'account'. if attempting use custom field, sure append '__c' after custom field name. please reference wsdl or describe call appropriate names.' ] row='-1' column='-1' ] ] @ sun.reflect.nativeconstructoraccessorimpl.newinstance0(native method) @ sun.reflect.nativeconstructoraccessorimpl.newinstance(nativeconstructoraccessorimpl.java:57) @ sun.reflect.delegatingconstructoraccessorimpl.newinstance(delegatingconstructoraccessorimpl.java:45) + 3 more (set debug level logging or '-dmule.verbose.exceptions=true' everything) ********************************************************************************
as given in error message, didnot included complete fields in list mandatory create/update account in sfdc. final code is:
public list<map<string, object>> getpayloaddata(@payload string src){ map<string, object> sfdcfields = new hashmap<string, object>(); list<map<string, object>> accountlist = new arraylist<map<string,object>>(); sfdcfields.put("id", "001m000000in0p5aab"); sfdcfields.put("current_wse_count__c", "20"); accountlist.add(sfdcfields); return accountlist ; }
mule flows update:
<sfdc:update config-ref="salesforce__basic_authentication" type="account" doc:name="salesforce"> <sfdc:objects ref="#[payload]"/> </sfdc:update>
Comments
Post a Comment