<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mulesoft &#8211; Hamza Siddiqui</title>
	<atom:link href="https://www.mhamzas.com/blog/category/mulesoft/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.mhamzas.com</link>
	<description>4x Salesforce MVP &#124; 26x Certified &#124; Salesforce App &#38; System Architect</description>
	<lastBuildDate>Thu, 09 Jan 2020 15:01:38 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>
<site xmlns="com-wordpress:feed-additions:1">233526040</site>	<item>
		<title>My Blog Wins a Spot in the Top 75 Salesforce Developer Blogs</title>
		<link>https://www.mhamzas.com/blog/2020/01/09/my-blog-wins-a-spot-in-the-top-75-salesforce-developer-blogs/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=my-blog-wins-a-spot-in-the-top-75-salesforce-developer-blogs</link>
					<comments>https://www.mhamzas.com/blog/2020/01/09/my-blog-wins-a-spot-in-the-top-75-salesforce-developer-blogs/#comments</comments>
		
		<dc:creator><![CDATA[hamza]]></dc:creator>
		<pubDate>Thu, 09 Jan 2020 14:53:19 +0000</pubDate>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Codeigniter]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Marketing Cloud]]></category>
		<category><![CDATA[Mulesoft]]></category>
		<category><![CDATA[Proxmox]]></category>
		<category><![CDATA[Salesforce]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[top 75 SF blogs]]></category>
		<guid isPermaLink="false">https://www.mhamzas.com/?p=3062</guid>

					<description><![CDATA[My blog is selected as one of the Top 75 Salesforce Developer Blogs! This is the most comprehensive list of best Salesforce Developer blogs on the internet and I’m honored to have become part of this elite list!  Feedspot expert review team has done <br /><a href="https://www.mhamzas.com/blog/2020/01/09/my-blog-wins-a-spot-in-the-top-75-salesforce-developer-blogs/" class="more-link btn btn-primary">Read More</a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">My blog is selected as one of the Top 75 Salesforce Developer Blogs! </p>



<p class="wp-block-paragraph">This is the most comprehensive list of best Salesforce Developer blogs on the internet and I’m honored to have become part of this elite list!  <a rel="noreferrer noopener" aria-label=" (opens in a new tab)" href="https://blog.feedspot.com/salesforce_developer_blogs/" target="_blank">Feedspot</a> expert review team has done a lot of research, reviews, analysis to rank these blogs.</p>



<p class="wp-block-paragraph">These blogs are ranked based on the following criteria:</p>



<ul class="wp-block-list"><li>Google reputation and Google search ranking</li><li>Influence and popularity on&nbsp;<a href="https://www.facebook.com/sfdcFanBoy/" target="_blank" rel="noreferrer noopener">Facebook</a>,&nbsp;<a href="https://twitter.com/sfdcFanBoy" target="_blank" rel="noreferrer noopener">Twitter</a>, and other social media sites</li><li>Quality and consistency of posts.</li><li>Feedspot’s editorial team and expert review</li></ul>



<p class="wp-block-paragraph">  You can have a look at the full list by clicking <a rel="noreferrer noopener" href="https://blog.feedspot.com/salesforce_developer_blogs" target="_blank"><strong>here</strong></a>. </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.mhamzas.com/blog/2020/01/09/my-blog-wins-a-spot-in-the-top-75-salesforce-developer-blogs/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3062</post-id>	</item>
		<item>
		<title>Mulesoft Salesforce Integration: Using Upsert and Query</title>
		<link>https://www.mhamzas.com/blog/2019/09/03/mulesoft-salesforce-integration-using-upsert-and-query/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mulesoft-salesforce-integration-using-upsert-and-query</link>
					<comments>https://www.mhamzas.com/blog/2019/09/03/mulesoft-salesforce-integration-using-upsert-and-query/#respond</comments>
		
		<dc:creator><![CDATA[hamza]]></dc:creator>
		<pubDate>Tue, 03 Sep 2019 10:19:18 +0000</pubDate>
				<category><![CDATA[Mulesoft]]></category>
		<category><![CDATA[Salesforce]]></category>
		<guid isPermaLink="false">https://www.mhamzas.com/?p=2936</guid>

					<description><![CDATA[This article will explain how to create a Mule API that can&#160;UPSERT&#160;(INSERT and UPDATE) and&#160;RETRIEVE&#160;contacts information from Salesforce CRM using Salesforce Connector. 1. Define the RAML and Generate the RAML Flows: POST: /contacts&#160;— Resource that will upsert contacts in Salesforce. GET: /contacts&#160;— <br /><a href="https://www.mhamzas.com/blog/2019/09/03/mulesoft-salesforce-integration-using-upsert-and-query/" class="more-link btn btn-primary">Read More</a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">This article will explain how to create a Mule API that can&nbsp;<strong>UPSERT&nbsp;</strong>(INSERT and UPDATE) and&nbsp;<strong>RETRIEVE&nbsp;</strong>contacts information from Salesforce CRM using Salesforce Connector.</p>



<h2 class="wp-block-heading"><strong>1. Define the RAML and Generate the RAML Flows:</strong></h2>



<p class="wp-block-paragraph"><strong>POST: /contacts</strong>&nbsp;— Resource that will upsert contacts in Salesforce.</p>



<p class="wp-block-paragraph"><strong>GET: /contacts</strong>&nbsp;— Resource that will get all contacts from Salesforce.</p>



<p class="wp-block-paragraph"><strong>GET: /contacts/{id}</strong> — Resource that will get a contact information by Id.</p>



<pre class="wp-block-code"><code>#%RAML 0.8
title: Salesforce Contacts API
/contacts:
  post: 
    body: 
      application/json:
    responses: 
      200:
        body: 
          application/json:
  get:
    responses: 
      200:
        body: 
          application/json:
  /{id}:
    get:
      responses: 
        200:
          body: 
            application/json:
</code></pre>



<p class="wp-block-paragraph">Once you&#8217;re done defining the RAML, right-click to that file and Select&nbsp;<strong>Mule &gt; Generate Flows From REST API</strong>.</p>



<h2 class="wp-block-heading"><strong>2. Mule Flow Implementation</strong></h2>



<p class="wp-block-paragraph">Create new Mule XML File (mule-salesforce-service.xml) and place all flow implementation here.</p>



<h3 class="wp-block-heading"><strong>2.1 Get Contacts Resource Implementation</strong></h3>



<p class="wp-block-paragraph"><strong>GET: /contacts</strong>&nbsp;— Resource that will get all contacts from Salesforce</p>



<p class="wp-block-paragraph"><strong>GET: /contacts/{id}</strong>&nbsp;— Resource that will get a contact information by ID</p>



<p class="wp-block-paragraph">Create a Private Flow with the name&nbsp;<strong>pf-main-get-contacts.&nbsp;</strong>This flow will handle the above 2 resources. The&nbsp;<strong>Choice&nbsp;</strong>with a condition&nbsp;<strong>#[flowVars.id != null]</strong>, if true, then&nbsp;<strong>Salesforce Get Contact By Id</strong>&nbsp;will be executed, otherwise,&nbsp;<strong>Salesforce Get All Contact.&nbsp;</strong>Also, note that the&nbsp;<strong>flowVars.id</strong>&nbsp;value will come from the resource&nbsp;<strong>/contact/{id}&nbsp;</strong>define in the RAML file.</p>



<figure class="wp-block-image"><img data-recalc-dims="1" decoding="async" src="https://i0.wp.com/dzone.com/storage/temp/10049487-untitled.png?w=640&#038;ssl=1" alt="Image title"/></figure>



<p class="wp-block-paragraph"><strong>Salesforce Configuration:</strong></p>



<p class="wp-block-paragraph">Provide your Salesforce Username, Password, Security Token, and the Authorization URL in the Salesforce Configuration.</p>



<figure class="wp-block-image"><img data-recalc-dims="1" decoding="async" src="https://i0.wp.com/dzone.com/storage/temp/10049503-untitled.png?w=640&#038;ssl=1" alt="Image title"/></figure>



<pre class="wp-block-code"><code>&lt;sfdc:config name="Salesforce__Basic_Authentication"
username="********" password="*********"
securityToken="********" doc:name="Salesforce: Basic Authentication"
url="https://test.salesforce.com/services/Soap/u/39.0" /></code></pre>



<p class="wp-block-paragraph"><strong>Salesforce Get Contact By Id (Salesforce Connector Using Query Operation):</strong></p>



<figure class="wp-block-image"><img data-recalc-dims="1" decoding="async" src="https://i0.wp.com/dzone.com/storage/temp/10051558-untitled.png?w=640&#038;ssl=1" alt="Image title"/></figure>



<p class="wp-block-paragraph"><strong>Salesforce Get Contacts (Salesforce Connector Using Query Operation):</strong></p>



<figure class="wp-block-image"><img data-recalc-dims="1" decoding="async" src="https://i0.wp.com/dzone.com/storage/temp/10051578-untitled.png?w=640&#038;ssl=1" alt="Image title"/></figure>



<p class="wp-block-paragraph"><strong>pf-main-get-contacts Flow XML Code:</strong></p>



<p class="wp-block-paragraph">The <strong>Salesforce Connector</strong> always return an Object Data Type(Collection), so make sure the <strong>Transform Message(Dataweave) </strong>after the Salesforce Connectoralways have <strong>&lt;dw:input-payloadmimeType=&#8221;application/java&#8221;/></strong> to avoid issues and dataweave warning in the logs.</p>



<pre class="wp-block-code"><code>&lt;?xml version="1.0" encoding="UTF-8"?>
&lt;mule xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" xmlns:sfdc="http://www.mulesoft.org/schema/mule/sfdc" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/sfdc http://www.mulesoft.org/schema/mule/sfdc/current/mule-sfdc.xsd
http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd">
&lt;flow name="pf-main-get-contacts">
        &lt;choice doc:name="Choice flowVars.id?">
            &lt;when expression="#[flowVars.id != null]">
                &lt;sfdc:query config-ref="Salesforce__Basic_Authentication" 
                            query="dsql:SELECT Id,LastName,FirstName,Phone,Email FROM Contact WHERE Id = '#[flowVars.id]'" doc:name="Salesforce Get Contact By Id"/>
                &lt;dw:transform-message doc:name="Transform Message To JSON">
                    &lt;dw:set-payload>&lt;![CDATA[%dw 1.0
%output application/json
---
{
correlationId: flowVars.correlationId,
record: (payload map $) default null
}
]]&gt;&lt;/dw:set-payload>
                &lt;/dw:transform-message>
            &lt;/when>
            &lt;otherwise>
                &lt;sfdc:query config-ref="Salesforce__Basic_Authentication" 
                            query="dsql:SELECT Id,LastName,FirstName,Phone,Email FROM Contact" doc:name="Salesforce Get All Contacts"/>
                &lt;set-variable variableName="totalRecords" value="#[payload.size()]" doc:name="Variable Set totalRecords"/>
                &lt;dw:transform-message doc:name="Transform Message To JSON">
                    &lt;dw:input-payload mimeType="application/java"/>
                    &lt;dw:set-payload>&lt;![CDATA[%dw 1.0
%output application/json
---
{
correlationId: flowVars.correlationId,
reacordSize: flowVars.totalRecords,
records: payload map $
}
]]&gt;&lt;/dw:set-payload>
                &lt;/dw:transform-message>
            &lt;/otherwise>
        &lt;/choice>
    &lt;/flow> 
&lt;/mule></code></pre>



<h2 class="wp-block-heading"><strong>2.2 Upsert Contacts Resource Implementation</strong></h2>



<p class="wp-block-paragraph"><strong>POST: /contacts</strong>&nbsp;— Resource that will upsert contacts in Salesforce.</p>



<p class="wp-block-paragraph">The&nbsp;<strong>Transform Message Set Salesforce Payload&nbsp;</strong>converts the JSON request to an Object Data Type(Collection).</p>



<p class="wp-block-paragraph">The&nbsp;<strong>Transform Message To JSON</strong>&nbsp;converts the returned payload(Collection Object Data Type) from&nbsp;<strong>Salesforce connector</strong>&nbsp;to a JSON format with MIME Type&nbsp;<strong>application/json</strong>. It also removes unnecessary fields from&nbsp;<strong>Salesforce Connector</strong>&nbsp;to make the response readable to the user.</p>



<figure class="wp-block-image"><img data-recalc-dims="1" decoding="async" src="https://i0.wp.com/dzone.com/storage/temp/10051637-untitled.png?w=640&#038;ssl=1" alt="Image title"/></figure>



<p class="wp-block-paragraph"><strong>Salesforce Upsert Contact (Salesforce Connector Using Upsert Operation)</strong></p>



<p class="wp-block-paragraph">Set&nbsp;<strong>Upsert&nbsp;</strong>as the&nbsp;<strong>Operation&nbsp;</strong>and the&nbsp;<strong>Id&nbsp;</strong>as the&nbsp;<strong>External Id Field Name</strong>. This&nbsp;<strong>Id&nbsp;</strong>will be used by the Salesforce Data Loader to relate or associate the records to each other during Upsert Operation.&nbsp;For instance, it will associate the records from the JSON request submitted to the Mule API and to the records existing in the Salesforce CRM. If the Id from the JSON request is existing on the Salesforce CRM, it will do an&nbsp;<strong>UPDATE</strong>, if not, then it will do an&nbsp;<strong>INSERT</strong>.</p>



<figure class="wp-block-image"><img data-recalc-dims="1" decoding="async" src="https://i0.wp.com/dzone.com/storage/temp/10051673-untitled.png?w=640&#038;ssl=1" alt="Image title"/></figure>



<p class="wp-block-paragraph"><strong>pf-main-upsert-contacts Flow XML Code:</strong></p>



<pre class="wp-block-code"><code>&lt;?xml version="1.0" encoding="UTF-8"?>
&lt;mule xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" xmlns:sfdc="http://www.mulesoft.org/schema/mule/sfdc" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/sfdc http://www.mulesoft.org/schema/mule/sfdc/current/mule-sfdc.xsd
http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd">
    &lt;flow name="pf-main-upsert-contacts">
        &lt;dw:transform-message doc:name="Transform Message Set Saleforce Payload">
            &lt;dw:input-payload mimeType="application/json"/>
            &lt;dw:set-payload>&lt;![CDATA[%dw 1.0
%output application/java
---
payload]]&gt;&lt;/dw:set-payload>
        &lt;/dw:transform-message>
        &lt;sfdc:upsert config-ref="Salesforce__Basic_Authentication" 
                     externalIdFieldName="Id" type="Contact" 
                     doc:name="Salesforce Upsert Contacts">
            &lt;sfdc:objects ref="#[payload]"/>
        &lt;/sfdc:upsert>
        &lt;logger message=" #['\nSalesforce Return Data: '+payload]" level="INFO" doc:name="Logger Payload"/>
        &lt;dw:transform-message doc:name="Transform Message To JSON">
            &lt;dw:set-payload>&lt;![CDATA[%dw 1.0
%output application/json
---
{
correlationId: flowVars.correlationId,
operation: "UPSERT",
status: "COMPLETED",
processedRecords:payload map {
recordId: $.id,
isSuccess: $.success,
operation: "CREATE" when $.created otherwise "UPDATE",
errors: $.errors map (error,index) -> {
error: error.message,
erroredFields: error.fields
}
}
}
]]&gt;&lt;/dw:set-payload>
        &lt;/dw:transform-message>
    &lt;/flow>
&lt;/mule></code></pre>



<p class="wp-block-paragraph">Reference the created Flow Implementation in the corresponding RAML generated flows.</p>



<figure class="wp-block-image"><img data-recalc-dims="1" decoding="async" src="https://i0.wp.com/dzone.com/storage/temp/10051766-untitled.png?w=640&#038;ssl=1" alt="Image title"/></figure>



<h2 class="wp-block-heading"><strong>Test Result:</strong></h2>



<p class="wp-block-paragraph"><strong>POST: /contacts/</strong></p>



<p class="wp-block-paragraph">Insert 2 records. The API will response the status and operation (CREATE or UPDATE) for each record processed.</p>



<figure class="wp-block-image"><img data-recalc-dims="1" decoding="async" src="https://i0.wp.com/dzone.com/storage/temp/10051780-post-insert.png?w=640&#038;ssl=1" alt="Image title"/></figure>



<figure class="wp-block-image"><img data-recalc-dims="1" decoding="async" src="https://i0.wp.com/dzone.com/storage/temp/10051793-untitled.png?w=640&#038;ssl=1" alt="Image title"/></figure>



<p class="wp-block-paragraph"><strong>POST: /contacts/</strong></p>



<p class="wp-block-paragraph"><strong>Insert 1 record and Update existing record.</strong></p>



<figure class="wp-block-image"><img data-recalc-dims="1" decoding="async" src="https://i0.wp.com/dzone.com/storage/temp/10051809-post-insert.png?w=640&#038;ssl=1" alt="Image title"/></figure>



<figure class="wp-block-image"><img data-recalc-dims="1" decoding="async" src="https://i0.wp.com/dzone.com/storage/temp/10051812-untitled.png?w=640&#038;ssl=1" alt="Image title"/></figure>



<p class="wp-block-paragraph"><strong>GET: /contacts/</strong></p>



<figure class="wp-block-image"><img data-recalc-dims="1" decoding="async" src="https://i0.wp.com/dzone.com/storage/temp/10051815-untitled.png?w=640&#038;ssl=1" alt="Image title"/></figure>



<p class="wp-block-paragraph"><strong>GET /contacts/{id}</strong></p>



<figure class="wp-block-image"><img data-recalc-dims="1" decoding="async" src="https://i0.wp.com/dzone.com/storage/temp/10051821-untitled.png?w=640&#038;ssl=1" alt="Image title"/></figure>



<p class="wp-block-paragraph">Source :  <a href="https://dzone.com/articles/mulesoft-salesforce-integrationusing-upsert-and-qu">https://dzone.com/articles/mulesoft-salesforce-integrationusing-upsert-and-qu</a> </p>



<p class="wp-block-paragraph"></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.mhamzas.com/blog/2019/09/03/mulesoft-salesforce-integration-using-upsert-and-query/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2936</post-id>	</item>
	</channel>
</rss>
