<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ahmed HAMMAMI</title>
    <description>The latest articles on DEV Community by Ahmed HAMMAMI (@ahmed_hammami_33f0d95ab89).</description>
    <link>https://dev.to/ahmed_hammami_33f0d95ab89</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1657806%2F6bf735e2-8c90-497f-91f3-b721350fa78c.png</url>
      <title>DEV Community: Ahmed HAMMAMI</title>
      <link>https://dev.to/ahmed_hammami_33f0d95ab89</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ahmed_hammami_33f0d95ab89"/>
    <language>en</language>
    <item>
      <title>Import Export Data to Salesforce</title>
      <dc:creator>Ahmed HAMMAMI</dc:creator>
      <pubDate>Mon, 01 Jul 2024 10:43:48 +0000</pubDate>
      <link>https://dev.to/ahmed_hammami_33f0d95ab89/import-export-data-to-salesforce-40kg</link>
      <guid>https://dev.to/ahmed_hammami_33f0d95ab89/import-export-data-to-salesforce-40kg</guid>
      <description>&lt;p&gt;One thing you need to know when working with Salesforce, is how to properly mass import/update data into your Org.&lt;/p&gt;

&lt;p&gt;In this quick guide, we will see what are our options when it comes to importing many records into Salesforce, and what different obstacles could emerge.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Please, as a rule of thumb, always try these manipulations in your Sandbox, hoping you have one and it is in synch with production.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  FIRST
&lt;/h2&gt;

&lt;p&gt;Get your data groomed, put it in an excel sheet with the field API names as column titles. &lt;br&gt;
Check all your object's fields, what fields are required for record creation, check picklist fields active values, check date and numbers format (You can do this using Object manager and going through different fields and objects, or you can use a third party app like Inspector to export the needed object and fields to make sure the API names are correct)&lt;br&gt;
Example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F94jl0pdwny3o0ni2bxv2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F94jl0pdwny3o0ni2bxv2.png" alt="Image description" width="800" height="63"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  SECOND
&lt;/h2&gt;

