Salesforce Bulk API - "missing a mapping for the external id field" error - salesforce

I'm starting a bulk API job and passing a spec file. Here is the job.txt file I'm using to create the job:
<?xml version="1.0" encoding="UTF-8"?>
<jobInfo xmlns="http://www.force.com/2009/06/asyncapi/dataload">
<operation>upsert</operation>
<object>Contact</object>
<externalIdFieldName>Unique_Email__c</externalIdFieldName>
<contentType>CSV</contentType>
</jobInfo>
Then, I'm posting a spec file as follows:
Salesforce Field,Csv Header,Value,Hint
Unique_Email__c,email1,,
Name,Full Name,,
And I get the error "Transformation specification is missing a mapping for the external id field" but that's very strange because the Unique_Email__c is actually there. What's going on?

Related

Retrieve Metadata connector resulting in error - Unable to parse the unpackaged stream

Based on the comment here I am trying to use retrieve metadata connector in Mulesoft to achieve the description of an Object.
Created a package.xml
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>*</members>
<name>CustomObject</name>
</types>
<version>54.0</version>
</Package>
Documentation suggests that in order to use Unpackaged field the format should be Binary. Hence I read the package.xml file and then converted it to Binary format using this dwl
%dw 2.0
output text/plain
import dw::Crypto
---
Crypto::hashWith(write(payload,"application/xml"),'MD5')
Reference: Object-Binary
Below is what I configured in the connector
Retrieve Metadata Connector Config
<salesforce:retrieve-metadata doc:name="Retrieve metadata" doc:id="d2aa6e13-3012-4e53-a448-3c00f5058f55" config-ref="Salesforce_Config" unpackaged="#[payload]" />
This results in the below stack trace
********************************************************************************
Message : Unable to parse the unpackaged stream
Element : sf-testFlow/processors/2 # sf-test:sf-test.xml:74 (Retrieve metadata)
Element DSL : <salesforce:retrieve-metadata doc:name="Retrieve metadata" doc:id="d2aa6e13-3012-4e53-a448-3c00f5058f55" config-ref="Salesforce_Config" unpackaged="#[payload]"></salesforce:retrieve-metadata>
Error type : MULE:UNKNOWN
FlowStack : at sf-testFlow(sf-testFlow/processors/2 # sf-test:sf-test.xml:74 (Retrieve metadata))
--------------------------------------------------------------------------------
Root Exception stack trace:
org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
Not sure the connector expects this type of format? or whether this approach is wrong?
You are not converting the XML to binary, you are digitally hashing it, which makes it impossible to recover the original content. Basically it is encrypting the content and throwing away the key.
Have you tried instead the <salesforce:read-metadata> operation? Reference https://docs.mulesoft.com/salesforce-connector/10.11/salesforce-connector-reference#ReadMetadata
Example:
<salesforce:read-metadata type="CustomObject" config-ref="config">
<salesforce:full-names><![CDATA[#[["Lead"]]]]></salesforce:full-names>
</salesforce:read-metadata>

Azure Logic App outputs XML all in single line

I'm trying to convert a CSV to XML, which works perfectly fine when I test the map file in Visual Studio as I made sure the XSLT1.0 contains indent="yes". But for some reason when I repeat the steps in my Azure Logic App everything gets exported to one line:
<?xml version="1.0" encoding="utf-8"?><enfinity xsi:schemaLocation="http://www.fakewebsite.com/xml/ns/enfinity/7.1/bc_pricing/impex bc_pricing.xsd" major="6" minor="1" family="enfinity" branch="enterprise" build="build" xmlns="http://www.fakewebsite.com/xml/ns/enfinity/7.1/bc_pricing/impex" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dt="http://www.fakewebsite.com/xml/ns/enfinity/6.5/core/impex-dt"><product-price-list id="DEMarkdown" priceType="ES_SalePrice" import-mode="UPDATE"><display-name>DE Markdown</display-name><description /><enabled>true</enabled><priority>1</priority><target-groups><customer-segments><customer-segment id="Everyone" repository-id="WhiteStuff-DE-Anonymous" /><customer-segment id="IG_RegisteredUsers" repository-id="WhiteStuff-DE-Anonymous" /></customer-segments></target-groups><product-price-list-entry sku="433493126" import-mode="REPLACE"><price-scale-table type-code="1" currency="EUR"><valid-from>2021-07-06T00:00:00+00:00</valid-from><valid-to>2099-07-13T00:00:00+00:00</valid-to><price-scale-entries><fixed-price-entry quantity="1" unit=""><value>44.95</value></fixed-price-entry></price-scale-entries></price-scale-table><price-scale-table type-code="1" currency="GBP"><valid-from>2021-07-06T00:00:00+00:00</valid-from><valid-to>2099-07-13T00:00:00+00:00</valid-to><price-scale-entries><fixed-price-entry quantity="1" unit=""><value>39.50</value></fixed-price-entry></price-scale-entries></price-scale-table></product-price-list-entry></product-price-list></enfinity>
I have 2 ways for this
WAY-1
You can use the XML Validation connector before the process which parses the content into the right format.
WAY-2
Just for viewing purposes, you can do a request-response method using Postman then use XML format in order to achieve your requirement.
For those interested, I've found a setting within the Logic App, simply select Apply XSLT output attributes and that's it, no validation needed either!

sqlpackage DeployReport generate empty xml

I'm trying to use sqlpackage.exe with DeployReport action (following this documentation), but I'm getting empty xml:
<?xml version="1.0" encoding="utf-8"?><DeploymentReport xmlns="http://schemas.microsoft.com/sqlserver/dac/DeployReport/2012/02"><Alerts /></DeploymentReport>
My command is:
sqlpackage /action:DeployReport /SourceFile:"Database Services\bin\Debug\Database Services.dacpac" /TargetServerName:TESTL05,123 /TargetDatabaseName:test /OutputPath:"DeployReport.xml"
I tried also to use this suggested WA but it didn't help.:
SqlPackage.exe /action:DeployReport /TargetConnectionString:"Data Source=TEST05,123;Integrated Security=True;Persist Security Info=False;Pooling=False;MultipleActiveResultSets=False;Connect Timeout=60;Encrypt=False;TrustServerCertificate=False;Initial catalog=test" /SourceFile:"Database Services\bin\Debug\Database Services.dacpac" /OutputPath:"C:\git\DeployReport.xml"
BTW, when I'm doing publish action, I do see the expected changes in my DB/
Can you suggest what's wrong here?

Trouble with adding Trusted Provider (SAML 2.0): can not parse my service provider metadata

I'm getting error message in Novell iManager "The XML is malformed. cvc-complex-type.2.4.a: Invalid content was found starting with element 'md:EncryptionMethod'. One of '{"http://www.w3.org/2000/09/xmldsig#":KeyInfo}' is expected." when add this service provider metadata:
<?xml version="1.0" encoding="UTF-8"?>
<md:EntityDescriptor entityID="https://.../" xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata">
<md:SPSSODescriptor protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol" WantAssertionsSigned="true" AuthnRequestsSigned="true">
<md:KeyDescriptor use="encryption">
<md:EncryptionMethod xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/>
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<X509Data><X509Certificate>...</X509Certificate></X509Data>
</KeyInfo>
</md:KeyDescriptor>
<md:AssertionConsumerService isDefault="true" index="0" Location="https://.." Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"/>
</md:SPSSODescriptor>
<md:Organization>...</md:Organization>
...
</md:EntityDescriptor>
What I do in Novell iManager: IdentityServers -> AH DMZ Identity Server -> New Trusted Provider -> Service Provider -> Source: Metadata Text
The strange thing is that it complains on lack of KeyInfo element while it's here with the correct namespace. Any idea why it might be?
If I specify third-party metadata from here: https://federation.njedge.net/metadata/njedge-fed-metadata.xml it says
"The XML is malformed.
cvc-complex-type.2.4.a: Invalid content was found starting with element 'Organization'. One of '{"http://www.w3.org/2000/09/xmldsig#":Signature, "urn:oasis:names:tc:SAML:2.0:metadata":Extensions, "urn:oasis:names:tc:SAML:2.0:metadata":RoleDescriptor, "urn:oasis:names:tc:SAML:2.0:metadata":IDPSSODescriptor, "urn:oasis:names:tc:SAML:2.0:metadata":SPSSODescriptor, "urn:oasis:names:tc:SAML:2.0:metadata":AuthnAuthorityDescriptor, "urn:oasis:names:tc:SAML:2.0:metadata":AttributeAuthorityDescriptor, "urn:oasis:names:tc:SAML:2.0:metadata":PDPDescriptor, "urn:oasis:names:tc:SAML:2.0:metadata":AffiliationDescriptor}' is expected.
"
Looks like it expects some service provider specific metadata file format, and unfortunately I was unable to find any information about different formats of SAML 2.0 metadata.
Loos like there were 2 issues:
1) Novell expects strict order of elements
2) It does not recognize default namespace like <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#"> instead use <somenamespace:KeyInfo xmlns:somenamespace="http://www.w3.org/2000/09/xmldsig#">
weird :)

