+ Start a Discussion
Cody PiersonCody Pierson 
Hi there!

I've been asked to restrict the valid Close Dates for Opporunities to the last day of the month when the Stage is not Closed Won/Lost.

I've found a fromula that does a great job restricting the dates in general, but I can't figure out how to add the additional condition that it should only apply the date limitation when the Opportunity is in certain stages.

IF( 
    MONTH( CloseDate ) = 12,
    DATE( YEAR( CloseDate ) + 1, 1, 1 ),
    DATE( YEAR( CloseDate ), MONTH( CloseDate ) + 1, 1 )
  ) - 1 
)

Any help/insight would be greatly appreciated!
Best Answer chosen by Cody Pierson
Maharajan CMaharajan C
Hi Cody,

If you want to exclude for Closed Won / Lost... Then Use the below Validation Rule...
 
AND(
NOT( ISPICKVAL(StageName, "Closed Won") ),
NOT( ISPICKVAL(StageName, "Closed Lost") ),
CloseDate != (
IF(
MONTH( CloseDate ) = 12,
DATE( YEAR( CloseDate ) + 1, 1, 1 ),
DATE( YEAR( CloseDate ), MONTH( CloseDate ) + 1, 1 )
) - 1
)
)

Thanks,
Maharajan,C
SFDCHemanSFDCHeman 
Help me Create a Trigger for CheckBox to clone Opportunity and OpportunityLineItem
//This is what i have coded please help resolve this
trigger CloneParentOpportunityTrigger on Opportunity (After insert,After update) 
{
    List<Opportunity> oppsToUpdate = new List<Opportunity>();
    Map<Id,Opportunity> OldOppId = new Map<Id,Opportunity>();
    Opportunity newopp = new Opportunity(); 
    if(Trigger.IsAfter)
    {
        if(Trigger.IsInsert || Trigger.IsUpdate)
        {
            if(newopp.Clone_Opportunity__c)
            {
                for(Opportunity opp : Trigger.new)
                { 
                    //opportunity list item
                    newopp.Name = opp.Name;
                    newopp.AccountId = opp.AccountId;
                    newopp.Product_Type__c = opp.Product_Type__c;
                    newopp.CloseDate = opp.CloseDate;
                    newopp.StageName = opp.StageName;
                    newopp.Payment_Frequency__c = opp.Payment_Frequency__c;
                    newopp.Most_Recent_Invoice_Date__c  = opp.Most_Recent_Invoice_Date__c;
                    newopp.Billing_Start_Date__c = opp.Billing_Start_Date__c;
                    newopp.Parent_Opportunity__c = opp.Id;
                    oppsToUpdate.add(newopp);
                    OldOppId.put(opp.id,opp);
                }
                
                insert oppsToUpdate;
                
                Map<Id,Opportunity> NewOppId = new Map<Id,Opportunity>();
                for(Opportunity opp1 : oppsToUpdate)
                {
                    NewOppId.put(opp1.Id, opp1);
                }
                
                List<OpportunityLineItem> oppitemList = new List<OpportunityLineItem>([SELECT Id, Product2Id, Quantity, UnitPrice, OpportunityId FROM OpportunityLineItem Where OpportunityId IN : OldOppId.keyset()]);
                for(OpportunityLineItem oppitem : oppitemList)
                {
                    OpportunityLineItem oli = new OpportunityLineitem();
                    oli.OpportunityId = NewOppId.get(oppitem.OpportunityId).Id;
                    oli.Product2Id = oppitem.Product2Id;
                    oli.Quantity = oppitem.Quantity;
                    oli.UnitPrice = oppitem.UnitPrice;
                    oppitemlist.add(oli);
                }
                insert oppitemList;
            }
        }   
    }
}
Best Answer chosen by SFDCHeman
Maharajan CMaharajan C
Hi,

Even after you have tried above code and still facing the same error then use below things.

Maximum Trigger Depth Exceeded Error in Salesforce occurs due to recursion in your CloneParentOpportunityTrigger trigger. This recurssion due some opportunity Line Item Trigger or triggers or automation firing your CloneParentOpportunityTrigger trigger again. So it's going unstoppable

Use the below  way to avoid this error:

Add static Boolean in trigger context to handle this recurrsion error - Commonly used trick.

Create New Apex Class:

 
public class RecursiveTriggerHandler{
    public static Boolean isFirstTime = true;
}

And Update your trigger like below with static boolean check :
 
