• Ravi Dutt Sharma
  • PRO
  • 2505 Points
  • Member since 2014
  • PayPal


  • Chatter
    Feed
  • 77
    Best Answers
  • 3
    Likes Received
  • 0
    Likes Given
  • 19
    Questions
  • 562
    Replies
How to display stagename and other fields on maps using lwc.
Currently, i am displaying only opportunity name and marker on map using location (Address fields salesforce). But how to display stagename and other fields on maps). (or) any account fields.
Please advise.Image of opportunities displayed on maps with only address
I've been working with the compent offered on this site:
https://sfdcmonkey.com/2017/04/19/download-csv-file-data-salesforce-lightning-component/

It's working perfectly, but one thing I missed is that it seems to pull all user records in my org, but really I just want to see those that are related to the Programming__c record where the button is clicked.

Is there a way to achieve this in my class?
 
public class User_List {
 
@AuraEnabled
   public static list <User_List__c> fetchList(){
      
      List <User_List__c> returnUserList = new List < User_List__c > ();
        
      for(User_List__c ul: [SELECT 	id, First_Name__c, Last_Name__c, Email__c, Extension_Number__c, Type_of_User_License__c, Phone_Model__c, Language__c, Outbound_Number_Display__c, Outbound_Name_Display__c, Voicemail_Option__c, CFNR_Number__c From User_List__c LIMIT 1000]) {
             returnUserList.add(ul);
          }
         return returnUserList;
   }
}

 
Hi,

I am trying to launch a flow from an aura component. In the flow, I have an apex variable of type "Apex-Defined Collection variable". How to set the value of this variable from the aura component? I have two other string variables in the flow, I am able to set them, but when I set the value in the apex defined var, the flow throws an error. Below is the relevant code from the aura component:
const flow = component.find("flowData");
const inputVariables = [
            {
            name: "varCaseId",
            type: "String",
            value: component.get("v.recordId")
        },
        {
            name: "varAccountNumber",
            type: "String",
            value: response.accountNumber
        },
        {
            name: "varIntents",
            type: "Intent",
            value: response.intents
        }
];
flow.startFlow(response.flowAPIName, inputVariables);
If I remove the third element from the inputVariables array, then the flow launches correctly, otherwise not.

 
I have a custom setting 'Licensename__c' where 'license__c' is the only field. I am using the below logic to access the data from it 

List<LicenseName__C> names = LicenseName__c.getall().values();
system.debug(names[0].License__c);
system.debug(names[1].License__c);
system.debug(names[2].License__c);
system.debug(names[3].License__c);

The debug statements are not giving the data in the order that i have entered in custom setting.

Is there any way to bring the data in the code in the same order i entered in custom setting!?

Also please let me know how to count the number of dataset in the custom setting.
Any help is appreciated.

Thank you!
Hi ,
I am getting issue in catch block due to retrun statement .Can anyone help me in thisUser-added image
Main Class

public with sharing class Common_DAO 
{
    //get the list of Table Component records
    public static List<Common_TableComponent__c> getTableComponentList(string recordName)
    {
        try
        {
            List<Common_TableComponent__c> tempList = new List<Common_TableComponent__c>();
            
            tempList = [SELECT ActionButtons__c,Advanced_Search_Criteria__c,Advanced_Search_Help_Text__c,
                        ColumnHeaderList__c,Columns_To_Sort__c,
                        Date_Filter_Values_New__c,DefaultView__c,Default_Filter_Column__c,Enable_Advanced_Search__c,Enable_Date_Filter__c,
                        Enable_Search__c,Enable_Sorting__c,Fields__c,IsActionColumnEnabled__c,Order_By_Clause__c,
                        Pagination_Type__c,SearchFields__c,Search_Help_Text__c,SOQLQuery__c,Where_Clause__c, Header_Default_Value__c,Header_Spanish_Value__c 
                        FROM Common_TableComponent__c WHERE Name = :recordName LIMIT 1];
            
            return tempList;
        }
        catch(exception e)
        {
            return null;
        }
    }
    
    //get the list of Table Search records
    public static List<Common_TableSearch__c> getTableSearchList(string recordName, string searchType)
    {
        try
        {
            List<Common_TableSearch__c> tempList = new List<Common_TableSearch__c>();
            
            tempList = [SELECT Name, Advanced_Search_SOQL_Query__c, Common_TableComponent__c,
                        Field_Type__c, Join_Column__c, Placeholder_Text__c, Possible_Values__c,
                        Search_Type__c,  Child_Column__c,Default_Filter_Column__c,Where__c,Order_By__c,Default_Filter_Value_SOQL__c,Default_Filter_Child_Column__c  
                        from Common_TableSearch__c 
                        where Common_TableComponent__r.Name = :recordName and Search_Type__c=: searchType order by Sequence_Number__c ];
            
            return tempList;
        }
        catch(exception e)
        {
            return null;
        }
    }
    
    //get the list of Table Search records
    public static List<Common_TableAction__c> getTableActionList(set<string> buttonsNameSet)
    {
        try
        {
            List<Common_TableAction__c> tempList = new List<Common_TableAction__c>();
            
            tempList = [SELECT Name,Action_Button_Display_Column_Values__c,
                        Action_Button_Display_Criteria_Column__c,
                        Action_Button_Ext_Display_Column_Values__c,
                        Action_Button_External_Display_Criteria__c,
                        APINameOfLink__c,Custom_Permissions__c,DynamicParams__c,
                        EnableAsLink__c,Is_Absolute_URL__c,IsActive__c,
                        Is_Remote_Action_Button__c,Enable_Pop_up__c,Self_Window__c,
                        Remote_Action_Class__c,Remote_Action_Method__c,Title__c,URL__c 
                        FROM Common_TableAction__c where Name IN : buttonsNameSet];
            
            return tempList;
        }
        catch(exception e)
        {
            return null;
        }
    }
}

