<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Marco Almodova on Medium]]></title>
        <description><![CDATA[Stories by Marco Almodova on Medium]]></description>
        <link>https://medium.com/@marcoalmodova?source=rss-e662c92bb7b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*y8eA-ZdLVAv6P4ZK</url>
            <title>Stories by Marco Almodova on Medium</title>
            <link>https://medium.com/@marcoalmodova?source=rss-e662c92bb7b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 12:37:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@marcoalmodova/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Consultando CEP no Salesforce utilizando Flows]]></title>
            <link>https://marcoalmodova.medium.com/consultando-cep-no-salesforce-utilizando-flows-ab910fd18a36?source=rss-e662c92bb7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab910fd18a36</guid>
            <category><![CDATA[salesforce-flow]]></category>
            <category><![CDATA[salesforce]]></category>
            <category><![CDATA[salesforce-development]]></category>
            <dc:creator><![CDATA[Marco Almodova]]></dc:creator>
            <pubDate>Wed, 28 Apr 2021 16:20:34 GMT</pubDate>
            <atom:updated>2021-04-28T16:27:42.262Z</atom:updated>
            <content:encoded><![CDATA[<p>Sim, hoje o post vai ser em português! Desde que entrei no programa Platform Champions da Salesforce, só escrevi posts em inglês. Essa semana pensei: por que não escrever em português?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*rSSHXtiu8SplknUf.jpg" /><figcaption>Saudades de uma churrascaria</figcaption></figure><p>Então pensei na ideia durante o final de semana prolongado aqui na Holanda (ontem foi <a href="https://en.wikipedia.org/wiki/Koningsdag">dia do rei</a> e feriado por aqui) e resolvi criar uma solução simples para consultar CEP no Salesforce. Sim, eu sei que atualmente existe uma <a href="https://help.salesforce.com/articleView?id=sf.customize_maps_autocomplete.htm&amp;type=5">funcionalidade padrão</a> para busca de endereços, mas ela não traz algumas informações específicas que só existem no Brasil e que algumas empresas precisam (código IBGE do endereço, por exemplo) e também só funciona com os campos de endereço padrão.</p><p>Para realizar a consulta de CEPs, usei o <a href="https://viacep.com.br/">ViaCEP</a>. Eu já havia utilizado esse serviço anteriormente em um dos meus clientes quando trabalhava no Brasil e ele se mostrou bem confiável para ser utilizado em ambiente produtivo.</p><p>Eu criei um <a href="https://github.com/marcoalmodova/consulta-cep">repositório</a> com a estrutura básica da integração com o ViaCEP e algumas classes e flows para atualizar o endereço de uma conta, por exemplo. Nesse post vou explicar bem por cima a integração e como utilizar ela com um flow. Nos posts seguintes que vou escrever vou abordar mais assuntos relacionados ao mundo Salesforce, porém ainda utilizando a ideia desse projeto/repositório.</p><p>A integração propriamente dita acontece na classe <em>ViaCepConnector</em>. Nessa classe é feito o callout para o endpoint do ViaCep e também o parse dos dados retornados, assim como a tratativa de erros.</p><p>Nesse primeiro post, a ideia que tive foi de utilizar um flow para expor as informaçōes para os usuários de forma que seja possível digitar o CEP desejado, obter os dados de endereço e atualizar uma conta, por exemplos. Sim, poderíamos ter feito um LWC para isso, mas hoje em dia a Salesforce investe mais e mais nas funcionalidades dos flows, então para quê customizar se podemos fazer o que precisamos da maneira padrão? ;)</p><p>Para expor a consulta de CEP para os flows, precisamos criar um <a href="https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_InvocableMethod.htm">InvocableMethod</a>. Esse tipo de método nos permite não só passar e receber atributos primitivos, mas também atributos construídos com classes Apex, o que no nosso caso é exatamente o que precisamos. Aqui a classe para analisarmos:</p><pre>public inherited sharing class GetCepInfo {<br><br>    @InvocableMethod(Label=&#39;Get Address&#39; Description=&#39;Get the address information based on the CEP provided.&#39;)<br>    public static List&lt;ViaCepResponse&gt; getCepInfo(List&lt;GetCepInfoRequest&gt; requests) {<br>        List&lt;ViaCepResponse&gt; results = new List&lt;ViaCepResponse&gt;();<br><br>        try{<br>            for (GetCepInfoRequest request : requests) {<br>                results.add(ViaCepConnector.<em>getCEPData</em>(request.cep));<br>            }<br>        }catch (Exception e){<br>            throw e;<br>        }<br><br>        return results;<br>    }<br><br>    public inherited sharing class GetCepInfoRequest{<br>        @InvocableVariable(Required=true)<br>        public String cep;<br>    }<br>}</pre><p>Note que defini uma sub-classe para definir o input, que nesse caso é só uma string contendo o CEP. O retorno nesse caso é do tipo ViaCepResponse, que é a mesma classe utilizada para fazer o parse da integração.</p><p>Agora precisamos criar o flow que irá chamar esse método. Ele será chamado por uma quick action no layout do objeto Account. Para que isso seja possível, precisamos criar uma variável no flow chamada <em>recordId</em>. Ela receberá o id do registro quando o flow for aberto pelo contexto do registro de Account que o usuário estiver vendo. Abaixo a visão geral do flow:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5k_iYnyjXf4OUFdT8eauNw.png" /></figure><p>A primeira tela do flow é utilizada para perguntar o CEP que o usuário deseja buscar:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kv5XuK5IJQ6LN1JIOO9ZjQ.png" /></figure><p>Depois temos a ação que chamará o nosso InvocableMethod passando como parâmetro o CEP que o usuário acabou de informar. Clique no botão de adicionar e selecione Action:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*xUoeANt2mADgBCtlUP6JJQ.png" /></figure><p>Busque pela ação que criamos:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WRoKZjutnRbNqTSK2oDpBw.png" /></figure><p>E preencha os campos requeridos. O único atributo de entrada do método é o CEP fornecido pelo usuário:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b5iMXa4-omYNX_jnJEZoVw.png" /></figure><p>O serviço do ViaCEP retorna um erro quando o CEP consultado não existe e o código da integração expõe esse atributo para que quem esteja consumindo a resposta (um Flow, um LWC, etc) possa lidar com o erro da maneira que desejar. Dessa maneira, temos um decision step no flow que trata o erro e direciona o usuário para o caminho correto:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IVgUhHxGCCmdWaCOetbicQ.png" /><figcaption>Decision step</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1Kaplqfn8qz17RqlYiLsFg.png" /><figcaption>Os dois caminhos a serem seguidos</figcaption></figure><p>Veja acima que mostramos uma tela se o CEP nāo for localizado e outra se o mesmo for encontrado. No caso positivo, mostramos as informaçōes retornadas pela integração para que o usuário possa editar algumas delas manualmente, caso necessário. Em seguida temos uma ação para atualizar a conta e por último uma mensagem de sucesso.</p><p>Antes de partirmos para a criaçāo da quick action que irá chamar o flow, é sempre importante ressaltar que quando chamamos um método apex, devemos tratar qualquer erro inesperado (ou esperado) que possa ocorrer no método. Para isso, temos o fault conector:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QJPyAPraJv3BEvomxBdmWg.png" /></figure><p>Para criar a quick action, vá para Setup-&gt;Object Manager-&gt;Account-&gt;Buttons, Links and Actions-&gt;New</p><p>Preencha os campos de maneira a selecionar o flow que você deseja:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ebWvPBsXtvuJdBbbcIxYDA.png" /></figure><p>Após isso, edite o page layouts onde o botão será utilizado e teste o mesmo abrindo algum registro de Account. Abaixo o resultado final:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j2np9FP4HFhXTzVci3NVDg.gif" /></figure><p>Novamente, caso queira dar uma olhada em todo o código utilizado na solução, dê uma olhada no repositório: <a href="https://github.com/marcoalmodova/consulta-cep">https://github.com/marcoalmodova/consulta-cep</a></p><p>Caso tenha alguma dúvida ou sugestão, só deixar uma mensagem aqui ou no meu <a href="https://www.linkedin.com/in/marcoalmodova/">LinkedIn</a> que vou ter prazer em responder! No próximo post vou usar esse mesmo repositório para criar um Lightning Web Component que utilizará a mesma API para consultar CEPs. Fique ligado!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab910fd18a36" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Parsing a CSV file using a LWC]]></title>
            <link>https://marcoalmodova.medium.com/parsing-a-csv-file-using-a-lwc-e99cac1b7515?source=rss-e662c92bb7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/e99cac1b7515</guid>
            <category><![CDATA[csv]]></category>
            <category><![CDATA[lightning-web-component]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[lwc]]></category>
            <category><![CDATA[salesforce]]></category>
            <dc:creator><![CDATA[Marco Almodova]]></dc:creator>
            <pubDate>Sun, 24 Jan 2021 14:58:43 GMT</pubDate>
            <atom:updated>2021-01-24T14:58:43.268Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U7P2XXpJpoZWai6WIcujuQ.png" /></figure><p>There are a couple of standard options to upload a CSV file and create records, but sometimes depending on the business requirements you will need to have a custom and intuitive solution to upload a file and run a custom process to create/update records. This post will cover how to upload a CSV, parse the contents of the file and create Account records, displaying some simple feedback for the user at the end. This is a really simple LWC to parse a CSV file and create records and it can be a starting point to a more robust solution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HER8uHOiCy6ytBfE-1tGhw.gif" /><figcaption>The final result</figcaption></figure><p>I’ve seen some posts explaining how to parse CSV files and there were different solutions: parsing the CSV using an Apex method, aura components, LWC, Javascript methods doing some simple parse operations. In our case, we will use an existing library to parse the file and make our lives easier: Papa Parse. This library has good methods and configuration options to parse the CSV file. You can choose what is going to be the delimiter char, whether the file has a header or not, if the columns are quoted and by which char, and so on.</p><p>As this library accepts a <a href="https://developer.mozilla.org/en-US/docs/Web/API/File">File</a> object as an input, we will use a lightning-input with the type “file” to get the file from the user. After selecting the file, the Papa parser will parse the file and return a list of objects, each object being a row from the file. To use the library, it’s necessary to upload the .js file as a static resource and import it to the LWC:</p><pre>import {LightningElement, track} from &#39;lwc&#39;;<br>import { loadScript } from &#39;lightning/platformResourceLoader&#39;;</pre><pre>import PARSER from &#39;@salesforce/resourceUrl/PapaParse&#39;;</pre><pre>export default class ImportAccounts extends LightningElement {<br>    parserInitialized = false;</pre><pre>renderedCallback() {<br>        if(!this.parserInitialized){<br>            loadScript(this, PARSER)<br>                .then(() =&gt; {<br>                    this.parserInitialized = true;<br>                })<br>                .catch(error =&gt; console.error(error));<br>        }<br>    }<br>}</pre><p>Here is the HTML part of the LWC:</p><pre>&lt;template&gt;<br>    &lt;lightning-card title=&quot;Import Accounts&quot; icon-name=&quot;standard:account&quot;&gt;<br>        &lt;lightning-spinner if:true={loading}&gt;&lt;/lightning-spinner&gt;<br>        &lt;div class=&quot;slds-p-around_medium&quot;&gt;<br>            &lt;lightning-input type=&quot;file&quot;<br>                             label=&quot;CSV file&quot;<br>                             multiple=&quot;false&quot;<br>                             accept=&quot;.csv&quot;<br>                             onchange={handleInputChange}&gt;&lt;/lightning-input&gt;<br>        &lt;/div&gt;<br>        &lt;template if:true={rows.length}&gt;<br>            &lt;div class=&quot;slds-p-around_medium&quot;&gt;<br>                &lt;lightning-datatable key-field=&quot;key&quot;<br>                                     hide-checkbox-column<br>                                     data={rows}<br>                                     columns={columns}&gt;&lt;/lightning-datatable&gt;<br>                &lt;div class=&quot;slds-p-around_small slds-align_absolute-center&quot;&gt;<br>                    &lt;lightning-button variant=&quot;neutral&quot;<br>                                      label=&quot;Cancel&quot;<br>                                      title=&quot;Cancel&quot; onclick={cancel}<br>                                      class=&quot;slds-m-left_x-small&quot;&gt;&lt;/lightning-button&gt;<br>                    &lt;lightning-button variant=&quot;brand&quot;<br>                                      label=&quot;Create&quot;<br>                                      title=&quot;Create&quot; onclick={createAccounts}<br>                                      class=&quot;slds-m-left_x-small&quot;&gt;&lt;/lightning-button&gt;<br>                &lt;/div&gt;<br>            &lt;/div&gt;<br>        &lt;/template&gt;<br>    &lt;/lightning-card&gt;<br>&lt;/template&gt;</pre><p>When selecting the file, the following function will be executed to parse the CSV file:</p><pre>handleInputChange(event){<br>        if(event.target.files.length &gt; 0){<br>            const file = event.target.files[0];<br>            this.loading = true;<br>            Papa.parse(file, {<br>                quoteChar: &#39;&quot;&#39;,<br>                header: &#39;true&#39;,<br>                complete: (results) =&gt; {<br>                    this._rows = results.data;<br>                    this.loading = false;<br>                },<br>                error: (error) =&gt; {<br>                    console.error(error);<br>                    this.loading = false;<br>                }<br>            })<br>        }<br>    }</pre><p>The <strong><em>complete </em></strong>attribute is a callback function that receives an array of objects with the rows from the CSV file. With this, we have a getter to display the rows in a lightning-datatable so the user can have a preview of the rows. We are not limiting the number of records displayed, but consider doing this if you are going to deal with a large number of records. The getter:</p><pre>get rows(){<br>    if(this._rows){<br>        return this._rows.map((row, index) =&gt; {<br>            row.key = index;<br>            if(this.results[index]){<br>                row.result = this.results[index].id || this.results[index].error;<br>            }<br>            return row;<br>        })<br>    }</pre><pre>    return [];<br>}</pre><p>Don’t mind the if(this.results[index]) as of now, its explanation comes later. There is a button to create the account records loaded from the CSV and displayed on the datatable. It will call the following function:</p><pre>createAccounts(){<br>    const accountsToCreate = this.rows.map(row =&gt; {<br>        const fields = {};<br>        fields[NAME_FIELD.fieldApiName] = row.AccountName;<br>        fields[DESCRIPTION_FIELD.fieldApiName] = row.Description;<br>        const recordInput = { apiName: ACCOUNT_OBJECT.objectApiName, fields };<br>        return createRecord(recordInput);<br>    });</pre><pre>    if(accountsToCreate.length){<br>        this.loading = true;<br>        Promise.allSettled(accountsToCreate)<br>            .then(results =&gt; this._results = results)<br>            .catch(error =&gt; console.error(error))<br>            .finally(() =&gt; this.loading = false);<br>    }<br>}</pre><p>Here we are using the <strong><em>createRecord </em></strong>from the<strong><em> lightning/uiRecordApi </em></strong>to create the account records and a<strong><em> Promise.allSettled </em></strong>to have all the records created and get the results to be displayed on the datatable together with the records. You should have noticed that we are using (and defining) only two columns to create the records (Name and Description fields). You can change this part to accept more columns if necessary. I will improve this component in the future to have the columns configurable by the user.</p><p>We have defined a getter to transform the results in the way that we want and then use this info together with the rows so the data is displayed to the user. With the successfully created records, we display the record Ids. When there is an error, we display the error message.</p><pre>get results(){<br>    if(this._results){<br>        return this._results.map(r =&gt; {<br>            const result = {};<br>            result.success = r.status === &#39;fulfilled&#39;;<br>            result.id = result.success ? r.value.id : undefined;<br>            result.error = !result.success ? r.reason.body.message : undefined;<br>            return result;<br>        });<br>    }</pre><pre>    return [];<br>}</pre><p>Here is the entire JS controller:</p><pre>import {LightningElement, track} from &#39;lwc&#39;;<br>import { loadScript } from &#39;lightning/platformResourceLoader&#39;;<br>import { createRecord } from &#39;lightning/uiRecordApi&#39;;</pre><pre>import PARSER from &#39;@salesforce/resourceUrl/PapaParse&#39;;</pre><pre>import ACCOUNT_OBJECT from &#39;@salesforce/schema/Account&#39;;<br>import NAME_FIELD from &#39;@salesforce/schema/Account.Name&#39;;<br>import DESCRIPTION_FIELD from &#39;@salesforce/schema/Account.Description&#39;;</pre><pre>export default class ImportAccounts extends LightningElement {<br>    parserInitialized = false;<br>    loading = false;<br>    @track _results;<br>    @track _rows;<br>    get columns(){<br>        const columns = [<br>            { label: &#39;Account Name&#39;, fieldName: &#39;AccountName&#39; },<br>            { label: &#39;Description&#39;, fieldName: &#39;Description&#39; }<br>        ];</pre><pre>        if(this.results.length){<br>            columns.push({ label: &#39;Result&#39;,fieldName: &#39;result&#39; });<br>        }</pre><pre>        return columns;<br>    }</pre><pre>    get rows(){<br>        if(this._rows){<br>            return this._rows.map((row, index) =&gt; {<br>                row.key = index;<br>                if(this.results[index]){<br>                    row.result = this.results[index].id || this.results[index].error;<br>                }<br>                return row;<br>            })<br>        }</pre><pre>        return [];<br>    }</pre><pre>    get results(){<br>        if(this._results){<br>            return this._results.map(r =&gt; {<br>                const result = {};<br>                result.success = r.status === &#39;fulfilled&#39;;<br>                result.id = result.success ? r.value.id : undefined;<br>                result.error = !result.success ? r.reason.body.message : undefined;<br>                return result;<br>            });<br>        }</pre><pre>        return [];<br>    }</pre><pre>    renderedCallback() {<br>        if(!this.parserInitialized){<br>            loadScript(this, PARSER)<br>                .then(() =&gt; {<br>                    this.parserInitialized = true;<br>                })<br>                .catch(error =&gt; console.error(error));<br>        }<br>    }</pre><pre>    handleInputChange(event){<br>        if(event.target.files.length &gt; 0){<br>            const file = event.target.files[0];<br>            this.loading = true;<br>            Papa.parse(file, {<br>                quoteChar: &#39;&quot;&#39;,<br>                header: &#39;true&#39;,<br>                complete: (results) =&gt; {<br>                    this._rows = results.data;<br>                    this.loading = false;<br>                },<br>                error: (error) =&gt; {<br>                    console.error(error);<br>                    this.loading = false;<br>                }<br>            })<br>        }<br>    }</pre><pre>    createAccounts(){<br>        const accountsToCreate = this.rows.map(row =&gt; {<br>            const fields = {};<br>            fields[NAME_FIELD.fieldApiName] = row.AccountName;<br>            fields[DESCRIPTION_FIELD.fieldApiName] = row.Description;<br>            const recordInput = { apiName: ACCOUNT_OBJECT.objectApiName, fields };<br>            return createRecord(recordInput);<br>        });</pre><pre>        if(accountsToCreate.length){<br>            this.loading = true;<br>            Promise.allSettled(accountsToCreate)<br>                .then(results =&gt; this._results = results)<br>                .catch(error =&gt; console.error(error))<br>                .finally(() =&gt; this.loading = false);<br>        }<br>    }</pre><pre>    cancel(){<br>        this._rows = undefined;<br>        this._results = undefined;<br>    }<br>}</pre><p>In my next blog post, I will improve this component to dynamically get the fields from the Account object and let the user match the columns from the CSV file with the fields. Stay tuned!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e99cac1b7515" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[LWC and async functions]]></title>
            <link>https://marcoalmodova.medium.com/lwc-and-async-functions-1d6440080b01?source=rss-e662c92bb7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/1d6440080b01</guid>
            <category><![CDATA[lwc]]></category>
            <category><![CDATA[salesforce]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[lightning-web-component]]></category>
            <dc:creator><![CDATA[Marco Almodova]]></dc:creator>
            <pubDate>Sun, 11 Oct 2020 09:42:00 GMT</pubDate>
            <atom:updated>2020-10-11T09:42:00.418Z</atom:updated>
            <content:encoded><![CDATA[<p>What a lovely day in The Netherlands. You wake up thinking that it will be a sunny day, but 20 minutes later it starts to rain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IlU7XcikX3FmG974wJzycA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A4JlpdjIEgwGzHwAUFiCkw.jpeg" /><figcaption>A before and after that you don&#39;t like.</figcaption></figure><p>It’s that time of the year when it rains every day and you always need to go outside with a raincoat and your eyes on the rain radar app that it’s installed on your smartphone. Ah, I am missing already those days when the sunset happens at 16:00. Winter is coming 😢.</p><p>Anyways, today I am going to write about Javascript async functions. Here is a quick definition from the MDN website:</p><blockquote>An async function is a function declared with the async<strong> </strong>keyword<strong>. </strong>Async functions are instances of the AsyncFunction constructor, and the await keyword is permitted within them. The async and await keywords enable asynchronous, promise-based behavior to be written in a cleaner style, avoiding the need to explicitly configure promise chains.</blockquote><p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function">async function - JavaScript | MDN</a></p><p>In my last <a href="https://link.medium.com/d8n327Xzuab">post</a>, I’ve described how to use promises and especially how to chain them by getting the result of one and use it as a parameter for the next ones. As you could read from de MDN definition of async functions quoted above, it’s much more clear to write your asynchronous calls using async functions.</p><p>To explain the async behavior, I am going to use the same example that I used in my previous post. The idea is to create one account record and call an apex method to integrate this newly created account to an external system. Let’s start with the HMTL part of the component:</p><pre>&lt;template&gt;<br>    &lt;lightning-card icon-name=&quot;action:new_account&quot; title=&quot;Create Account&quot;&gt;<br>        &lt;div slot=&quot;actions&quot;&gt;<br>            &lt;lightning-button<br>                    class=&quot;slds-m-top_small&quot;<br>                    onclick={handleCreate}<br>                    label=&quot;Create&quot;&gt;<br>            &lt;/lightning-button&gt;<br>        &lt;/div&gt;<br>        &lt;div class=&quot;slds-p-around_small&quot;&gt;<br>            &lt;lightning-layout multiple-rows&gt;<br>                &lt;lightning-layout-item size=&quot;12&quot;&gt;<br>                    &lt;lightning-input type=&quot;text&quot;<br>                                     label=&quot;Account Name&quot;<br>                                     name=&quot;accountName&quot;<br>                                     required<br>                                     onchange={handleChange}<br>                                     value={accountName}&gt;&lt;/lightning-input&gt;<br>                &lt;/lightning-layout-item&gt;<br>            &lt;/lightning-layout&gt;<br>        &lt;/div&gt;<br>    &lt;/lightning-card&gt;<br>&lt;/template&gt;</pre><p>And the Javascript controller below. For now, we are just creating the account:</p><pre>import {LightningElement} from &#39;lwc&#39;;<br>import { createRecord } from &#39;lightning/uiRecordApi&#39;;<br>import ACCOUNT_OBJECT from &#39;@salesforce/schema/Account&#39;;<br>import ACCOUNT_NAME_FIELD from &#39;@salesforce/schema/Account.Name&#39;;<br><br>export default class CreateAccountAsync extends LightningElement {<br>    accountName;<br>    isLoading;<br><br>    async handleCreate(){<br>        const inputFields = this.template.querySelectorAll(&#39;lightning-input&#39;);<br><br>        const allValid = this.checkFieldsValidity(inputFields);<br><br>        if(allValid){<br>            this.isLoading = true;<br><br>            const fields = {};<br>            fields[ACCOUNT_NAME_FIELD.fieldApiName] = this.accountName;<br>            const accountInput = { apiName: ACCOUNT_OBJECT.objectApiName, fields };<br><br>            try{<br>                const createRecordResult = await createRecord(accountInput);<br>                console.log(&#39;account created with id: &#39;, createRecordResult.id);<br>            }catch (error) {<br>                console.log(&#39;error&#39;, error);<br>            }<br><br><br>            this.isLoading = false;<br>        }<br>    }<br><br>    checkFieldsValidity(fields){<br>        const allValid = [...fields].reduce((validSoFar, field) =&gt; {<br>            return validSoFar &amp;&amp; field.reportValidity();<br>        }, true);<br><br>        return allValid;<br>    }<br><br>    handleChange(event){<br>        if(event.target.name === &quot;accountName&quot;){<br>            this.accountName = event.target.value;<br>        }<br>    }<br>}</pre><p>Let’s check the <em>handleCreate </em>function. But first, let’s see how we did it using promises:</p><pre>const fields = {};<br>fields[ACCOUNT_NAME_FIELD.fieldApiName] = this.accountName;<br><br>const accountInput = { apiName: ACCOUNT_OBJECT.objectApiName, fields };</pre><pre>createRecord(accountInput)<br>    .then(result =&gt; {<br>        console.log(&#39;account created with id: &#39;, result.id);<br>    })<br>    .catch(error =&gt; {<br>        console.log(&#39;error&#39;, error);<br>    });</pre><p>And the newer version of the code using async:</p><pre>const fields = {};<br>fields[ACCOUNT_NAME_FIELD.fieldApiName] = this.accountName;<br><br>const accountInput = { apiName: ACCOUNT_OBJECT.objectApiName, fields };</pre><pre>try{<br>    const createRecordResult = await createRecord(accountInput);<br>    console.log(&#39;account created with id: &#39;, createRecordResult.id);<br>}catch (error) {<br>    console.log(&#39;error&#39;, error);<br>}<br><br>this.isLoading = false;</pre><p>Note that there are small, but noticeable changes here. First, we don’t need to use the .then(). Instead, we use the <em>await</em> keyword to tell the Javascript engine that we want to wait for that function (<em>createRecord</em>) to be executed before executing the subsequent lines. If the <em>createRecord </em>is called without the <em>await</em> keyword, the console.log will be executed right away and we would get a log like this: account created with id: undefined. And remember, you need to annotate your function with the <em>async </em>word, like this:</p><pre>async handleCreate(){<br>...<br>}</pre><p>The second thing that I would like to give attention to is how we handle errors using <em>async/await</em>. With the promises way of calling functions, we would use the .catch() function to handle the errors. When it comes to <em>async/await</em>, it’s necessary to use the try/catch blocks:</p><pre>try{<br>    const createRecordResult = await createRecord(accountInput);<br>    console.log(&#39;account created with id: &#39;, createRecordResult.id);<br>}catch (error) {<br>    console.log(&#39;error&#39;, error);<br>}</pre><p>Now, let’s include the method to integrate the account with another system. Again, as in my last post, I am not going to really make a callout, but use an Apex method that waits a few seconds before returning something to the LWC:</p><pre>@AuraEnabled<br>public static String integrateAccount(String accountId){<br>    //do your API call here.<br>    Datetime targetDate = System.<em>now</em>().addSeconds(5);<br><br>    while(System.<em>Now</em>() &lt; targetDate){<br><br>    }<br><br>    return &#39;ok&#39;;<br>}</pre><p>Going back to the LWC, let’s import the Apex method:</p><pre>import integrateAccount from &#39;@salesforce/apex/createAccountController.integrateAccount&#39;;</pre><p>And change the <em>handleCreate</em> function to also call the newly imported <em>integrateAccount</em> function when the account is created. The lines in bold are the ones that were added:</p><pre>const fields = {};<br>fields[ACCOUNT_NAME_FIELD.fieldApiName] = this.accountName;<br>const accountInput = { apiName: ACCOUNT_OBJECT.objectApiName, fields };<br><br>try{<br>    const createRecordResult = await createRecord(accountInput);<br>    console.log(&#39;account created with id: &#39;, createRecordResult.id);<br><br><strong>    const integrationResult = await integrateAccount({ accountId: createRecordResult.id });<br>    console.log(&#39;success!&#39;, integrationResult);</strong><br>}catch (error) {<br>    console.log(&#39;error&#39;, error);<br>}</pre><p>Now we have the two asynchronous functions within the same block. The <em>integrateAccount</em> will not be executed before the result of the <em>createRecord </em>is in place. And we could even add more functions to be called using the <em>await</em> keyword, depending on our business scenario and what’s is necessary to achieve.</p><p>Here is the final version of the js controller:</p><pre>import {LightningElement} from &#39;lwc&#39;;<br>import { createRecord } from &#39;lightning/uiRecordApi&#39;;<br>import integrateAccount from &#39;@salesforce/apex/createAccountController.integrateAccount&#39;;<br>import ACCOUNT_OBJECT from &#39;@salesforce/schema/Account&#39;;<br>import ACCOUNT_NAME_FIELD from &#39;@salesforce/schema/Account.Name&#39;;<br><br>export default class CreateAccountAsync extends LightningElement {<br>    accountName;<br>    isLoading;<br><br>    async handleCreate(){<br>        const inputFields = this.template.querySelectorAll(&#39;lightning-input&#39;);<br><br>        const allValid = this.checkFieldsValidity(inputFields);<br><br>        if(allValid){<br>            this.isLoading = true;<br><br>            const fields = {};<br>            fields[ACCOUNT_NAME_FIELD.fieldApiName] = this.accountName;<br>            const accountInput = { apiName: ACCOUNT_OBJECT.objectApiName, fields };<br><br>            try{<br>                const createRecordResult = await createRecord(accountInput);<br>                console.log(&#39;account created with id: &#39;, createRecordResult.id);<br><br>                const integrationResult = await integrateAccount({ accountId: createRecordResult.id });<br>                console.log(&#39;success!&#39;, integrationResult);<br>            }catch (error) {<br>                console.log(&#39;error&#39;, error);<br>            }<br><br>            this.isLoading = false;<br>        }<br>    }<br><br>    checkFieldsValidity(fields){<br>        const allValid = [...fields].reduce((validSoFar, field) =&gt; {<br>            return validSoFar &amp;&amp; field.reportValidity();<br>        }, true);<br><br>        return allValid;<br>    }<br><br>    handleChange(event){<br>        if(event.target.name === &quot;accountName&quot;){<br>            this.accountName = event.target.value;<br>        }<br>    }<br>}</pre><p>I hope you enjoyed this post and that it could help you in the future. If you have any questions/something to add, just leave a comment here. Enjoy your week and for the ones in The Netherlands, don’t forget your raincoat at home!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1d6440080b01" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[LWC and promises chaining]]></title>
            <link>https://marcoalmodova.medium.com/lwc-and-promises-chaining-9eac0e65e540?source=rss-e662c92bb7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/9eac0e65e540</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[promises]]></category>
            <category><![CDATA[lightning-web-component]]></category>
            <category><![CDATA[salesforce]]></category>
            <category><![CDATA[lwc]]></category>
            <dc:creator><![CDATA[Marco Almodova]]></dc:creator>
            <pubDate>Mon, 20 Jul 2020 20:52:28 GMT</pubDate>
            <atom:updated>2020-07-29T10:23:44.861Z</atom:updated>
            <content:encoded><![CDATA[<p>This weekend I went by train to Cochem in Germany and it took me 5 hours to go and 5 hours to come back. In between the connections, I had the idea to write a blog post about promises chaining. This concept is being really helpful in my latest projects.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*g3JGQrPVJcKGpu6b" /><figcaption>If you have the opportunity, go visit Cochem!</figcaption></figure><p>Have you ever come to a situation where you had to call Apex methods or some standard LWC Javascript APIs multiple times to fulfill the actions that you need? So this blog post is for you.</p><p>Today I am going to talk about how to use promise chains in Lightning Web Components by giving a simple example (for a blog post sake) but this approach can be used in a variety of scenarios.</p><p>First of all, do you know what is a Javascript promise? Here is a quote from the MDN web docs and also the link to the source. So if you have doubts, take some minutes to read the MDN article.</p><blockquote>A <strong>Promise</strong> is a proxy for a value not necessarily known when the promise is created. It allows you to associate handlers with an asynchronous action&#39;s eventual success value or failure reason. This lets asynchronous methods return values like synchronous methods: instead of immediately returning the final value, the asynchronous method returns a <em>promise</em> to supply the value at some point in the future.</blockquote><p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise - JavaScript | MDN</a></p><p>The example that I am going to use creates one account record using the standard <a href="https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.reference_create_record">createRecord</a> function and then gets the account id and send it to an Apex method, which in theory would integrate this account to an external system. Keep in mind that you can achieve the account creation part using different (and better) approaches, but the focus of this post is to explain the promise chain, so that’s why I am creating the record in this way.</p><p>First of all, let’s define the HTML file. The code is simple. We have an input field that will get the account name and a button that will call the <em>handleCreate</em> function.</p><pre>&lt;template&gt;<br>    &lt;lightning-card icon-name=&quot;action:new_account&quot; title=&quot;Create Account&quot;&gt;<br>        &lt;div slot=&quot;actions&quot;&gt;<br>            &lt;lightning-button<br>                    class=&quot;slds-m-top_small&quot;<br>                    onclick={handleCreate}<br>                    label=&quot;Create&quot;&gt;<br>            &lt;/lightning-button&gt;<br>        &lt;/div&gt;<br>        &lt;div class=&quot;slds-p-around_small&quot;&gt;<br>            &lt;lightning-layout multiple-rows&gt;<br>                &lt;lightning-layout-item size=&quot;12&quot;&gt;<br>                    &lt;lightning-input type=&quot;text&quot;<br>                                     label=&quot;Account Name&quot;<br>                                     name=&quot;accountName&quot;<br>                                     required<br>                                     onchange={handleChange}<br>                                     value={accountName}&gt;&lt;/lightning-input&gt;<br>                &lt;/lightning-layout-item&gt;<br>            &lt;/lightning-layout&gt;<br>        &lt;/div&gt;<br>    &lt;/lightning-card&gt;<br>&lt;/template&gt;</pre><p>And the Javascript file below. This first version contains only the account creation part. I will explain how it works and then we will add the rest of the code next.</p><pre>import {LightningElement} from &#39;lwc&#39;;<br>import { createRecord } from &#39;lightning/uiRecordApi&#39;;<br>import ACCOUNT_OBJECT from &#39;@salesforce/schema/Account&#39;;<br>import ACCOUNT_NAME_FIELD from &#39;@salesforce/schema/Account.Name&#39;;<br><br>export default class CreateAccount extends LightningElement {<br>    accountName;<br><br>    handleCreate(){<br>        const inputFields = this.template.querySelectorAll(&#39;lightning-input&#39;);<br><br>        const allValid = this.checkFieldsValidity(inputFields);<br><br>        if(allValid){<br>            const fields = {};<br>            fields[ACCOUNT_NAME_FIELD.fieldApiName] = this.accountName;<br><br>            const accountInput = { apiName: ACCOUNT_OBJECT.objectApiName, fields };<br>            createRecord(accountInput)<br>                .then(result =&gt; {<br>                    console.log(&#39;account created with id: &#39;, result.id);<br>                })<br>                .catch(error =&gt; {<br>                    console.log(&#39;error&#39;, error);<br>                });<br>        }<br>    }<br><br>    checkFieldsValidity(fields){<br>        const allValid = [...fields].reduce((validSoFar, field) =&gt; {<br>            return validSoFar &amp;&amp; field.reportValidity();<br>        }, true);<br><br>        return allValid;<br>    }<br><br>    handleChange(event){<br>        if(event.target.name === &quot;accountName&quot;){<br>            this.accountName = event.target.value;<br>        }<br>    }<br>}</pre><p>The <em>handleChange</em> and <em>checkFieldsValidity </em>are accessory functions that (1) will store the account name in the <em>accountName</em> variable and (2) check the lightning input validity. I know, we have only one field in our case, but this can be useful if you have more input fields in yours 😉.</p><p>Now check the <em>handleCreate </em>function. Besides calling the <em>checkFieldsValidity </em>to know if the input field state is valid, it prepares the parameters required to call the <em>createRecord</em> function and get the result using the .then() statement and catches any error using the .catch().</p><p>Now, what if we want to call an Apex method to integrate this account to an external system right away? Let’s create the Apex class and method:</p><pre>@AuraEnabled<br>public static String integrateAccount(String accountId){<br>    //do your API call here.<br>    Datetime targetDate = System.<em>now</em>().addSeconds(5);<br><br>    while(System.<em>Now</em>() &lt; targetDate){<br><br>    }<br><br>    return &#39;ok&#39;;<br>}</pre><p>You thought I was going to call a real API, right? As this is just an example, I am just holding the execution for 5 seconds (let’s hope that your real API does not take that long to be executed! 😅) and returning a string back to the LWC.</p><p>Going back to the LWC, let’s import the Apex method:</p><pre>import integrateAccount from &#39;@salesforce/apex/createAccountController.integrateAccount&#39;;</pre><p>And change the <em>handleCreate</em> function to also call the newly imported <em>integrateAccount</em> function when the account is created. The lines in bold are the ones that were added:</p><pre>createRecord(accountInput)<br>    .then(result =&gt; {<br>        console.log(&#39;account created with id: &#39;, result.id);<br>        <strong>return integrateAccount({ accountId: result.id });</strong><br>    })<br>    <strong>.then(result =&gt; {<br>        console.log(&#39;success!&#39;, result);<br>    })</strong><br>    .catch(error =&gt; {<br>        console.log(&#39;error&#39;, error);<br>    });</pre><p>Notice that we are returning the <em>integrateAccount</em> function call. But why? When you import and call an imperative Apex method (you can check what it is <a href="https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.apex">here</a>), it returns another promise. Returning this promise in the first .then() block allows us to add another .then() block, that will handle the result that is returned by the Apex method. And you can do it as many times as you need. Let’s suppose that with the result of the API (made by the Apex method) you want to create another record or run any other logic. You will end up with a code like this:</p><pre>createRecord(accountInput)<br>    .then(result =&gt; {<br>        console.log(&#39;account created with id: &#39;, result.id);<br>        return integrateAccount({ accountId: result.id });<br>    })<br>    .then(result =&gt; {<br>        console.log(&#39;success!&#39;, result);<br>        //return another promise 1<br>    })<br>    .then(result =&gt; {<br>        //return another promise 2<br>    })<br>    .then(result =&gt; {<br>        //return another promise 3<br>    })<br>    .catch(error =&gt; {<br>        console.log(&#39;error&#39;, error);<br>    });</pre><p>The <em>.catch()</em> will always be called whenever any of the <em>.then() </em>blocks get an error. So you can handle your errors there like showing feedback messages to the user.</p><p>To finish this post, let’s talk about the last (but not least important) thing from the promise chaining subject: the <em>.finallly()</em> block. To do so, add a lightning-spinner to your HTML file. The spinner will give a feedback to the user while the creation/integration transactions are still running. Like this:</p><pre>&lt;template&gt;<br>    &lt;lightning-card icon-name=&quot;action:new_account&quot; title=&quot;Create Account&quot;&gt;<br>        <strong>&lt;lightning-spinner if:true={isLoading} alternative-text=&quot;Loading&quot;&gt;&lt;/lightning-spinner&gt;</strong><br>        &lt;div slot=&quot;actions&quot;&gt;<br>...</pre><p>Add the isLoading variable to the js file:</p><pre>import {LightningElement} from &#39;lwc&#39;;<br>import { createRecord } from &#39;lightning/uiRecordApi&#39;;<br>import integrateAccount from &#39;@salesforce/apex/createAccountController.integrateAccount&#39;;<br>import ACCOUNT_OBJECT from &#39;@salesforce/schema/Account&#39;;<br>import ACCOUNT_NAME_FIELD from &#39;@salesforce/schema/Account.Name&#39;;<br><br>export default class CreateAccount extends LightningElement {<br>    accountName;<br>    <strong>isLoading;<br>...</strong></pre><p>And then the <strong>this.isLoading = true; </strong>before the chain and the<strong> .finally()</strong> block at the very end of the promise chain:</p><pre><strong>this.isLoading = true;</strong><br>createRecord(accountInput)<br>    .then(result =&gt; {<br>        console.log(&#39;account created with id: &#39;, result.id);<br>        return integrateAccount({ accountId: result.id });<br>    })<br>    .then(result =&gt; {<br>        console.log(&#39;success!&#39;, result);<br>    })<br>    .catch(error =&gt; {<br>        console.log(&#39;error&#39;, error);<br>    })<br>    <strong>.finally(() =&gt; this.isLoading = false );</strong></pre><p>The .finally() block will always run at the end of the promise chain, even if you get an error in one of the calls, so you can use it to run things that are common to both success or failure scenarios.</p><p>I hope this blog post helps you when facing a situation like this in your personal or work projects. If you have any questions or something to add to it, just leave a comment and I will be happy to reply.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9eac0e65e540" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A LWC Confirmation Dialog]]></title>
            <link>https://marcoalmodova.medium.com/a-lwc-confirmation-dialog-5aa486e301e4?source=rss-e662c92bb7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/5aa486e301e4</guid>
            <category><![CDATA[lightning-components]]></category>
            <category><![CDATA[salesforce]]></category>
            <category><![CDATA[salesforce-development]]></category>
            <category><![CDATA[salesforce-lightning]]></category>
            <category><![CDATA[lightning-web-component]]></category>
            <dc:creator><![CDATA[Marco Almodova]]></dc:creator>
            <pubDate>Sun, 23 Feb 2020 18:20:08 GMT</pubDate>
            <atom:updated>2020-02-23T18:34:09.717Z</atom:updated>
            <content:encoded><![CDATA[<p>Yet another windy and rainy day in The Netherlands, so I stayed at home today and used the free time to write this article about how to create a Lightning Web Component confirmation dialog.</p><figure><img alt="A little bit windy…" src="https://cdn-images-1.medium.com/max/1024/1*V7iFZIhnTGV-KR3tYAcCbw.jpeg" /><figcaption>Dancing chairs…</figcaption></figure><p>I had to create this component for one of the projects I am working on and I thought it would be worth it to share the idea. The basic scenario here is to have a modal to show a message to the users and ask if they want to proceed or cancel the operation. Here is the final result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s0hBrW8qGiA0NLx2YNCIyA.png" /></figure><p>Basically we can use the <a href="https://www.lightningdesignsystem.com/components/modals/">Lightning Design System Modals</a> to create the UI and add some logic on top of it to handle the ‘Cancel’ and ‘Confirmation’ buttons. You can create the component and add this markup to it:</p><p>HTML file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9056723635ad137779c21ef11ee98d66/href">https://medium.com/media/9056723635ad137779c21ef11ee98d66/href</a></iframe><p>Javascript controller:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6aed8eab13e54c8fcb47331d996fc645/href">https://medium.com/media/6aed8eab13e54c8fcb47331d996fc645/href</a></iframe><p>The component was built to be as dynamic as possible, so we expose some variables to be passed by the parent component which is going to use the confirmation dialog. I commented on all of them so you can check the explanation directly in the code, but I want to give more attention to the <strong>originalMessage</strong><em> </em>parameter and the <strong>handleClick</strong><em> </em>method.</p><p>The <strong>originalMessage</strong><em> </em>is used to pass a message (an ID, an object, a string or whatever message you want) from the parent to the child (our LWC modal) so, when the user clicks on either the confirmation or cancel button, this message will be dispatched back to the parent component. In this way, it’s possible to continue with your process handling the <strong>click</strong> event. The custom event passes two things up:</p><ul><li>status: <strong>cancel</strong> if the user clicks on the cancel button or <strong>confirm</strong> if the user clicks on the other button.</li><li>originalMessage: the message passed from the parent to the child component.</li></ul><p>To test it, I created a simple parent component:</p><p>HTML file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ec716805aeb610bc491f87718c87e7aa/href">https://medium.com/media/ec716805aeb610bc491f87718c87e7aa/href</a></iframe><p>Javascript controller:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/446f05f4960099502540efc90aa4aa98/href">https://medium.com/media/446f05f4960099502540efc90aa4aa98/href</a></iframe><p>Three important things to notice on the parent component:</p><ol><li>The <strong>isDialogVisible</strong> is the variable that controls the dialog component visibility. I created a simple button that sets this variable to true and shows the <strong>c-confirmation-dialog</strong> child component.</li><li>The <strong>onclick={handleClick} </strong>tag is where we inform to the component which method should handle the <strong>click</strong> event dispatched by the dialog component.</li><li>The <strong>name</strong> tag is also important here. We use it to reference which specific instance of the <strong>c-confirmation-dialog </strong>is passing the data up when a user clicks in one of the two buttons. If you check the line 14 you will see that I am checking for the <strong>confirmModal</strong> event name, that is the same name I set on the <strong>c-confirmation-dialog </strong>markup<strong>.</strong></li></ol><p>In this example, I am just setting the text that is being shown in the component to show the message fired by the child component. I added a block of code that can be used in your own scenario (from lines 22 to 26).</p><p>Here is the final result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*8G28HkB_wqISe3AOkAnjIg.gif" /></figure><p>And it also works on the Salesforce mobile app:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*oCQPVceTfoKoW5LXyrcizA.png" /></figure><p>Here is the <a href="https://github.com/marcoalmodova/confirm-dialog">GitHub repo</a> with all the codes used in this article. If you have any questions or contributions, please feel free to contact me.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5aa486e301e4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>