trigger CloneParentOpportunityTrigger on Opportunity (After insert,After update) 
{
    List<Opportunity> oppsToUpdate = new List<Opportunity>();
    Map<Id,Opportunity> OldOppId = new Map<Id,Opportunity>();
    Map<Id,List<OpportunityLineItem>> oplitemsMap = new  Map<Id,List<OpportunityLineItem>>();
    List<OpportunityLineItem> oppitemlist = new List<OpportunityLineItem>();
    Set<id> oppIds = new set<Id>();
    if(RecursiveTriggerHandler.isFirstTime)
    {
        RecursiveTriggerHandler.isFirstTime = false;
        if(Trigger.IsAfter)
        {
            if(Trigger.IsInsert)
            {
                for(Opportunity opp : Trigger.new)
                { 
                    if(opp.Clone_Opportunity__c){
                        oppIds.add(opp.Id);
                        Opportunity newopp = new Opportunity(); 
                        newopp.Name = opp.Name;
                        newopp.AccountId = opp.AccountId;
                        //newopp.Product_Type__c = opp.Product_Type__c;
                        newopp.CloseDate = opp.CloseDate;
                        newopp.StageName = opp.StageName;
                        //newopp.Payment_Frequency__c = opp.Payment_Frequency__c;
                        //newopp.Most_Recent_Invoice_Date__c  = opp.Most_Recent_Invoice_Date__c;
                        //newopp.Billing_Start_Date__c = opp.Billing_Start_Date__c;
                        newopp.Parent_Opportunity__c = opp.Id;
                        oppsToUpdate.add(newopp);
                    }
                }
            }
            else if(Trigger.IsUpdate){
                for(Opportunity opp : Trigger.new)
                { 
                    if(Trigger.oldMap.get(opp.Id).Clone_Opportunity__c != opp.Clone_Opportunity__c && opp.Clone_Opportunity__c){
                        oppIds.add(opp.Id);
                        Opportunity newopp = new Opportunity(); 
                        newopp.Name = opp.Name;
                        newopp.AccountId = opp.AccountId;
                        //newopp.Product_Type__c = opp.Product_Type__c;
                        newopp.CloseDate = opp.CloseDate;
                        newopp.StageName = opp.StageName;
                        //newopp.Payment_Frequency__c = opp.Payment_Frequency__c;
                        //newopp.Most_Recent_Invoice_Date__c  = opp.Most_Recent_Invoice_Date__c;
                        //newopp.Billing_Start_Date__c = opp.Billing_Start_Date__c;
                        newopp.Parent_Opportunity__c = opp.Id;
                        oppsToUpdate.add(newopp);
                    }
                }       
            }
        }
        
        for(OpportunityLineitem opl : [SELECT Id, Product2Id, Quantity, UnitPrice,pricebookentryid, OpportunityId FROM OpportunityLineItem Where OpportunityId IN : oppIds]){
            if(!oplitemsMap.containsKey(opl.OpportunityId)){
                oplitemsMap.put(opl.OpportunityId, new List<OpportunityLineitem>{opl});
            }
            else{
                oplitemsMap.get(opl.OpportunityId).add(opl);
            }
        }
        
        if(!oppsToUpdate.IsEmpty()){
            insert oppsToUpdate;
            
            for(Opportunity op : oppsToUpdate){
                system.debug(' Id --> ' + op.Id);
                system.debug(' Parent Id --> ' + op.Parent_Opportunity__c);
                if(oplitemsMap.containsKey(op.Parent_Opportunity__c)){
                    for(OpportunityLineitem ol : oplitemsMap.get(op.Parent_Opportunity__c)){
                        OpportunityLineItem oli = new OpportunityLineitem();
                        oli.OpportunityId = op.Id;
                        oli.Product2Id = ol.Product2Id;
                        oli.Quantity = ol.Quantity;
                        oli.UnitPrice = ol.UnitPrice;
                        oli.pricebookentryid=ol.pricebookentryid;
                        oppitemlist.add(oli);
                    }
                }
            }
            
            if(!oppitemlist.isEmpty()){
                insert oppitemlist;
            }
        }
    }
}


Thanks,
Maharajan.C
SinanBunniSinanBunni 
Hello,

I am trying to solve the challange of the HTTP and Basic Callout module of Salesforce trailhead and I am having some queries in which you could point to the right direction:

