Lightning-Flow-Scanner / lightning-flow-scanner-core

A rule engine capable of conducting static analysis on the metadata associated with Salesforce Lightning Flows, Process Builders, and Workflows.
https://www.npmjs.com/package/lightning-flow-scanner-core
MIT License
27 stars 9 forks source link

False positive 'FlowDescription' rule #39

Closed TonyCrousty closed 1 year ago

TonyCrousty commented 1 year ago

Hi, my screen flow has a description. Here is an extract of its source :

<?xml version="1.0" encoding="UTF-8"?>
<Flow xmlns="http://soap.sforce.com/2006/04/metadata">
...
    <description>Convertir un Lead. Exécuté via un bouton affiché dans un composant de vérification affiché sur la page d&apos;un Lead. 
Run flow Without Sharing: sans cela l&apos;opport créée n&apos;est pas accessible aux utilisateurs standard.</description>
...
</Flow>

Nevertheless, when running the flow scanner, I matches the FlowDescription rule.

RubenHalman commented 1 year ago

@TonyCrousty Thank you for pointing this out. This is strange and I am not experiencing it, so without more context its hard for me to debug this. Few questions:

  1. Is this the only flow where you experience this issue?
  2. Are you sure the xml you show is also the latest version of the flow? if there is a newer inactive version this might cause issues.
  3. Are you sure its valid xml?
RubenHalman commented 1 year ago

@TonyCrousty I'd also be happy to set up a call some time to look at those questions together if it is easier for you

TonyCrousty commented 1 year ago
  1. No, as far as I know, it happens on all of my flows
  2. Yes, sure, freshly retrieved from my sandbox
  3. Yes, sure. I managed the xml only from the Salesforce flow builder.

Here is the full source of a simpler flow encountering the same issue :

<?xml version="1.0" encoding="UTF-8"?>
<Flow xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>58.0</apiVersion>
    <assignments>
        <name>Assign_Date_MES</name>
        <label>Assign Date MES</label>
        <locationX>50</locationX>
        <locationY>350</locationY>
        <assignmentItems>
            <assignToReference>recordId.Date_MES_PCE__c</assignToReference>
            <operator>Assign</operator>
            <value>
                <elementReference>Date_MES_PCE</elementReference>
            </value>
        </assignmentItems>
        <connector>
            <targetReference>Date_MHS_PCE_renseignee</targetReference>
        </connector>
    </assignments>
    <assignments>
        <name>Assign_Date_MHS</name>
        <label>Assign Date MHS</label>
        <locationX>50</locationX>
        <locationY>650</locationY>
        <assignmentItems>
            <assignToReference>recordId.Date_MHS_PCE__c</assignToReference>
            <operator>Assign</operator>
            <value>
                <elementReference>Date_MHS_PCE</elementReference>
            </value>
        </assignmentItems>
        <connector>
            <targetReference>Update_contrat</targetReference>
        </connector>
    </assignments>
    <decisions>
        <name>Date_MES_PCE_renseignee</name>
        <label>Date MES PCE renseignée</label>
        <locationX>182</locationX>
        <locationY>242</locationY>
        <defaultConnector>
            <targetReference>Date_MHS_PCE_renseignee</targetReference>
        </defaultConnector>
        <defaultConnectorLabel>Non</defaultConnectorLabel>
        <rules>
            <name>Oui_Date_MES_renseignee</name>
            <conditionLogic>and</conditionLogic>
            <conditions>
                <leftValueReference>Date_MES_PCE</leftValueReference>
                <operator>IsNull</operator>
                <rightValue>
                    <booleanValue>false</booleanValue>
                </rightValue>
            </conditions>
            <connector>
                <targetReference>Assign_Date_MES</targetReference>
            </connector>
            <label>Oui, Date MES renseignée</label>
        </rules>
    </decisions>
    <decisions>
        <name>Date_MHS_PCE_renseignee</name>
        <label>Date MHS PCE renseignée</label>
        <locationX>182</locationX>
        <locationY>542</locationY>
        <defaultConnector>
            <targetReference>Update_contrat</targetReference>
        </defaultConnector>
        <defaultConnectorLabel>Non</defaultConnectorLabel>
        <rules>
            <name>Oui_Date_MHS_renseignee</name>
            <conditionLogic>and</conditionLogic>
            <conditions>
                <leftValueReference>Date_MHS_PCE</leftValueReference>
                <operator>IsNull</operator>
                <rightValue>
                    <booleanValue>false</booleanValue>
                </rightValue>
            </conditions>
            <connector>
                <targetReference>Assign_Date_MHS</targetReference>
            </connector>
            <label>Oui, Date MHS renseignée</label>
        </rules>
    </decisions>
    <description>Permet l&apos;édition exceptionnelle de champs en lecture seule au niveau du Profil, du Layout ou de la Flexipage. 