Test class 
@IsTest
Public class Common_DAO_Test{
     @isTest  static testmethod void common_DAOTest1(){
     
        string recordName='';
        string searchType='';
        set<string> buttonsNameSet=new set<string> ();
        Common_DAO c=new Common_DAO();
        Common_DAO.getTableComponentList(recordName);
        Common_DAO.getTableSearchList(recordName,searchType);
        Common_DAO.getTableActionList(buttonsNameSet);
        system.assertequals(searchType,'');    
    }
    
    Public static testmethod void common_DAOTest2(){
        Common_DAO c=new Common_DAO();
        string recordName='test';
        string searchType='test';
        set<string> buttonsNameSet=new set<string> {'test'};
            
            
            try{
            
            Common_DAO.getTableComponentList(recordName);
           
            } catch(DMLException e) {
            
            system.assertEquals(e.getMessage(), e.getMessage()); 
            
            } 
            Common_DAO.getTableSearchList(recordName,searchType);
            Common_DAO.getTableActionList(buttonsNameSet);
        }
Hello,

I'm been trying to figure out how to get a list of all 167,000 accounts and put them in a csv and upload to S3 nightly. I'm running into multiple issues, mainly the size of the row return and uploading to S3 on a schedule. For the first part, i've been trying to use a Batchable class to bypass the 50,000 row limit, but Batchables don't allow @future calls, so I can't upload to S3. So then I tried using Queueable to bypass the @future problem, but I run into the 50,000 row limit. Is there a way to do this or am I stuck?
Hello,
I have an Apex class where I am parsing the selected values from a multiselect.
How can I add double quotes to each element?
I have big, small, medium.
I need "big","small","medium"

Any suggestion would be appreciated.
Cheers,
P
I am wanting to change the "assigned to" value in open (i.e. not closed) activities whenever the parent record owner changes. Our marketing automation system is automatically creating a bulk of tasks and assigning them to the current contact owner, but a few hours later a mass contact reassignment is happening and these tasks are not getting assigned to the new contact owner.

Desired functionality:
1. Contact Owner changes
2. Related open activities (tasks) are reassigned to new contact owner
-end-

Thanks in advance for your help.
I have written a schedule class to update the lead source to web if the lead source is null. I have written test class as well. But code coverage is 0% can anyone help me so that code coverage is 100%

Class 

global class LeadMaintanace implements Schedulable{
    global void execute(SchedulableContext SC) {
        List<Lead> li =[Select Id,Name from Lead where LeadSource = 'null' LIMIT 10];
        List<Lead> lu= new  List<Lead>();
        if(!li.isEmpty()){
            for(Lead ld:li){
                ld.LeadSource = 'Web';
                lu.add(ld);
            }
                }
        update lu;
    }

}

test class

@isTest
public class TestLeadMaintanace {
    @testsetup
    static void setup(){
        List<Lead> li = new List<Lead>();
        for(Integer i;i<10;i++){
            Lead ld = new Lead(Company = 'Proseraa',LastName ='MN',Status = 'Working - Contacted');
            li.add(ld);
            
            
        }
        update li;
        
    }
    static testmethod  void TestJobSchedule(){
        string sch = '0 30 12 2 20 ?';
        Test.startTest();
        string jobid=System.Schedule('SchedulableClass',sch, new LeadMaintanace());
        List<Lead> li =[Select Id from Lead where LeadSource=null limit 10];
        system.assertEquals(10,li.size());
        test.stopTest();
        
    }
    
    
}
Hi Forum Members,

I am trying to come up with a way to retrieve all Accounts within a hierarchy based on a supplied Id.  So, if the Id of the parent account is provided, all children records plus the parent record should be returned.  Similarly, if an Id of a child record is supplied, all parent, sibling, and children records should be returned.

User-added image

Any help in this regard is highly appreciated
Hello, everyone. 

I have a parent component, with a child component to simulate a multipicklist selection. I have to pass the list of selected values to the parent component, but it doesn't work. Does enyone know how to solve this? 

Child component:
<aura:attribute name="UFList" type="List" default="[]"/>
    <aura:attribute name="selectedUFList" type="List"  default="[]"/>
     
    <div class="slds-m-around_xx-small">
        <lightning:dualListbox aura:id="selectUF"
                               name="UF"
                               sourceLabel="Disponíveis"
                               selectedLabel="Selecionados"
                               options="{!v.UFList }"
                               value="{!v.selectedUFList}"
                               onchange="{!c.handleUFChange}"/>
        <lightning:button variant="brand" label="Salvar" onclick="{!c.getSelectedUF}" />
    </div>

Child controller:
getSelectedUF : function(component, event, helper){
        var selectedValues = component.get("v.selectedUFList");
        var componentEvent = component.getEvent("MultiPicklitsEvt");
            
            componentEvent.setParams({
                "UFVar" : component.get("v.selectedValues"),
            });
            
            componentEvent.fire();
        }


Event:
<aura:event type="COMPONENT"  >
    <aura:attribute name="UFVar" type="String"  />
</aura:event>

Parent component:
 <aura:handler name="MultiPicklitsEvt" event="c:MultiPicklitsEvt" action="{!c.handleMultiPicklitsEvt}"/>

Parent Controller:
handleMultiPicklitsEvt : function (component,event,helper) {
        
        var item = component.get("v.item");
        component.set("v.chosenUF", event.getParam("UFVar"));
        console.log(UFVar)
        
        item.UF__c = event.getParam("UFVar");
        log.console(chosenSP)
        
        component.set("v.item", item);     
    },
    
I have 5 Controllers which affect opportunities. Each has a test which provides > 90% code coverage in UAT. When I look in production, these tests provide 0% code coverage when the Controllers and related tests are identical between UAT and production. General question is what could cause these tests to fail given the success in UAT and the artifacts promote successfully to production?
Hi I'm new to Eainstein analytics. I would like to develop a lightning component which will take image url & show the image. So I created this component
<aura:component implements="flexipage:availableForAllPageTypes" access="global" controller="MyController" >
 <lightning:card title="Partner Information">
     <Div>
         <p><lightning:input aura:name="image" label ="Enter image url"  type="text"/></p>
	     <br></br> 
         <img url="{!v.image}" />
	
		
    
     </Div>
</lightning:card>
     
</aura:component>
My purpose is to display the image using the URL & predict the image using the url
But while running the component, I'm getting error message 
This page has an error. You might just need to refresh it.
Access Check Failed! AttributeSet.get(): attribute 'image' of component 'markup://c:EinsteinPrediction {3:0}' is not visible to 'markup://c:EinsteinPrediction {3:0}'.
Failing descriptor: {c:EinsteinPrediction}

Can you help me to resolve this issue?
I have a trigger on Contract Object, whenever the Contract record is updated the contract section in the associated opportunities will also get updated with the latest Contract data but while updating Contract record, Contract section in associated Opportunities is not updating instead I am getting validation errors which is created on Opportunity object.
Now I want to stop Opportunity validation rules when I update the contract section of Opportunity object from Contract trigger. Is there anything that we can pass from trigger to validation rules to stop validation rules errors?  Please help me.
 
Hi there,
I'm trying to return just the live Accounts through SOQL but when I attach status to the where clause it errors, is the Status column in the accounts table or do i need to join to another table? Whats the best way to find the whole schema?

Thank you

Dave.
 
Hello,
Lookin gto do an audit on the number of users assigned to all of the profiles in an org.  Is there a way to get the user count on each profile? Goal is to remove/consolidate profiles if possible.
Thanks
P