1- The challange asked us to call this URL https://th-apex-http-callout.herokuapp.com/animals/:id in method getAnimalNameById... should that URL be in this form instead of the above https://th-apex-http-callout.herokuapp.com/animals?id ? Where id is a parameter in the URL.

2- When I tried to check the solution of the challange, Salesforce generated that error for me
"Challenge Not yet complete... here's what's wrong: 
Executing the 'getAnimalNameById' method on 'AnimalLocator' failed. Make sure the method exists with the name 'getAnimalNameById', is public and static, accepts an Integer and returns a String."
despite that my class implementation has this method declared as public static String as below in the code snippet:
 
public class AnimalLocator {
	
	public static String getAnimalNameById(Integer id) {
		
		Http http = new Http();
		HttpRequest request = new HttpRequest();
		request.setEndpoint('https://th-apex-http-callout.herokuapp.com/animals?id');
		request.setMethod('GET');
		
		HttpResponse response = http.send(request);
		List<Object> animals = NULL;
		String returnValue = NULL;
		
		// if the request was successful, then parse the JSON response
		if (response.getStatusCode() == 200) {
			Map<String, Object> result = (Map<String, Object>) JSON.deserializeUntyped(response.getBody());
			animals = (List<Object>) result.get('animals');
			System.debug(animals);
		}
		
		if (animals.size() > 0 && animals != NULL && id < animals.size()) {
			returnValue = (String) animals.get(id);
		}
		
		return returnValue;
	} // end getAnimalNameById method
    
} // end AnimalLocator class

I would appreciate your help in this post.

Thank you,

Sinan
Best Answer chosen by SinanBunni
pconpcon
No, you should be replacing the Id at the end of the url with the id passed into the method

Try
 
request.setEndpoint('https://th-apex-http-callout.herokuapp.com/animals/' + id);

instead
Stephanie Wong 51Stephanie Wong 51 
Hi everyone,

I recently hid a custom button from Lightning and enabled it back again in the page layouts. But it does not show in Lightning, but works fine in Classic. What should I do it make it visible again?
User-added image
Best Answer chosen by Stephanie Wong 51
Stephanie Wong 51Stephanie Wong 51
Hi Abhishek,

Thanks for looking into this for me. I checked all the links you sent and that really did not solve the problem. I did find the solution though. It slipped my mind that for Lightning you would add it in the "Salesforce Mobile and Lightning Experience Actions" and for Classic it is in "Custom Buttons".


User-added image
Chris EdwardsChris Edwards 
Hello developer heroes!

I'm working through the Apex modules on Trailhead and can't seem to get past this one: https://developer.salesforce.com/en/trailhead/force_com_programmatic_beginner/apex_triggers/apex_triggers_bulk.

Hopefully this doesn't read like a 'please complete the course for me' kinda post, but I have written a trigger that I believe meets the criteria but it isn't passing the check, so I wanted to seek the guidance of the experts.

The challenge is to do this:

Create an Apex trigger for Opportunity that adds a task to any opportunity set to 'Closed Won'.

To complete this challenge, you need to add a trigger for Opportunity. The trigger will add a task to any opportunity inserted or updated with the stage of 'Closed Won'. The task's subject must be 'Follow Up Test Task'.The Apex trigger must be called 'ClosedOpportunityTrigger'

- With 'ClosedOpportunityTrigger' active, if an opportunity is inserted or updated with a stage of 'Closed Won', it will have a task created with the subject 'Follow Up Test Task'.
- To associate the task with the opportunity, fill the 'WhatId' field with the opportunity ID.
- This challenge specifically tests 200 records in one operation.


And here is the trigger I have come up with, which compiles OK and stands up to a manual (though admittedly unbulkified) test:
trigger ClosedOpportunityTrigger on Opportunity (after insert, after update) {

    List<Task> taskList = new List<Task>();
    
    for (Opportunity opp : [SELECT Id, StageName FROM Opportunity WHERE StageName = 'Closed Won' AND Id IN :Trigger.new]){
                    
            taskList.add(new Task(Subject = 'Follow Up Test Task',
                                  WhatId = opp.Id));
       
    }

    if(taskList.size()>0){
        
        insert taskList;
        
    }
    
}
I have tried replacing the SOQL with a straightforward 'for (Opportunity opp : Trigger.new)' and having the taskList.add inside an IF that checks for Closed Won - no luck. I also thought about checking to see if the stage was being changed to Closed Won, rather than the trigger firing on every edit, but I don't think this is what the module is asking for.