A ce jour, il permet, selon les cas, d&apos;opérer sur Date MES PCE et Date MHS PCE.</description>
    <environments>Default</environments>
    <interviewLabel>CTR Mise à jour spécifique {!$Flow.CurrentDateTime}</interviewLabel>
    <label>CTR MàJ exceptionelle</label>
    <processMetadataValues>
        <name>BuilderType</name>
        <value>
            <stringValue>LightningFlowBuilder</stringValue>
        </value>
    </processMetadataValues>
    <processMetadataValues>
        <name>CanvasMode</name>
        <value>
            <stringValue>AUTO_LAYOUT_CANVAS</stringValue>
        </value>
    </processMetadataValues>
    <processMetadataValues>
        <name>OriginBuilderType</name>
        <value>
            <stringValue>LightningFlowBuilder</stringValue>
        </value>
    </processMetadataValues>
    <processType>Flow</processType>
    <recordUpdates>
        <name>Update_contrat</name>
        <label>Update contrat</label>
        <locationX>182</locationX>
        <locationY>842</locationY>
        <faultConnector>
            <targetReference>Mise_a_jour_impossible</targetReference>
        </faultConnector>
        <inputReference>recordId</inputReference>
    </recordUpdates>
    <runInMode>SystemModeWithSharing</runInMode>
    <screens>
        <name>Mise_a_jour_impossible</name>
        <label>Mise à jour impossible</label>
        <locationX>490</locationX>
        <locationY>950</locationY>
        <allowBack>true</allowBack>
        <allowFinish>true</allowFinish>
        <allowPause>false</allowPause>
        <fields>
            <name>Error_message</name>
            <fieldText>&lt;p&gt;{!$Flow.FaultMessage}&lt;/p&gt;</fieldText>
            <fieldType>DisplayText</fieldType>
        </fields>
        <showFooter>true</showFooter>
        <showHeader>true</showHeader>
    </screens>
    <screens>
        <name>Saisie_des_donnees</name>
        <label>Saisie des données</label>
        <locationX>182</locationX>
        <locationY>134</locationY>
        <allowBack>true</allowBack>
        <allowFinish>true</allowFinish>
        <allowPause>false</allowPause>
        <connector>
            <targetReference>Date_MES_PCE_renseignee</targetReference>
        </connector>
        <fields>
            <name>Date_MES_PCE</name>
            <dataType>Date</dataType>
            <defaultValue>
                <elementReference>recordId.Date_MES_PCE__c</elementReference>
            </defaultValue>
            <fieldText>Date MES PCE</fieldText>
            <fieldType>InputField</fieldType>
            <isRequired>true</isRequired>
            <visibilityRule>
                <conditionLogic>and</conditionLogic>
                <conditions>
                    <leftValueReference>recordId.TECH_Can_update_Date_MES__c</leftValueReference>
                    <operator>EqualTo</operator>
                    <rightValue>
                        <booleanValue>true</booleanValue>
                    </rightValue>
                </conditions>
            </visibilityRule>
        </fields>
        <fields>
            <name>Date_MHS_PCE</name>
            <dataType>Date</dataType>
            <defaultValue>
                <elementReference>recordId.Date_MHS_PCE__c</elementReference>
            </defaultValue>
            <fieldText>Date MHS PCE</fieldText>
            <fieldType>InputField</fieldType>
            <isRequired>true</isRequired>
            <visibilityRule>
                <conditionLogic>and</conditionLogic>
                <conditions>
                    <leftValueReference>recordId.TECH_Can_update_Date_MHS__c</leftValueReference>
                    <operator>EqualTo</operator>
                    <rightValue>
                        <booleanValue>true</booleanValue>
                    </rightValue>
                </conditions>
            </visibilityRule>
        </fields>
        <fields>
            <name>Saisie_donnees_infos</name>
            <fieldText>&lt;p&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;Attention : cet écran permet uniquement de renseigner une date. Après enregistrement, celle-ci ne pourra plus être modifiée.&lt;/span&gt;&lt;/p&gt;</fieldText>
            <fieldType>DisplayText</fieldType>
        </fields>
        <nextOrFinishButtonLabel>Enregistrer</nextOrFinishButtonLabel>
        <showFooter>true</showFooter>
        <showHeader>true</showHeader>
    </screens>
    <start>
        <locationX>56</locationX>
        <locationY>0</locationY>
        <connector>
            <targetReference>Saisie_des_donnees</targetReference>
        </connector>
    </start>
    <status>Active</status>
    <variables>
        <description>Contrat à l&apos;origine de l&apos;exécution de ce screen flow</description>
        <name>recordId</name>
        <dataType>SObject</dataType>
        <isCollection>false</isCollection>
        <isInput>true</isInput>
        <isOutput>false</isOutput>
        <objectType>Contrat__c</objectType>
    </variables>
</Flow>
RubenHalman commented 1 year ago

@TonyCrousty Thank you for letting us know about this bug. We believe this has been resolved with the latest version v2.11.0. Do let us know if you still experience any issue!