• Dinesh Gopalakrishnan
  • NEWBIE
  • 165 Points
  • Member since 2018
  • Salesforce Developer
  • Infosys Limited

  • Chatter
    Feed
  • 5
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 33
    Replies

I have a screen flow (Send Stock Sample Request Email) that is set to fire when a button (Send Sample Request Email) is pressed in the Sample Request record. When the button is pressed, the flow is trigger to collect information from the Sample Request record and send an email to a designated list of people. For one of our users this flow is being triggered a second time when he has not entered the specified record or pressed the Send Sample Request Email button. 

I had a trace flag running on his user for 24 hours to catch the duplicate trigger. The first email was requested by the user to be sent out 01/28 11:49:32. There is a log file for this in our system.

The second email that was NOT requested to be sent went out at 01/28 15:20:58. There is a log file in our system for this as well.

image of sample request flow in SFDCimage of sample request button on custom record typeimage of action detail in backend of custom record type

Create an Apex class that returns contacts based on incoming parameters.
For this challenge, you will need to create a class that has a method accepting two strings. The method searches for contacts that have a last name matching the first string and a mailing postal code matching the second. It gets the ID and Name of those contacts and returns them.

The Apex class must be called ContactSearch and be in the public scope
The Apex class must have a public static method called searchForContacts
The method must accept two incoming strings as parameters
The method should then find any contact that has a last name matching the first string, and mailing postal code (API name: MailingPostalCode) matching the second string
The method should finally return a list of Contact records of type List that includes the ID and Name fields



below is my code 

public class ContactSearch {
    
    public static List<String> searchForContacts(String x, String y){
        x1=x;
        y1=y;
        List<String> con = new List<String>();
        for (Contact[] tmp : [SELECT Id,Name FROM Contact where Name := x1 AND MailingPostalCode :=y1]) {
            con.add(tmp);
        }
        return con;
       
    }

}
Hi,

I am using this very basic code for a VF page. All i want to do is change the colour of the pageblocksection colapsable bars. Can you help?

i have read all sorts of strange ways of doing it, but hoped there was something more straght forward.
 
<apex:pageBlockSection  title="{!Group_Relationship__c.Group_Name_AP__c} Action Plan" columns="4">  
                      
            <div style="float:left; width: 100%;" >
            <apex:pageBlockSection title="Details" columns="4">
                <apex:inputField value="{!Group_Relationship__c.Group_Name__c}" required="false"/>
                
                
                
                </apex:pageBlockSection> 
                     
            </div>

 
I want to disable personalize nav bar options for users.
HI I an getting this error : Failed to save AccountSearch.cmp: No EVENT named markup://c:AccountsLoaded found : [markup://c:AccountSearch]: Source when trying to save this code below:
<aura:component controller="AccountSearchController">
    <aura:registerEvent name="accountsLoaded" type="c:AccountsLoaded"/>
    <aura:handler name="init" value="{!this}" action="{!c.onInit}"/>
    <aura:attribute name="searchTerm" type="String" default="San Francisco"/>
    <lightning:card title="Account Search" iconName="standard:search">
        <div class="slds-form slds-p-around_x-small">
            <lightning:input
                label="Search"
                variant="label-hidden"
                value="{!v.searchTerm}"
                placeholder="Search by name, phone, website, or address"
                onchange="{!c.onSearchTermChange}"/>
        </div>
    </lightning:card>
</aura:component>

I have a screen flow (Send Stock Sample Request Email) that is set to fire when a button (Send Sample Request Email) is pressed in the Sample Request record. When the button is pressed, the flow is trigger to collect information from the Sample Request record and send an email to a designated list of people. For one of our users this flow is being triggered a second time when he has not entered the specified record or pressed the Send Sample Request Email button. 

I had a trace flag running on his user for 24 hours to catch the duplicate trigger. The first email was requested by the user to be sent out 01/28 11:49:32. There is a log file for this in our system.

The second email that was NOT requested to be sent went out at 01/28 15:20:58. There is a log file in our system for this as well.

image of sample request flow in SFDCimage of sample request button on custom record typeimage of action detail in backend of custom record type

can someone help me understand why this doesnt work for multiple values? 

<p>{!if(CONTAINS(relatedTo.Account.ShippingPostalCode,"17837:12221"),"EST","not found")}
</p>

If I compare for just one value i get expected result. 
EX:
<p>{!if(CONTAINS(relatedTo.Account.ShippingPostalCode,"17837"),"EST","not found")}
</p>