Where do you think I'm going wrong?

Huge thanks in advance!
Best Answer chosen by Chris Edwards
Adam Purkiss 99Adam Purkiss 99
Hi Chris,

It's possible for something else in your DE org to cause an assessment to fail. For example, if you had a workflow, validation rule or another trigger that threw an error during the course of testing, the Trailhead assessment would be unable to finish its execution. We're making a change to Trailhead to provide more detailed information about unexpected errors to help resolve these issues, which should be released soon. But in general, it's best to use a fresh DE org to avoid such conflicts.

Thanks!
Rahul MahaleRahul Mahale 
I need to print in O/P of  Stored values in Keys & Associated values line by line of Map function.

o/p required :

the current key =98
the current value for above key = Robert

What enhancement should i do to achieve o/p?

Code :

//Declare Map Variable & Show key Values, Values & Check if it is empty or not.

Map<integer, String> VarMapOfEmployeeMobileNum= New Map <integer, String>();

//add some items
VarMapOfEmployeeMobileNum.put(98,'Robert');
VarMapOfEmployeeMobileNum.put(64,'Matthew');
VarMapOfEmployeeMobileNum.put(55,'Harry');

//to see the map
System.debug('The current map ='+VarMapOfEmployeeMobileNum);


//Collect all Keys and Show 1 By 1
set<Integer> VarTempSet = new set<Integer>();
VarTempSet = VarMapOfEmployeeMobileNum.keyset();
for (integer VarMobileSetPrint: VarTempSet)
{
    system.debug('The Current Key ='+VarMobileSetPrint);
}

//Collect all Values and Show 1 By 1
List<String> VarTempList = new List<String>();
VarTempList = VarMapOfEmployeeMobileNum.Values();
for (string VarMobileListPrint: VarTempList)
{
    system.debug('The Current Value for above Key ='+VarMobileListPrint);
}
 
Best Answer chosen by Rahul Mahale
veer soniveer soni
Hi Rahul,
try following code.
Map<integer, String> VarMapOfEmployeeMobileNum= New Map <integer, String>();

//add some items
VarMapOfEmployeeMobileNum.put(98,'Robert');
VarMapOfEmployeeMobileNum.put(64,'Matthew');
VarMapOfEmployeeMobileNum.put(55,'Harry');

//to see the map
System.debug('The current map ='+VarMapOfEmployeeMobileNum);
for (integer key: VarMapOfEmployeeMobileNum.keyset()){
    system.debug('The Current Key ='+key);
    
         system.debug('The Current value ='+ VarMapOfEmployeeMobileNum.get(key));
    }

get value based key.
I hope above info will help you and if it help, let me know to mark it as best answer.
Thank you
Alimali Stephen 15Alimali Stephen 15 
Hello Team!
I want to add IF condition where if a certain picklist value is selected then a certain image is picked  through static resource image link.
The image picked should show in the vf email template as per the condition set.
 
<messaging:emailTemplate subject="Delivery Status for Invoice Number: {!relatedto.Number__c}" recipientType="Contact" relatedToType="Invoice__c">
<messaging:htmlEmailBody >
<apex:outputPanel >
<img src="my static resource image url" alt="" style="display: block; padding: 0px; text-align: center; height: 100%; width: 100%; border: 0px none transparent;" width="636">
</img>
</apex:outputpanel>
</messaging:htmlEmailBody>
</messaging:emailTemplate>

The shared code is what I have so far on having the image to display but I am stuck in adding the IF condition to display different images as per a selected picklist value.

I'd appreciate any assistance on this.
Best Answer chosen by Alimali Stephen 15
Maharajan CMaharajan C
Hi Stephen,

Please try any one of the below way:

1. Use the rendered="{!ISPICKVAL(relatedTo.PickList_field__c ,'Your Picklist Value')}"
<messaging:emailTemplate subject="Delivery Status for Invoice Number: {!relatedto.Number__c}" recipientType="Contact" relatedToType="Invoice__c">
<messaging:htmlEmailBody >
<apex:outputPanel rendered="{!ISPICKVAL(relatedTo.PickList_field__c ,'Your Picklist Value')}">
<img src="my static resource image url" alt="" style="display: block; padding: 0px; text-align: center; height: 100%; width: 100%; border: 0px none transparent;" width="636">
</img>
</apex:outputpanel>
</messaging:htmlEmailBody>
</messaging:emailTemplate>