&lt;p&gt;Make sure you do not have any automation processes(flow, process builder, validation rules) that need to be deactivated/disabled when mass uploading records, is there a bypass user function in your org that needs to be enabled (If you don't know if there are any, or uncertain how to check for this, ask your administrator before moving forward)&lt;br&gt;
for example, in my org I have a on create flow for opportunity object, this flow assigns record types based on some criteria, but when I'm doing a mass import of more than 5000 opportunities, I will probably know the recordtype of the records before inserting, and add that value to my data, so we don't need the flow as it will most certainly clutter our import if it triggers on each record, so we disable it before starting imports and enable it later.&lt;/p&gt;

&lt;h2&gt;
  
  
  THIRD
&lt;/h2&gt;

&lt;p&gt;Choose which tool you're going to use to import data, there are many.&lt;br&gt;
_Salesforce Inspector &lt;br&gt;
_JetStream&lt;br&gt;
_Dataloader&lt;br&gt;
_Skyvia&lt;br&gt;
I'm sure they will all get the job done, and each one has it's differences and pros and cons, I personally prefer Inspector for data imports, but feel free to explore all the tools, for the sake of this guide, we will use Salesforce Inspector Plugin for demonstration.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Salesforce Inspector&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;Add Salesforce inspector plugin to your browser.&lt;br&gt;
Once you have your data file ready and salesforce inspector installed, click on the arrow that appeared on the right of your tab when you are in a Salesforce org, and click " Data import " &lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fovjojoj9j824ach04qjw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fovjojoj9j824ach04qjw.png" alt="Image description" width="350" height="578"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and that will take you to the import window &lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpodpvy16kyvhyrd4kvzh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpodpvy16kyvhyrd4kvzh.png" alt="Image description" width="800" height="158"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Where you will need to chose the type of your data manipulation (insert update or delete) choose the object you want to work on.&lt;/p&gt;

&lt;p&gt;Now go to your Excel file, select the data that you are going to import and hit Ctrl+C (copy)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frvjebkrybe5mwyjckkpx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frvjebkrybe5mwyjckkpx.png" alt="Image description" width="800" height="67"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and then go back to the Data Import tab, click on the rectangle and hit Ctrl+V (paste) &lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frrxmtl5yqf4dpowno4aj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frrxmtl5yqf4dpowno4aj.png" alt="Image description" width="319" height="65"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffb1ltwer2qmzt6366wxw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffb1ltwer2qmzt6366wxw.png" alt="Image description" width="800" height="187"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now as you can see, we have our data "Queued", we just need to verify field mapping, that's on the top right, and chose our batch size, and then click import, and wait for results.&lt;br&gt;
When it finishes, Inspector will add 4 columns to your data table to help you read results;&lt;br&gt;
__Status: Succeeded or failed.&lt;br&gt;
__Id: the created record's ID in Salesforce.&lt;br&gt;
__Action: Updated, Inserted, Deleted.&lt;br&gt;
__Errors: if there is an error message to display.&lt;br&gt;
Please note that Salesforce inspector does not make a log file for the results that you could download, so once it finishes, make sure the checkbox is checked, then click on "Copy Excel Format"&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgb97k3lqo9q3o5jfsc9m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgb97k3lqo9q3o5jfsc9m.png" alt="Image description" width="616" height="49"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;then go back to your excel file, open a new sheet, and hit Ctrl+V(Paste).&lt;br&gt;
that's the only way to keep the log, if you refresh or leave the import tab with the results, &lt;strong&gt;that log will be lost, forver!&lt;/strong&gt;&lt;br&gt;
(if you ever refresh the page by accident or lose the results and you want a quick way to find the inserted records' IDs, click on export data, and then just run SELECT id, field_name, CreatedDate from ObjectName where createdby.name ='Your User Name' ORDER BY CreatedDate DESC and look through these records with the createddate value)&lt;/p&gt;

&lt;p&gt;I always add 2 sheets to my original Data file, one for succeeded records, and one for failures.&lt;/p&gt;

&lt;p&gt;Batch size: 200 is generally fine if you are not uploading heavy data records with a lot of fields and relationships to other objects.&lt;br&gt;
if your import keeps failing instantly with no clear errors related to data values, try bringing the batch size down and try again.&lt;/p&gt;

</description>
      <category>salesforce</category>
      <category>salesforceinspector</category>
      <category>dataloader</category>
      <category>jetstream</category>
    </item>
    <item>
      <title>SALESFORCE FOR OUTLOOK PLUGIN</title>
      <dc:creator>Ahmed HAMMAMI</dc:creator>
      <pubDate>Fri, 21 Jun 2024 13:50:26 +0000</pubDate>
      <link>https://dev.to/ahmed_hammami_33f0d95ab89/salesforce-for-outlook-plugin-23ag</link>
      <guid>https://dev.to/ahmed_hammami_33f0d95ab89/salesforce-for-outlook-plugin-23ag</guid>
      <description>&lt;p&gt;A quick guide how to setup Salesforce for Outlook plugin.&lt;/p&gt;

&lt;p&gt;First, The user must install the Salesforce Add-in from outlook by clicking on this icon in the outlook toolbar.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7zrxh3vtxmmtkwtlnf83.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7zrxh3vtxmmtkwtlnf83.png" alt="Image description" width="800" height="48"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And type 'Salesforce' in the search bar, install the first add-in &lt;br&gt;
called just 'Salesforce'&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2folig9r1xbvzaipc77s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2folig9r1xbvzaipc77s.png" alt="Image description" width="727" height="455"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once the add-in is added, the user must connect to respective salesforce org, usually production.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmuqnkz8n79bisogpngz5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmuqnkz8n79bisogpngz5.png" alt="Image description" width="453" height="837"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;if you want to login using SOO and not with Username and password, click on use a custom domain' and enter your custom domain's name. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6swl8ygb39rk2ilm1r59.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6swl8ygb39rk2ilm1r59.png" alt="Image description" width="603" height="810"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;you can find it by checking the URL in your org for example : {https://&lt;strong&gt;Domain&lt;/strong&gt;.lightning.force.com/} you just need the custom domain, not the whole URL.&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmyinrxnaprnflebwhyud.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmyinrxnaprnflebwhyud.png" alt="Image description" width="628" height="670"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and click ok, then you will be able to see the button to login with SSO.&lt;/p&gt;

&lt;p&gt;After the add-in is installed and connected, the user may access salesforce for outlook buy clicking on the icon directly or in the menu when clicking the 3 dots at the right,&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Note that you must click on an email or meeting, or be in a meeting creation window to see the salesforce icon&lt;br&gt;
&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;Once in an email window, if the email addresses are related to contacts or users in your connected org, Salesforce will do a quick search and fetch you these records &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fso7ki6qc8ojatlcnfckt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fso7ki6qc8ojatlcnfckt.png" alt="Image description" width="456" height="833"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The user can just click the '+' button at the top left and create new records, events, calls, they could even create a new contact record without leaving Outlook&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnfpcct7udl44l8szxhom.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnfpcct7udl44l8szxhom.png" alt="Image description" width="450" height="828"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;they could also make a quick search to fetch salesforce record directly.&lt;/p&gt;

&lt;p&gt;A simple use case:&lt;/p&gt;

&lt;p&gt;If you click on a contact name while in a meeting window you will have the record details of that contact, plus a button 'LOG' that would take you to a form to add an event related to that contact.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F67baq5q816m9wee8rbof.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F67baq5q816m9wee8rbof.png" alt="Image description" width="353" height="727"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>salesforce</category>
      <category>outlook</category>
      <category>integration</category>
    </item>
    <item>
      <title>EXTRACTING DUPLICATES USING SOQL QUERIES</title>
      <dc:creator>Ahmed HAMMAMI</dc:creator>
      <pubDate>Thu, 20 Jun 2024 15:07:02 +0000</pubDate>
      <link>https://dev.to/ahmed_hammami_33f0d95ab89/extracting-duplicates-using-soql-queries-2l7k</link>
      <guid>https://dev.to/ahmed_hammami_33f0d95ab89/extracting-duplicates-using-soql-queries-2l7k</guid>
      <description>&lt;h4&gt;
  
  
  1: Simple find account duplicates example
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT Count(id), name,ShippingCity FROM account GROUP BY ShippingCity, name having Count(ID) &amp;gt; 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Explanation: we can effectively detect duplicates in Salesforce. This query groups records based on specific criteria, such as name and city in the case of accounts, and then counts the number of records within each group. By filtering the results to include only groups where the count is greater than 1, we identify instances where multiple records share the same name and city, indicating potential duplicates. This approach allows us to quickly identify and address duplicate data, helping to maintain data integrity and accuracy within the Salesforce platform.&lt;/p&gt;

&lt;p&gt;Now to get the IDs of those records (because in the query results it would be “aggregate results”) we'd typically need to run two separate queries. The first query, identifies the duplicates based on specific criteria. Then, we use the information from that query to construct a second query to fetch the IDs of those duplicate records, in this case we could use the name values exported with the first query, we can copy them in an Excel file and then put them in SOQL query, &lt;br&gt;
example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT id, name,ShippingCity FROM account WHERE Name in (‘’)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So in summary:&lt;/p&gt;

&lt;p&gt;1_ Run our initial aggregate query to identify the duplicates based on &lt;br&gt;
   name and shipping city.&lt;/p&gt;

&lt;p&gt;2_ Retrieve the names and shipping cities of the duplicate records.&lt;/p&gt;

&lt;p&gt;3_ Construct a new query using the retrieved names and shipping cities &lt;br&gt;
   to fetch the IDs of those duplicate records.&lt;/p&gt;
&lt;h4&gt;
  
  
  2: Real life scenario with detailed explanation
&lt;/h4&gt;

&lt;p&gt;We’ll now examine a real life scenario example; looking for duplicate ContactOpportunityRole records created by user has “hammami” in name, for these records to be duplicates they MUST have the same OpportunityId and ContactId.&lt;br&gt;
I find this query was a good example to show how we could add a lot of logic to quickly determine duplicates using Salesforce Inspector or any other Salesforce tool. &lt;br&gt;
Query for finding duplicates:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT Opportunity.Name AS Op_Name, 
        Opportunity.Id, 
        Contact.Name AS Cnt_Name, 
        COUNT(OpportunityId) AS NB_OP 
 FROM OpportunityContactRole 
 WHERE CreatedBy.Name LIKE '%hammami%' 
 GROUP BY Contact.Name, Opportunity.Name, Opportunity.Id 
 HAVING COUNT(OpportunityId) &amp;gt; 2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Query breakdown;&lt;br&gt;
This SOQL query retrieves data from the OpportunityContactRole object in Salesforce and performs the following actions:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; It selects the following fields:
_Opportunity Name (renamed as "Op_Name")
_Opportunity ID
_Contact Name (renamed as "Cnt_Name")
_The count of Opportunity IDs associated with each record 
    (renamed as "NB_OP")&lt;/li&gt;
&lt;li&gt; It filters the records based on the name of the user who created them. The filter condition is that the "CreatedBy" field should contain the name '%hammami%', meaning it should match any user whose name contains "hammami".&lt;/li&gt;
&lt;li&gt; It groups the records by the Contact name, Opportunity name, and Opportunity ID. This means that records with the same combination of Contact name, Opportunity name, and Opportunity ID will be grouped together.&lt;/li&gt;
&lt;li&gt; It applies a filter condition using the "HAVING" clause to include only groups where the count of Opportunity IDs is greater than 2.
How this query can determine duplicates;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In this SOQL query, we're using the "GROUP BY" clause to group the records by Contact name, Opportunity name, and Opportunity ID. This allows us to aggregate the data and perform calculations (such as counting the number of Opportunity IDs) for each unique combination of Contact and Opportunity.&lt;br&gt;
We're also using the "HAVING" clause to filter the grouped results. Specifically, we're filtering to include only groups where the count of Opportunity IDs is greater than 2. This means that we're interested in finding instances where a Contact is associated with the same Opportunity more than twice.&lt;br&gt;
So, by using the "GROUP BY" and "HAVING" clauses in this query, we're effectively extracting and filtering data to identify Contacts that are associated with the same Opportunity multiple times or in other words, duplicates.&lt;/p&gt;

</description>
      <category>salesforce</category>
      <category>soql</category>
    </item>
  </channel>
</rss>