What causes the InvalidEntity exception in the SFDC bulk api?

When creating a new bulk job through the API, I am getting an InvalidEntity as an exception code which isn't in SFDC's docs (pdf)
I'm making the following request
https://na13-api.salesforce.com/services/async/24.0/job
<?xml version="1.0" encoding="UTF-8"?>
<jobInfo xmlns="http://www.force.com/2009/06/asyncapi/dataload">
<operation>query</operation>
<object>Campaign</object>
<concurrencyMode>Parallel</concurrencyMode>
<contentType>CSV</contentType>
</jobInfo>
And I get this response:
<?xml version="1.0" encoding="UTF-8"?><error
xmlns="http://www.force.com/2009/06/asyncapi/dataload">
<exceptionCode>InvalidEntity</exceptionCode>
<exceptionMessage>Entity 'Campaign' is not supported by the Bulk API.</exceptionMessage>
</error>
I've excluded the headers but I do have accept & content encoding specified as gzip and the content is gzipped when it is sent and received.
The requests work correctly for
Lead
Contact
Opportunity
Task
Event
OpportunityContactRole
Account
CampaignMember
Note
Profile
RecordType
User
I only get the exception shown above for:
Campaign
UserLicense
OpportunityStage
OpportunityHistory
LeadHistory
I'm only using the bulk api to download csv's out of salesforce and I've only tried the above entities because I don't need any others.
It has been a very long time, but I think you can get this exception if one of your foreign key relationships is incorrect.

Resources