2. Use the rendered="{!If(relatedTo.PickList_field__c == 'Your Picklist Value',true,false)}"
<messaging:emailTemplate subject="Delivery Status for Invoice Number: {!relatedto.Number__c}" recipientType="Contact" relatedToType="Invoice__c">
<messaging:htmlEmailBody >
<apex:outputPanel rendered="{!If(relatedTo.PickList_field__c == 'Your Picklist Value',true,false)}">
<img src="my static resource image url" alt="" style="display: block; padding: 0px; text-align: center; height: 100%; width: 100%; border: 0px none transparent;" width="636">
</img>
</apex:outputpanel>
</messaging:htmlEmailBody>
</messaging:emailTemplate>

https://salesforce.stackexchange.com/questions/244376/visualforce-conditionally-render-2-different-fields-based-on-2-conditions

https://salesforce.stackexchange.com/questions/216995/conditional-rendering-using-if-in-visualforce-template


Thanks,
Maharajan.C
shrayas reddyshrayas reddy 
public class integpost {
      @AuraEnabled
    public static List<string> output(String serviceId, String depositTicker, string withdrawalTicker, integer depositValue ){
        Http http = new Http();
        HttpRequest request = new HttpRequest();
        request.setEndpoint('https://api.bestrate.org/api/select-service');
        request.setMethod('POST');
        request.setHeader('Content-Type', 'application/json;charset=UTF-8');
        string body = '{"serviceId":"'+serviceId+'","depositTicker" :"' +depositTicker+'" ,"withdrawalTicker":"'+ withdrawalTicker +'","partnerId":null,"depositValue":"'+depositValue+'" }';
             request.setBody(body);
                         
        HttpResponse response = http.send(request);
         string values = response.getBody();
       
        Map<String, Object> m = (Map<String, Object>)JSON.deserializeUntyped(values);
    
        Map<String, Object> dim = (Map<String, Object>)m.get('result');
        system.debug(dim.get('withdrawalValue'));
       
       List<Object> a = (List<Object>)dim.get('fields');
  
     
        List<string> lsstr= new List<string> ();
       // List<string> lsst= new List<string> ();
        for(Object b:a){
         lsstr.add(String.valueOf(b));
       }
        system.debug(lsstr);
     
  
        return lsstr;

          }
}

output that is returning from method : 
({description=The recipient’s wallet address is the address we send coins bought, once a transaction is finished., name=withdrawalWallet, placeholder=Wallet address, required=true, title=Enter your ETH wallet address}, {defaultValue=user.email, description=Enter your email to start exchange, name=email, placeholder=Email, required=true, title=Enter your email address})no output in aura table


Component:
<aura:component controller="integpost" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    <aura:attribute name="serviceId" type="String" />
    <aura:attribute name="depositTicker" type="String" />
  <aura:attribute name="withdrawalTicker" type="String" />
      <!-- <aura:attribute name="partnerId" type="String" />-->
  <aura:attribute name="depositValue" type="integer" />
    <aura:attribute name="ApiDetail" type="String[]"/>
        <aura:attribute name="Detail" type="List" />
    <lightning:card>
        <lightning:input label="Enter service Id" value="{!v.serviceId}"/><br/>
         <lightning:input label="Enter Deposit ticket" value="{!v.depositTicker}"/><br/>
         <lightning:input label="Enter Withdrawl Ticket" value="{!v.withdrawalTicker}"/><br/>
         <!--<lightning:input label="Enter partnerId" value="{!v.partnerId}"/><br/>-->
         <lightning:input label="Enter deposit Value" value="{!v.depositValue}"/><br/>
         <lightning:button label="getExchange" onclick="{!c.handleApex}" variant="success"/>
     
        <lightning:datatable data="{!v.ApiDetail}"
                         columns="{!v.Detail}"
                         keyField="name"
                         hideCheckboxColumn="false"/>
         

      
        </lightning:card>
</aura:component>

js:

({
    handleApex : function(component, event, helper) {
        var action = component.get('c.output');
        var ion = component.get('v.serviceId');
          var dt = component.get('v.depositTicker');
         var wt = component.get('v.withdrawalTicker');
        // var pid = component.get('v.partnerId');
         var dv = component.get('v.depositValue');
        // var Ad = component.get('v.ApiDetail');
        action.setParams({'serviceId': ion, 'depositTicker':dt, 'withdrawalTicker': wt,
                           'depositValue':dv});
        
         component.set('v.Detail', [
            {label: 'title', fieldName:'title', type: 'text',editable: true},
                {label: 'name', fieldName: 'name', type: 'text'},
                {label: 'placeholder', fieldName: 'placeholder', type: 'text'},
                {label: 'description', fieldName: 'description', type: 'text',editable: true},
                {label: 'required', fieldName: 'required', type: 'boolean',editable: true}
            ]);
        
        action.setCallback(this, function(response){
            var state = response.getState();

            if(state == 'SUCCESS'){
                console.log('apex call is done!', response.getReturnValue()); 
                component.set('v.ApiDetail', response.getReturnValue());
            }
            
        });
        
        $A.enqueueAction(action);
    }
})
Best Answer chosen by shrayas reddy
Maharajan CMaharajan C
Hi Shrayas,

Lightning Datatable need the List<object> in data property  ... But you are returning the List<String> from Apex class.

Just change your apex class like below :
 
public class integpost {
    @AuraEnabled
    public static List<object> output(String serviceId, String depositTicker, string withdrawalTicker, integer depositValue ){
        Http http = new Http();
        HttpRequest request = new HttpRequest();
        request.setEndpoint('https://api.bestrate.org/api/select-service');
        request.setMethod('POST');
        request.setHeader('Content-Type', 'application/json;charset=UTF-8');
        string body = '{"serviceId":"'+serviceId+'","depositTicker" :"' +depositTicker+'" ,"withdrawalTicker":"'+ withdrawalTicker +'","partnerId":null,"depositValue":"'+depositValue+'" }';
        request.setBody(body);
        
        HttpResponse response = http.send(request);
        string values = response.getBody();
        
        system.debug(' JSON ===> ' + values );
        
        Map<String, Object> m = (Map<String, Object>)JSON.deserializeUntyped(values);
        
        Map<String, Object> dim = (Map<String, Object>)m.get('result');
        system.debug(dim.get('withdrawalValue'));
        
        List<Object> a = (List<Object>)dim.get('fields');
        
        List<Object> obj = new List<Object>();
        
        for(Object b:a){
            obj.add(b);
        }
        system.debug(' obj ====> ' + obj);
        
        return obj;
        
    }
}

Thanks,
Maharajan.C
Eager-2-LearnEager-2-Learn 

Hi,

 

Is there a way to use REGEX to check a field to make sure it follows a specifi format with a delimiter?

 

The field will have alfa-numeric values but they must be 4 digits long with a comma seperation and no spaces.  There is no specific on how many groups of these alfa-numerics are allowed.  

 

These would be valid:

1xi4,GX19,Nn92

ZZZ1,8939,YXKE,791W

 

These would not be valid:

1x49d,GX1,Nn92

,1xi4,GX19,Nn92

1xi4,GX19,Nn92,

1xi4,GX19, Nn92


Best Answer chosen by Admin (Salesforce Developers) 
Eager-2-LearnEager-2-Learn

I had the comma in the wrong spot!

 

It should be inside the lef pareth:

 

 NOT(REGEX(Facets_Grp_s__c, "[a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9](,[a-​zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9]){0,10}")​)

 

If anyone has a shorter version I would life to have it.  I tried the \W but Salesforce didn't like it!

Simon_FranceSimon_France 
Hi everyone,

I think that I found a bug in the screen flow component "reference" when referencing a filtered lookup. Salesforce support told me to ask here about it.

Here the official documentation : https://help.salesforce.com/articleView?id=flow_ref_elements_screencmp_lookup.htm&type=5

How to reproduce :
1 - create a new lookup field from contact to account "account2" without filtering
2 - create a simple screen flow with only a reference component using this new lookup
flow setup3 - test it : you find all your account
User-added image4 - add a filter on the lookup to display only the account of the contact
User-added image5 - nothing in the flow now :
User-added imageI have the same results if the filter is optional.

Did i missunderstand something ? Or is this a bug ?
Best Answer chosen by Simon_France
Simon_FranceSimon_France
Hi Fabio,

No sorry. I don't know if it was already in the documentation (https://help.salesforce.com/s/articleView?id=sf.flow_ref_elements_screencmp_lookup.htm&type=5) but now dependent lookup filter are clearly not supported.

I think you can try using a record choice option:
https://sfdcquestion.blogspot.com/p/create-lookup-filter-in-lightning.html

Or you can use the custom component from Unofficial SF: 
https://unofficialsf.com/lookup/

Best regards,
Simon