Working on a visualforce email template and need a way to compare a significant amount of zipcodes and return time zone.

Thanks
Hi all, 

Help me to write a test class
 
public with sharing class AccountwithActivecontactsController {

     public List<AccountInfoWrapper> AccountsWrapper {get; set;}    
    
    public List<List<AccountInfoWrapper>> listofAccountsWrapper {get; set;}
    
 /*   public AccountwithActivecontactsController()
    {
  AccountsWrapper = new List<AccountInfoWrapper>();
  listofAccountsWrapper = new List<List<AccountInfoWrapper>>();
        getAccounts();
    }  */
     
    public List<AccountInfoWrapper> getAccounts()   
    {
        AccountsWrapper = new List<AccountInfoWrapper>();
        try{
        string str = 'SELECT id,Name,Ownerid, Account.Owner.Profile.Name,Type,Total_No_Of_Contacts__c,No_Of_Opportunties__c,(SELECT id, Name, Email, Phone,  createdDate from contacts where Active__c = true order by createdDate desc LIMIT 1) FROM Account';
        for(Account a:database.query(str))
        {
            if(a.contacts.size() > 0)  {   
            AccountsWrapper.add(new AccountInfoWrapper(a, a.contacts)); 
           // AccountsWrapper.add(new AccountInfoWrapper(s.contacts));
         }   
        }   
        system.debug('***********accounts**'+AccountsWrapper);
    } 
    
        catch( QueryException e ) {
                // HANDLES EXCEPTIONS RELATED TO SOQL or SOSL STATEMENTS.
                System.debug( 'QueryException:-\n' + e.getMessage() + '\nLine Number:-\n' + e.getLineNumber() );
            }
                    return AccountsWrapper; 

            }
    
    public class AccountInfoWrapper
    {
        public Account sObj{get;set;}
        public contact con {get;set;}
        public AccountInfoWrapper(Account acc, contact con)
        {
            sObj = acc; 
            this.con = con; 
        }  
        
    }

Kindly Support and Suggest

Thanks
 
  • April 16, 2019
  • Like
  • 0
I'm trying to change the default live agent icon with the custom image in my salesforce site. But its not getting updated. Here is the current Icon:
User-added image

I'm not able to find the correct place where I need to change the icon. I tried to update embedded_svc.settings.defaultMinimizedTex but it update the highlighted part in image. It's even not taking the image of chat button. Not sure from where to replace the icon.
 
<img id="liveagent_button_online_5730O000000byoz" style="display: none; border: 0px none; cursor: pointer" onclick="liveagent.startChat('5730O000000byoz')" src="https://saasdeveloper-developer-edition.ap7.force.com/liveAgent/resource/1555073074000/chat" /><div id="liveagent_button_offline_5730O000000byoz" style="display: none;"><!-- Offline Chat Content --></div><script type="text/javascript">
if (!window._laq) { window._laq = []; }
window._laq.push(function(){liveagent.showWhenOnline('5730O000000byoz', document.getElementById('liveagent_button_online_5730O000000byoz'));
liveagent.showWhenOffline('5730O000000byoz', document.getElementById('liveagent_button_offline_5730O000000byoz'));
});</script>

 
My sharing rule to allow a Recruitment Manager to Edit Record's created by his subordinate which is a recruiter is not working. 

 
User-added imageAny Ides how to customize Success Message when a Knowledge Article is attached to a Case. In Lightning .
As shown in screenshot attached , this error message looks incomplete.
Hello everyone,

I want to create a Web-2-lead form which supports attachments. I can simply generate the code using the built in functionality that salesforce offers. However, in order to support attachments I need to write some code (Apex/ Visualforce). Can someone provide an example or simply explain how to go from the automatically generated web-2-lead HTML code to a visualforce page which uses an apex controller to save the attachments.

I am in need of an explaantion to better understand how this theoretically works.

Thank you! 
Hi All,

I need a test coverage of 75% plus for the below trigger, Please help.

trigger example on Lead (before insert, before update) 
{
   system.debug('In Assign Contractor 2.1');
   static string pcode;

   
  

    Map<Id, String> mLedvsZip   = new Map<Id, String>();
    Map<String, List<Id>> mZipvsLeads = new Map<String, List<Id>>(); 
    
    system.debug(Trigger.new);
    
    for(Lead led: Trigger.new){
    
        system.debug('Trigger New loop:');
        
        if(led.PostalCode <> null && led.PostalCode.length() >= 5) {
          pcode = led.PostalCode.substring(0,5);
        }
        
        
        if(led.CTrigger__c && led.WG_Status__c == 'Gas Available'){
            system.debug('In led.ctrigger loop');
            system.debug('In led.PostalCode: ' + led.PostalCode );
            system.debug('In led.Contractor: ' + led.Contractor__c);
            
            if( led.Contractor__c == null && String.isNotBlank(led.PostalCode)){
            
                
                
                system.debug('initial zip: ' + led.PostalCode);
                system.debug('truncated zip: ' + pcode);
                 
                if(led.PostalCode.length() >= 5) {
                system.debug('mLedvsZip Put: ' + pcode);
                mLedvsZip.put(led.Id, pcode);
                }
                else
                {
                system.debug('>>>>>> invalid zip found: ' + led.PostalCode);
                }
                
                if(!mZipvsLeads.isEmpty() && mZipvsLeads.containsKey(pcode)){
                    List<Id> tempIds = mZipvsLeads.get(pcode);
                    tempIds.add(led.Id);
                    mZipvsLeads.put(pcode, tempIds);
                }
                else if(!mZipvsLeads.isEmpty() && !mZipvsLeads.containsKey(pcode))
                    mZipvsLeads.put(pcode, new List<Id>{led.Id});
                else if(mZipvsLeads.isEmpty())
                    mZipvsLeads.put(pcode, new List<Id>{led.Id});
            }
        }
    }//End For
    
    if(!mZipvsLeads.isEmpty()){
        List<Zip_Code__c> lstZC = [SELECT Zip_Code__c,  
                                          Name, Account__c, 
                                          Account__r.Last_Lead_Assign_Date__c 
                                   FROM Zip_Code__c 
                                   WHERE Zip_Code__c IN: mZipvsLeads.keySet() AND 
                                         Account__r.Accept_Leads__c = true  
                                   ORDER BY Account__r.Last_Gas_Available_Lead_Assigned__c ASC NULLS FIRST];                                                           
        system.debug('List from SQL: ' + lstZC);
        if(!lstZC.isEmpty()){
            Map<String, List<Id>> mZCvAccs = new Map<String, List<Id>>();//Zip vs associatd Accounts
            for(Zip_Code__c zc: lstZC){
                if(!mZCvAccs.isEmpty() && mZCvAccs.containsKey(zc.Zip_Code__c)){
                    List<Id> tempIds = mZCvAccs.get(zc.Zip_Code__c);
                    tempIds.add(zc.Account__c);
                    mZCvAccs.put(zc.Zip_Code__c, tempIds);
                }
                else if(!mZCvAccs.isEmpty() && !mZCvAccs.containsKey(zc.Zip_Code__c))
                    mZCvAccs.put(zc.Zip_Code__c, new List<Id>{zc.Account__c});
                else if(mZCvAccs.isEmpty())
                    mZCvAccs.put(zc.Zip_Code__c, new List<Id>{zc.Account__c});
            }
            
            if(!mZipvsLeads.isEmpty() && !mZCvAccs.isEmpty()){
                Map<Id, DateTime> mAcctoUpdate = new Map<Id, DateTime>();//Account to Update for Datetime of Assignement
                for(String zip: mZipvsLeads.keySet()){
                    List<Id> lstLeads    = mZipvsLeads.get(zip); 
                    List<Id> lstAccounts = mZCvAccs.get(zip); 
                    
                    if(lstLeads.size()==1){
                        if(!lstAccounts.isEmpty() && lstAccounts.size() == 1){
                            if(Trigger.isInsert)
                                trigger.new[0].Contractor__c = lstAccounts[0];
                            else if(Trigger.isUpdate)
                                trigger.newMap.get(lstLeads[0]).Contractor__c = lstAccounts[0];                        
                            mAcctoUpdate.put(lstAccounts[0], DateTime.now());
                        }
                        else if(!lstAccounts.isEmpty() && lstAccounts.size() > 1){
                            if(Trigger.isInsert)
                                trigger.new[0].Contractor__c = lstAccounts[0];
                            else if(Trigger.isUpdate)
                                trigger.newMap.get(lstLeads[0]).Contractor__c = lstAccounts[0];
                            mAcctoUpdate.put(lstAccounts[0], DateTime.now());
                        }
                    }
                    else if(lstLeads.size()>1){
                        if(!lstAccounts.isEmpty() && lstAccounts.size() == 1){
                            for(Integer i=0; i<lstLeads.size(); i++){
                                if(Trigger.isInsert)
                                    trigger.new[i].Contractor__c = lstAccounts[0];
                                else if(Trigger.isUpdate)
                                    trigger.newMap.get(lstLeads[i]).Contractor__c = lstAccounts[0];
                                mAcctoUpdate.put(lstAccounts[0], DateTime.now());
                            }
                        }
                        else if(!lstAccounts.isEmpty() && lstAccounts.size() > 1){
                            if(lstLeads.size() <= lstAccounts.size()){
                                for(Integer i=0; i<lstLeads.size(); i++){
                                    if(Trigger.isInsert)
                                        trigger.new[i].Contractor__c = lstAccounts[0];
                                    else if(Trigger.isUpdate)
                                        trigger.newMap.get(lstLeads[i]).Contractor__c = lstAccounts[0];
                                    mAcctoUpdate.put(lstAccounts[i], DateTime.now());
                                }
                            }
                            else if(lstLeads.size() > lstAccounts.size()){
                                List<List<Id>> lstlstId = Util.CreatePackets(lstAccounts.size(), lstLeads);
                                for(Integer i=0; i<lstlstId.size(); i++){
                                    for(Integer j=0; j<lstlstId[i].size(); j++){
                                        trigger.newMap.get(lstlstId[i][j]).Contractor__c = lstAccounts[j];
                                        mAcctoUpdate.put(lstAccounts[i], DateTime.now());                                       
                                    }
                                }
                            }
                        }
                    }
                }
                if(!mAcctoUpdate.isEmpty()){
                    List<Account> lstAccUp = new List<Account>();
                    for(Id accId: mAcctoUpdate.keySet())
                        lstAccUp.add(new Account(id= accId, 
                                                 Last_Gas_Available_Lead_Assigned__c = mAcctoUpdate.get(accId)));
                    if(!lstAccUp.isEmpty())
                        update lstAccUp;
                }
            }
        }
    }
    
 //   Update Contractor Email
 
 Set<id> acctIds = new Set<id>();
 system.debug('Trigger NEW: '+ Trigger.new);

 for(Lead led: trigger.new){
     // Lead oldLead = Trigger.oldMap.get(led.ID);
     acctIds.add(led.Contractor__c);
     }
  system.debug('Acctids: '+ acctids);  
    
 // create a map so that Account is locatable by its Id (key)  
  
    Map<id, account> acctsMap = new Map<id, account>(
[SELECT Id, Partner_Email__c,Partner_Secondary_Email__c  FROM Account WHERE id IN :acctIds]);

system.debug('AcctsMap: ' + acctsMap);
  
 for (Lead led : Trigger.new) { 
 
           if(led.CTrigger__c && !led.Contractor_Contact__c){
           // led.CTrigger__c = False;
           }
 
           if (led.Contractor__c != null){
             led.Contractor_Email__c = acctsMap.get(led.Contractor__c).Partner_Email__c;
             led.Contractor_Secondary_Email__c = acctsMap.get(led.Contractor__c).Partner_Secondary_Email__c;
             led.Contractor_Assignment_Status__c = 'Assigned';
            }
           else
           {
             led.Contractor_Email__c = '';
             led.Contractor_Secondary_Email__c = '';
             if(led.CTrigger__c) {
                led.Contractor_Assignment_Status__c = 'No Contractor Found';}
             else
                {
                led.Contractor_Assignment_Status__c = '';
                }
           }
    }
    
     
}
User-added image
<apex:page standardController="User" >
<apex:form >

 <div align="center">
<apex:image url="https://c.ap4.visual.force.com/resource/1548067870000/LoginImage" styleClass="imageStyle" height="100" width="100"/>
</div>

<apex:pageBlock title="User Information"> 

<apex:pageBlockSection columns="3">

<div align="left" draggable="false" >
      
       

<apex:inputField value="{!User.Username}" />
<apex:inputField value="{!User.Password__c}" required="true"/>
</div>
</apex:pageBlockSection>
<div align="right:top" columns="2" >
<apex:commandButton value="Login" action="{!save}"/>
</div>

</apex:pageBlock>

</apex:form>
  
</apex:page>
Create an Apex class that returns contacts based on incoming parameters.
For this challenge, you will need to create a class that has a method accepting two strings. The method searches for contacts that have a last name matching the first string and a mailing postal code matching the second. It gets the ID and Name of those contacts and returns them.

The Apex class must be called ContactSearch and be in the public scope
The Apex class must have a public static method called searchForContacts
The method must accept two incoming strings as parameters
The method should then find any contact that has a last name matching the first string, and mailing postal code (API name: MailingPostalCode) matching the second string
The method should finally return a list of Contact records of type List that includes the ID and Name fields



below is my code 

public class ContactSearch {
    
    public static List<String> searchForContacts(String x, String y){
        x1=x;
        y1=y;
        List<String> con = new List<String>();
        for (Contact[] tmp : [SELECT Id,Name FROM Contact where Name := x1 AND MailingPostalCode :=y1]) {
            con.add(tmp);
        }
        return con;
       
    }

}
I am new in salesforce, I have a problem with Database.query. Its not returning the data to apex class, But while i am using query editor its showing the correct data. My query is
List<CM_Group__c> e = Database.query('SELECT 
        CM_Skill_Level__c,CM_Start_Date__c,Name FROM CM_Employee__c where 
        CM_Start_Date__c != null');
        System.debug(e);
when iam checking with debug log it showing empty. But when i am using query editor it showing the below result 
User-added image
Any help would be appreciatable
 
Hi, 

I want to put image in visualforce page footer. However, the postion is not right, I want to remove white big space in footer. I use margin-bottom and bottom, but footer div is not effected at all. Could anyone of you suggest on this? Thank you in advance.

My VF page
<head>
           <style type="text/css">
                    @page {
                                  @top-center { content: element(header); } }
                                         div.eReceiptContent{ padding-top:50px; padding-left:22px; padding-right:22px; }
                                         div.header { padding: 0.5px; position: running(header); }
                                         .pagenumber:before { content: counter(page); }
                                         .pagecount:before { content: counter(pages); }
                                }
              </style>
</head>

My Footer Div
<div class="footer">
             <apex:image style="width: 100%;margin-bottom:-10px" url="https://c.cs85.content.force.com/servlet/servlet.FileDownload?file=0156E000000RBRy"/>
</div>
<input id="pwd" name="pwd" placeholder="Password" type="password" value="abc123" aria-invalid="false" class="valid">
Password is showing in different places like network preserve log, inspect elements.
this is the situation which i am facing in inspect elements. How to hide the password element or value in DOM elements. Please help me in this
Hi,

I am using this very basic code for a VF page. All i want to do is change the colour of the pageblocksection colapsable bars. Can you help?

i have read all sorts of strange ways of doing it, but hoped there was something more straght forward.
 
<apex:pageBlockSection  title="{!Group_Relationship__c.Group_Name_AP__c} Action Plan" columns="4">  
                      
            <div style="float:left; width: 100%;" >
            <apex:pageBlockSection title="Details" columns="4">
                <apex:inputField value="{!Group_Relationship__c.Group_Name__c}" required="false"/>
                
                
                
                </apex:pageBlockSection> 
                     
            </div>

 
Hi Guys,

I'm trying to embed an external website in Salesforce via visualforce page.

Problem is the external site sets X-Frame-Options header to explicitly stop embedding the site in iframe. Also, I cant disable the clickjack property in org.

Any alternative way I can get the external site to Salesforce?

 
  • August 01, 2018
  • Like
  • 0
Hello,
How can I move my custom buttons to the bottom of the Lightning Action with my VF Page? In the screenshot below, I'd like to move the button "Send Now" to the bottom where Cancel and Save are found. And actually I'd like to replace Save with the Send Now.
When I click the Action button now below is what pops up:
User-added image
My VF Page looks like this:
<apex:page standardcontroller="Lead" lightningStylesheets="true" extensions="SaveAmend">
    <apex:form >
        
        <!--Other info to go here-->
        
        <apex:commandButton  value="Send Now" action="{!Send}"/>
    </apex:form>  
</apex:page>
I tried putting the apex:commandbutton inside apex:pageblockbutton, but that didnt work either.
Thanks for your help!
 
<apex:outputLabel style="width: 70% !important;">Created Date: </apex:outputLabel>
<apex:input label="From: " value="{!createdByStartDate}" type="auto"/>
<apex:input label="To: " value="{!createdByEndDate}" type="auto"/>


For my input labels, when I hover over it, it shows me a drop down arrow making it clear to users that it can be clicked, but otherwise the arrow disappears. I'm trying to figure out a way to keep it there permanently. Other solutions have suggested using

input[type="date"]::-webkit-calendar-picker-indicator {
  opacity:1;
}
But no matter where I try to put this, where it be in a style class or direct stlying on the input field,  I don't get any results.