• {!Piyush_soni__c}
  • ALL STAR
  • 11485 Points
  • Member since 2016
  • Salesforce Developer
  • ACS


  • Chatter
    Feed
  • 368
    Best Answers
  • 20
    Likes Received
  • 25
    Likes Given
  • 2
    Questions
  • 1369
    Replies
How can I show the current user photo in the custom community lightning theme? I would like to add current user image on a custom component that I created.
Hi All,
I am trying to display the Account records on Visual Force Page where Phone and fax fields values are equal. 
I have written a Controller and design a VF page. But when I am clicking on "Display records" Button then I am getting below error.
Visualforce Error
System.NullPointerException: Attempt to de-reference a null object
Error is in expression '{!display}' in component <apex:commandButton> in page displayrecords: Class.DispalyMatchingRecords.display: line 9, column 1
Class.DispalyMatchingRecords.display: line 9, column 1
I tried to debug this, Actually while adding the value in "acc" list its throwing the error.
Could anyone help me out here. Actually I am not having much knowledge of VF pages so not sure where I am doing wrong.

VF Page:- 
<apex:page controller="DispalyMatchingRecords" >
    <apex:form>
    <apex:pageBlock>
        <apex:pageBlockTable value="{!acc}" var="a">
        <apex:column value= "{!a.Id}"/>
            <apex:column value= "{!a.Name}"/>
        </apex:pageBlockTable>
<apex:commandButton value="Display Records" action="{!display}"/>  
    </apex:pageBlock>
        </apex:form>
</apex:page>

Controller:-
public class DispalyMatchingRecords {

   public List<Account> acc {get;set;}
    public void display(){
        List<Account> ac =[Select Id, Name, Phone,Fax from Account];
        for(Account a: ac){
            if(a.Phone != null && a.Fax != null){
                if(a.Phone == a.Fax){
                    acc.add(a);
                }
            }
        }
    }
}
Hi,
can you please help me test class

public with sharing class LookupController {

   /* Method to query records using SOSL*/
    @AuraEnabled
    public static String search(String objectAPIName, String searchText,
            List<String> whereClause, List<String> extrafields){

        objectAPIName = String.escapeSingleQuotes(objectAPIName);
        searchText = String.escapeSingleQuotes(searchText);
        String searchQuery = 'FIND \'' + searchText + '*\' IN ALL FIELDS RETURNING ' + objectAPIName + '(Id,Name' ;
        if(!extrafields.isEmpty()){
            searchQuery = searchQuery + ',' + String.join(extrafields, ',') ;
        }
        system.debug(whereClause);
        if(!whereClause.isEmpty()){
            searchQuery = searchQuery + ' WHERE ' ;
            searchQuery = searchQuery + String.join(whereClause, 'AND') ;
        }
        searchQuery = searchQuery + ' LIMIT 10 ) ';
        system.debug(searchQuery);
        return JSON.serializePretty(search.query(searchQuery)) ;
    }

    /* Method to query records using SOQL*/
    @AuraEnabled
    public static List<SObject> getRecentlyViewed(
            String objectAPIName,
            List<String> whereClause,
            List<String> extrafields){

        String searchQuery = 'SELECT Id, Name';
        if(!extrafields.isEmpty()){
            searchQuery = searchQuery + ',' + String.join(extrafields, ',') ;
        }
        //searchQuery = searchQuery + ' FROM ' + objectAPIName + ' WHERE LastViewedDate != NULL ';
        searchQuery = searchQuery + ' FROM ' + objectAPIName ;
        if(!whereClause.isEmpty()){
            searchQuery = searchQuery + ' AND ' ;
            searchQuery = searchQuery + String.join(whereClause, 'AND') ;
            system.debug(searchQuery);
        }
        searchQuery = searchQuery + ' ORDER BY LastViewedDate DESC LIMIT 10 ' ;
        List<SObject> objectList =  new List<SObject>();
                system.debug('-----------------------'+searchQuery);
        objectList = Database.query(searchQuery);
        return objectList;
    }
}


Thanks
Hi All,

I want to use counter inside aura: iterator. Like below

<aura:attribute name="counter" type="integer" default="0"/>

<aura:iteration items="{!v.futureInteractions}" var="Interaction">
  <aura:if istrue="{!v.counter =0 && Interaction.isFutre}">
      Futre interaction
     <aura:set attribute="counter" value="1" />
  </aura:if>
</aura:iteration>

Can anyone help me how can i change counter value inside iterator???
<lightning:button class="slds-button" variant="base" value="{!usr.UserId}" label="{!usr.Username}" onclick="{!c.openuserqueue}" />
Hi,

Is salesforce ligthtning is ruling now ? Is it necessary to learn lightning as developer? what will be used in lightning development and what are prerequisites to learn it.?

Thank you
Hello,

In "Lightning Components Basics", post "Create and Edit Lightning Components", there is a paragraph as below:
Indeed, the Developer Console has a number of features for working with Lightning Components. There’s also File | Open | Lightning Resources, which lets you open a bunch of Lightning resources all at once. Useful!
But in Developer Console, I cannot find "Lightning Resources" under "Open", instead it is File | Open Lightning Resources. Please update the post.
 
apex class:
public class myAccount {
    private final contact con;
    public string filename{set;get;}
    public string contenttype {set;get;}
    public string Conlastname{get;set;}
    public string conphone{get;set;}
    public string conemail{get;set;}
    public string Conmobilephone{get;set;}
    public string Accid='';
    public blob Photo{get;set;}
    public string photoname{get;set;}
    public string photourl{get;set;}
    //Contstructor 
   public myAccount(ApexPages.StandardController controller) {
     con=(Contact)controller.getRecord();
    }
   
    //this method updates the Contact with photourl and insert The Attachment Record
    public void UploadPhoto(){
        try{
            con.lastname = conlastname;  
            con.email = conemail;
            con.phone = conphone;
            con.mobilephone = conmobilephone;
            insert con;
           // Accid = ApexPages.currentPage().getParameters().get('id');  
           // inserting attachement with Attached photo      
            Attachment objA=new Attachment();
            objA.body = photo;
            objA.name = filename;
            objA.parentid= con.id;
            objA.ContentType = contenttype;
            insert objA;
           
            string Attid= objA.id;
            string attachmentid=Attid.substring(0,15);
             system.debug(Attid);
             con.imageUrl__c = '<img src="https://hyundaycars-dev-ed--c.ap5.content.force.com/servlet/servlet.FileDownload?file='+attachmentid+'"></img>';
           con.urlToImage__c = 'https://hyundaycars-dev-ed--c.ap5.content.force.com/servlet/servlet.FileDownload?file='+attachmentid;
            update con;
            photourl = con.urlToImage__c ;        
        }catch(Exception e){
            system.debug('Exception message'+e);
        }
     } 
     public List<SelectOption> getTypes(){
            Schema.sObjectType sobject_type = Contact.getSObjectType();
            Schema.DescribeSObjectResult sobject_describe = sobject_type.getDescribe();
            Map<String, Schema.SObjectField> field_map = sobject_describe.fields.getMap();
            List<Schema.PicklistEntry> pick_list_values = field_map.get('Level__c').getDescribe().getPickListValues();
            List<selectOption> options = new List<selectOption>();
           for (Schema.PicklistEntry a : pick_list_values) {
                      options.add(new selectOption(a.getLabel(), a.getValue()));
          }
      return options;
}
 public List<SelectOption> getTypes1(){
            Schema.sObjectType sobject_type = Contact.getSObjectType();
            Schema.DescribeSObjectResult sobject_describe = sobject_type.getDescribe();
            Map<String, Schema.SObjectField> field_map = sobject_describe.fields.getMap();
            List<Schema.PicklistEntry> pick_list_values = field_map.get('select_multipl__c').getDescribe().getPickListValues();
            List<selectOption> options = new List<selectOption>();
           for (Schema.PicklistEntry a : pick_list_values) {
                      options.add(new selectOption(a.getLabel(), a.getValue()));
          }
      return options;
}
}
Test class:
@isTest
public class TestmyAccount {
    @isTest static void myAccountTest(){
        Contact c = new Contact(LastName='lastName1');
            insert c;
        Attachment objA=new Attachment();
            objA.body = Blob.valueOf('photourl');
            objA.Name = 'filename';
            objA.parentid= c.id;
            objA.ContentType = 'Applications';
            insert objA;
        string ids = objA.Id;
            c.imageUrl__c = 'imageurl';
            c.urlToImage__c = 'photourl';
            update c;
        Test.startTest();
            myAccount acc =new myAccount(new ApexPages.StandardController(c));
       /* ApexPages.StandardController sc = new ApexPages.StandardController(c);
        myAccount acc = new myAccount(sc);*/
        acc.UploadPhoto();
        List<Attachment> attachments=[select id, name from Attachment where parent.id=:c.id];
        System.assertEquals(1, attachments.size());

        acc.Photo=Blob.valueOf('photourl');
        acc.filename='filename';
        acc.contenttype='Applications';
        acc.photoname='photoname';
        acc.photourl='photourl';
        
        List<SelectOption> sel = acc.getTypes();
        List<SelectOption> selist = acc.getTypes1();
        Test.stopTest();
    }
}
select id,createddate from someObject

and my query is returing list of sObjects with its data and Createddate
and then i am assigning this list of sobject to my attribute of lightning component like this
var action = component.get("c.getResponseHistory");
        action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {  
                component.set("v.responseObject",response.getReturnValue());
                             
            }
         });
        $A.enqueueAction(action);
for each record i dont want to assign full datetime as createddate return datetime i want createddate to be converted to only date for each record

Please help me to do this 
Thanks
 
Hi Team,

I haveuploaded a ppt document in static resources.
I want to create formula field and display the link which we have uploaded in static resources.

please let me know how can we do this?


Thanks
Lakshmi.
 
I'm new to slaesforce.I want to create test class for my below code:

public class AccountContOpptCheckBoxController {
    
    public List<Account> acctList{get;set;}
    public List<Contact> conList{get;set;}
    public List<Opportunity> oppList{get;set;}
    public List<ContactWrapper> conWrList{get;set;}
    public List<OpportunityWrapper> opportList{get;set;}
    public List<Contact> selectedContacts{get;set;}
    public List<Opportunity> selectedOpportunities{get;set;}
    //public List<StoreAccountData__c> storeList{get;set;}
    public List<StoreAccountData__c> storedList= new List<StoreAccountData__c>();
     
    Set<ID> acctIds = new Set<ID>();
    
    public AccountContOpptCheckBoxController(ApexPages.standardController controller){  
        getAccountDetails();
        for(Account ac: acctList){ 
            if(ac.Id != null){
                acctIds.add(ac.Id);
            } 
        }
    }
    
    public List<Account> getAccountDetails() {    
           acctList = Database.query('SELECT Name FROM Account LIMIT 1');
        return acctList;
 }
    
    public PageReference reset() {
        
       PageReference newpage = new PageReference(System.currentPageReference().getURL());   
   newpage.getParameters().clear();
   newpage.setRedirect(true);
   return newpage;
        
    }
    
    public class ContactWrapper {
     public boolean cb {get;set;}
     public Contact contct {get;set;}

     public ContactWrapper(Contact contct){
          cb=false;
          this.contct = contct;
     }
}
    
    public class OpportunityWrapper {
     public boolean cbOp {get;set;}
     public Opportunity oppornty {get;set;}

     public OpportunityWrapper(Opportunity oppornty){
          cbOp=false;
          this.oppornty = oppornty;
     }
}
    
    public Pagereference getContacts() {
        if(conWrList == null) {
            conWrList = new List<ContactWrapper>();
            for(Contact c : [select id,name,phone,accountId from contact where accountid in : acctIds]) {
                conWrList.add(new ContactWrapper(c));
            }
        }
        return NULL;
    }
    
        public Pagereference getOpportunitiess() {
        if(opportList == null) {
            opportList = new List<OpportunityWrapper>();
            for(Opportunity p : [select id,name,StageName,AccountId from Opportunity where accountid in : acctIds]) {
                opportList.add(new OpportunityWrapper(p));
            }
        }
        return NULL;
    }
    
    public List<Contact> getSelectContactDetails()
    {
        selectedContacts = new List<Contact>();
        if(conWrList!=null){
            for(ContactWrapper cCon : conWrList) {
                if(cCon.cb == true) {
                    selectedContacts.add(cCon.contct);
                }
            }
        }
        return selectedContacts;
    }
    
    public List<Opportunity> getSelectOpporDetails()
    {
        selectedOpportunities = new List<Opportunity>();
        if(opportList!=NULL){
            for(OpportunityWrapper Opt : opportList) {
                if(Opt.cbOp == true) {
                    selectedOpportunities.add(Opt.oppornty);
                }
            }
        }
        return selectedOpportunities;
    }
    
    public PageReference submit() {
        PageReference np = new PageReference('/apex/FetchAcctContactOpprCheckboxPage');
        np.setRedirect(false);
        return np;
    }
     public PageReference back() {
        PageReference bp = new PageReference('/apex/AccountContOpptCheckboxPage');
        bp.setRedirect(false);
        return bp;
    }
    
    public PageReference confirm() {
        
        List<StoreAccountData__c> storeList= new List<StoreAccountData__c>();
        
        if(selectedContacts!=null){
            for(Contact ct:selectedContacts){
                StoreAccountData__c sd= new StoreAccountData__c();
                //ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Select Name--'+ct.AccountId));
                sd.AccountStore__c=ct.AccountId;
                sd.Name=ct.Name;
                sd.Phone__c=ct.Phone;
                storeList.add(sd);
            }
        }
        
        if(selectedOpportunities!=null){
             for(Opportunity op:selectedOpportunities){
                StoreAccountData__c sd1= new StoreAccountData__c();
                sd1.AccountStore__c=op.AccountId;
                sd1.OppName__c=op.Name;
                sd1.StageName__c=op.StageName;
                storeList.add(sd1);
            }
        }
        insert storeList;     
        ApexPages.addMessage(new ApexPages.Message(ApexPages.SEVERITY.INFO,'Records added successfully'));
        return NULL;
    }
}
I have Used jQuery DataTable Plugin In Salesforce Lightning Component . Now i want to remove unwanted sorting symbols in my table  from the loaded scripts.
So any one help me on this. Thanks in advance...

Ref Image:

User-added image
User-added image

Thanks
Venkat

 
I have Used jQuery DataTable Plugin In Salesforce Lightning Component . Now i want to remove unwanted css clases from the loaded scripts.
So any one help me on this. Thanks in advance...

User-added image

I Want to remove the highlighted css classes from the loaded scripts.
================================================================

Code Snippet:

.This  .dataTables_length {
    color: white!important;
}


User-added image

But in select option also i am getting white color, due to that i am unable to see the size of the paze like 10, 25, 50, 100. So i want to give another background color for select option only.This is all because of my page background color is black but it is mandatory.

Thanks 
Venkat


 
Hi Gurus, 

I have writen a very short apex code to be able redirect from one Visualforce page to another however, I now have to write a test class, which i am awful at :D 

So it would be great if someone could please assist me :)  

This is my short apex code for the redirection:
 
public with sharing class CustomerSatisfaction
 { public String currentRecordId {get;set;}

  public CustomerSatisfaction (ApexPages.StandardController controller)
    { this.currentRecordId = ApexPages.CurrentPage().getparameters().get('id');}
  
  public PageReference UK_Flag () {                   
           PageReference pageref = new 
                     PageReference('/apex/CustomerSatisfaction_EN?Id='+currentRecordId); 
                     pageref.setRedirect(true);
                     return pageref;}
 
      public PageReference France_Flag () {                   
           PageReference pageref = new 
                     PageReference('/apex/CustomerSatisfaction_FR?Id='+currentRecordId); 
                     pageref.setRedirect(true);
                     return pageref;}
 
}

If someone know how I could write the test then please let me know! Thanks!!
User-added image

i want display lightning:helpText along with lable of lighting:input field.
<aura:component>
    <lightning:helptext content="Your Name will be your login name" />
	<lightning:input label="Name" name="myname" required="true"/>
</aura:component>



Thanks in advance
Hi Team,

I am accessing the image in to my component  from the static resource. Now i want to implement the onMouseover event on that image.
When onMouseover on that image the background color should change to some other color.
Please help me on this. 
                                     Thanks in advance...
Code Snippet:

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    <lightning:layout >

                                    <lightning:layoutItem size="3" padding="around-small">
                                        <div >
                                            <img style="height: 500px;" src="/resource/Mouseover/" /></div>
                                            
                                        
                                    </lightning:layoutItem>
    </lightning:layout>
</aura:component>
===================================
Reference Image:

User-added image
ChildComponent
--------------
<aura:component >
    <ui:button label="click me" press="{!c.hanldeClick}"/>
    <aura:registerEvent name="componentevent" type="c:SimpleComponentEvent"/>
</aura:component>

SimpleComponentEvent.evt
------------------------
<aura:event type="component" description="component" >
 <aura:attribute name="message" type="string"/>
    </aura:event>
    
    controller
    ------------
    ({
    hanldeClick : function(component, event, helper) {
        var v1=component.get("componentevent");
        v1.setParams({
            "message":'Welcome to sfdcscenarios.blogspot.com'
        });
        v1.fire();
        
        
    }
})


ParentComponent
---------------
<aura:component >
    <aura:attribute name="EventMessage" type="String"/>
    <aura:handler name="componentevent" event="c:SimpleComponentEvent" action="{!c.hanldeParent}"/>
    <c:ChildComponent/>
    {!v.EventMessage}
</aura:component>




Controller
-----------
({
    handleParent: function(component, event, helper) {
        var message = event.getParam("message"); 
        cmp.set("v.EventMessage", message + 'brahmanaidu');         
    } 
    
    
})

Hi All, 

I was wondering if there is any way of updating an account field in APEX if i have the account ID in the Triggered Object. Right now i am running into the issue that I can not do the following (Trigger is on the Opportunity).

List <Account> AccountsInHierarchy = [SELECT Field_A, Field_B, Field_C
                                      FROM     Account
                                      WHERE  Ultimate_Parent_ID__c = Trigger.new.Account.Ultimate_Parent_Id__c
                                     ];

Whenever I do this I get the following error: 
System.LimitException: Too many query rows: 50001
 

I have already tried limiting the numbers returned by my SOQL Query but the error persisted. Any help would be much appreciated. 

Best, 

FD


 

what is the advantages of querying data withing the for loop itself like below

for(Account a:[select name from Account])
{
***logic***
}
Best Practice : When someone takes the time/effort to repspond to your question, you should take the time/effort to either mark the question as "Solved", or post a Follow-Up with addtional information.

User-added image


      That way people with a similar question can find the Solution without having to re-post the same question again and again. And the people who reply to your post know that the issue has been resolved and they can stop working on it. 

Thanks #Copy_Steve Molis
Best Practice : When someone takes the time/effort to repspond to your question, you should take the time/effort to either mark the question as "Solved", or post a Follow-Up with addtional information.

User-added image


      That way people with a similar question can find the Solution without having to re-post the same question again and again. And the people who reply to your post know that the issue has been resolved and they can stop working on it. 

Thanks #Copy_Steve Molis
Error:Apex trigger TaskToCommunityTrigger caused an unexpected exception, contact your administrator: TaskToCommunityTrigger: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id not specified in an update call: []: Class.TaskToCommunity.aftrupdate: line 27, column 1
=======================================================================
public class TaskToCommunity {

    public static void aftrupdate(Map<id,contact> oldmap,Map<id,Contact> newmap){

        list<Task> ta=new list<Task>();
        user u=[select id from user where alias='sree'];

        // profile p=[select id from profile where name='Partner Community User'];
        for(id key:oldmap.keyset()){
            Contact old=oldmap.get(key);
            Contact newmp=newmap.get(key);
            
            if(old.Phone!=newmp.Phone){
                Task t=new Task();
                t.OwnerId=u.id; 
               // t.OwnerId=p.id; 
                //t.OwnerId=userinfo.getUserId();
                t.Status='Pending';
                t.Priority='Normal';
                //t.WhatId=newmp.id;
                
                t.ActivityDate=system.today();
                t.Subject='Testing';
                ta.add(t);
            }
        }
        update ta;
    }
}
===============================================================================================
trigger TaskToCommunityTrigger on Contact (after update) {

    if(trigger.isafter && trigger.isupdate){
    TaskToCommunity.aftrupdate(Trigger.oldmap, Trigger.newmap);
}
}

 
How can I show the current user photo in the custom community lightning theme? I would like to add current user image on a custom component that I created.
Product  AND Inventory_Change__c HAVE LOOKUP RELATIONSHIP.PRODUCT IS THE PARENT OF Inventory_Change__c .TRIGGER IS UPDATEING In_Stock__c FIELD ON THE BASIS OF RECORD TYPE CHANGE.
____________________________________________________________________________________________________________________
_____________________________________TRIGGER_______________________________________________________________________
trigger InventoryChangeTrigger on Inventory_Change__c (after update) {
  if(Trigger.isAfter && Trigger.isUpdate) {
    for (Inventory_Change__c oIC : Trigger.new){
      Product2  oP = [SELECT Id, In_Stock__c  FROM Product2 WHERE Id = :oIC.Product__c];
      Id Rid = Schema.SObjectType.Inventory_Change__c.getRecordTypeInfosByName().get('Reduction').getRecordTypeId();
      Id Aid = Schema.SObjectType.Inventory_Change__c.getRecordTypeInfosByName().get('Addition').getRecordTypeId();
      if(trigger.oldmap.get(oIC.id).RecordTypeid != trigger.newmap.get(oIC.id).RecordTypeid){
        if(oIC.RecordTypeid == Rid ){
          oP.In_Stock__c = oP.In_Stock__c - oIC.Quantity__c;
        }
        if(oIC.RecordTypeid == Aid ){
          oP.In_Stock__c = oP.In_Stock__c + oIC.Quantity__c;
        }
      }
    update oP;
    }
  }
}
PRODUCT IS A STANDARD OBJECT AND Inventory_Change__c IS A CUSTOM OBJECT WITH ONLY ONE FIELD REQUIRED THAT IS "RECORD TYPE"

__________________________________________________________________________________________________________________________
                                                                                           TEST CLASS
____________________________________________________________________________________________________________________________


@isTest
public class InventoryChangeTrigger_Test{
  static testMethod void test_Inventory_ChangeTrigger(){
    test.startTest();
    product2 product2_Obj  = new product2(Name = 'Name735', IsActive = true, In_Stock__c = 19, Out_of_Stock__c = false);
    insert product2_Obj;
    Inventory_Change__c inventory_change_Obj = new Inventory_Change__c(RecordTypeId = '01236000000STHgAAO',Quantity__c = 16,product__c = product2_Obj.id );
    Insert inventory_change_Obj;
    product2 product2_Obj1 = [select id,Name,In_Stock__c from product2 where Name = 'Name735'  LIMIT 1];
    product2_Obj1.name= 'xyz';
    product2_Obj1.In_Stock__c = 3;
    update product2_Obj1;
     
    test.stopTest();
  }
}
<ui:inputcheckbox  value="{!v.BatchInstance.Discount__c}" aura:id="disc" change="{!c.discountvalidation}"/>

discountvalidation : function(component, event, helper){
 var disc = component.find("disc");
    var discvalue = disc.get("v.value");  
        if(discvalue=true){
            alert("true");
        }
        if(discvalue=false){
            alert("false");
        }

I cant able to see false alert by deselecting the checkbox 
Hi,

I have a URL "https://gidev-groupinsurance.cs61.force.com/MemberPortal/s/caseclaimstatus?id=5004C0000033pqlQAA" . I want to use the "id" parameter in my lightning JS controller. How to do that?
Hi there, Think i have hit a bug.

When building a lightning component i have a modal for creating a record.
One of the feilds for this is a currency feild so i have used the following 
<lightning:input type="number" formatter="currency" aura:id="optionField" label="Cost" value="{!v.simpleNewOption.Cost__c}"/>
Renders fine and works as expected.
EXCEPT, When you enter the character e, it brings up the background records edit page.

Thoughts ?
 
*** I am working in a Lightning ORG ***

I would like to create a lookup field on the Lead to multiple other objects (above). Is there a way I can do this? 

The reason behind it is for Leads that have been referred by someone. This could be a Company, a Contact or even an Employee (User).

I am working on standard objects alone at this present time so no link to custom objects in required. 
Hi i have a trigger to fire warning message when the first name and last name are interchnaged during conversion.

trigger LeadWarning on Lead (after update)
{
    for (Lead l:trigger.new)
    {
        if (l.IsConverted && trigger.oldMap.get(l.Id).First_Name_Kana__c==trigger.newMap.get(l.Id).Last_name_Kana__c && trigger.oldMap.get(l.Id).Last_name_Kana__c==trigger.newMap.get(l.Id).First_Name_Kana__c)
        {
           Trigger.new[0].addError('#####');
        }
    }
}


It should throw error only when the changed are made during conversion. but it is throwing error if the name is edited even before conversion. what is the missing part?
Hi All,
I am trying to display the Account records on Visual Force Page where Phone and fax fields values are equal. 
I have written a Controller and design a VF page. But when I am clicking on "Display records" Button then I am getting below error.
Visualforce Error
System.NullPointerException: Attempt to de-reference a null object
Error is in expression '{!display}' in component <apex:commandButton> in page displayrecords: Class.DispalyMatchingRecords.display: line 9, column 1
Class.DispalyMatchingRecords.display: line 9, column 1
I tried to debug this, Actually while adding the value in "acc" list its throwing the error.
Could anyone help me out here. Actually I am not having much knowledge of VF pages so not sure where I am doing wrong.

VF Page:- 
<apex:page controller="DispalyMatchingRecords" >
    <apex:form>
    <apex:pageBlock>
        <apex:pageBlockTable value="{!acc}" var="a">
        <apex:column value= "{!a.Id}"/>
            <apex:column value= "{!a.Name}"/>
        </apex:pageBlockTable>
<apex:commandButton value="Display Records" action="{!display}"/>  
    </apex:pageBlock>
        </apex:form>
</apex:page>

Controller:-
public class DispalyMatchingRecords {

   public List<Account> acc {get;set;}
    public void display(){
        List<Account> ac =[Select Id, Name, Phone,Fax from Account];
        for(Account a: ac){
            if(a.Phone != null && a.Fax != null){
                if(a.Phone == a.Fax){
                    acc.add(a);
                }
            }
        }
    }
}
Hi,
can you please help me test class

public with sharing class LookupController {

   /* Method to query records using SOSL*/
    @AuraEnabled
    public static String search(String objectAPIName, String searchText,
            List<String> whereClause, List<String> extrafields){

        objectAPIName = String.escapeSingleQuotes(objectAPIName);
        searchText = String.escapeSingleQuotes(searchText);
        String searchQuery = 'FIND \'' + searchText + '*\' IN ALL FIELDS RETURNING ' + objectAPIName + '(Id,Name' ;
        if(!extrafields.isEmpty()){
            searchQuery = searchQuery + ',' + String.join(extrafields, ',') ;
        }
        system.debug(whereClause);
        if(!whereClause.isEmpty()){
            searchQuery = searchQuery + ' WHERE ' ;
            searchQuery = searchQuery + String.join(whereClause, 'AND') ;
        }
        searchQuery = searchQuery + ' LIMIT 10 ) ';
        system.debug(searchQuery);
        return JSON.serializePretty(search.query(searchQuery)) ;
    }

    /* Method to query records using SOQL*/
    @AuraEnabled
    public static List<SObject> getRecentlyViewed(
            String objectAPIName,
            List<String> whereClause,
            List<String> extrafields){

        String searchQuery = 'SELECT Id, Name';
        if(!extrafields.isEmpty()){
            searchQuery = searchQuery + ',' + String.join(extrafields, ',') ;
        }
        //searchQuery = searchQuery + ' FROM ' + objectAPIName + ' WHERE LastViewedDate != NULL ';
        searchQuery = searchQuery + ' FROM ' + objectAPIName ;
        if(!whereClause.isEmpty()){
            searchQuery = searchQuery + ' AND ' ;
            searchQuery = searchQuery + String.join(whereClause, 'AND') ;
            system.debug(searchQuery);
        }
        searchQuery = searchQuery + ' ORDER BY LastViewedDate DESC LIMIT 10 ' ;
        List<SObject> objectList =  new List<SObject>();
                system.debug('-----------------------'+searchQuery);
        objectList = Database.query(searchQuery);
        return objectList;
    }
}


Thanks
Hi All,

I want to use counter inside aura: iterator. Like below

<aura:attribute name="counter" type="integer" default="0"/>

<aura:iteration items="{!v.futureInteractions}" var="Interaction">
  <aura:if istrue="{!v.counter =0 && Interaction.isFutre}">
      Futre interaction
     <aura:set attribute="counter" value="1" />
  </aura:if>
</aura:iteration>

Can anyone help me how can i change counter value inside iterator???
Hi Community,
i am facing some problem for writing the test class for below apex class,can any provide sample code for this to write the test class
apex class
public class ProductNoteListController {
    
    @AuraEnabled
  public static List<CustomerProduct__c> getProductNotes(Id meetingRecId) {
    List<CustomerProduct__c> pdtNoteList =  [SELECT Id, Product__r.Id,Product__r.Name, MeetingNotes__c,MeetingId__c,RecordType.DeveloperName
            FROM CustomerProduct__c  
            WHERE MeetingId__c =: meetingRecId
            ORDER BY createdDate DESC];
      for(CustomerProduct__c cpRec : pdtNoteList){
          if(cpRec.MeetingNotes__c!=Null)
          {
              cpRec.MeetingNotes__c = cpRec.MeetingNotes__c.replaceAll('<[^>]+>',' ');
          }    
          
      }
      
      System.debug('**********'+pdtNoteList);
      
      return pdtNoteList;
  }
    
    @AuraEnabled
    public static void updateCustProdRT(Id recordId)
    {
        try
        {
            List<RecordType> rtypes = [Select Id From RecordType where Name='Customer Product' AND SobjectType = 'CustomerProduct__c'];
            CustomerProduct__c CP = [select id from CustomerProduct__c  WHERE Id=:recordId];
            CP.RecordTypeId=rtypes.get(0).Id;
            update CP;
        }
        catch(DmlException ex)
        {
            throw new AuraHandledException(ex.getMessage());
        }    
    }   
}
thanks in advance
<lightning:button class="slds-button" variant="base" value="{!usr.UserId}" label="{!usr.Username}" onclick="{!c.openuserqueue}" />
User-added image

i want display lightning:helpText along with lable of lighting:input field.
<aura:component>
    <lightning:helptext content="Your Name will be your login name" />
	<lightning:input label="Name" name="myname" required="true"/>
</aura:component>



Thanks in advance
My apex controller method takes enum as paramer, that method will be called from lightning component java script controller,How Can I access Enum in lightning component?
<aura:iteration items="{! v.fields }" var="field">
           
            <div class="slds-size_5-of-12">
                <lightning:input aura:id="idName"   label="{!field.Label}"  required="{!field.DBRequired}"  type="{!field.Type}" class="slds-p-top_small slds-m-top_medium" />
            </div>
             <div class="slds-size_1-of-12"></div>
            </aura:iteration>
and i want  ,whatever i type in input box of firstname,lastname or whatever  the value of that field should be store in attribute of type Contact otherwise i want all the data as Json in lightning component  Js controller  Please help me to solve this...
  • April 25, 2018
  • Like
  • 1
Challenge Not yet complete... here's what's wrong: 
Could not find a custom field on the Account object with the API Name 'Support_Plan_Start_Date__c'.User-added image
I am pretty new at this and trying to create a lightning component so that community users that can't remember their username are able to enter an email address to retrieve their username. If the email they enter matches an existing user account's listed email address it will kick an email to that address with the username of the account. Anyone have anything or knowledge of an open source resource that might have something similar? Thank you!
Hi ,
I have implemented Digital signature using Visualforce pages and java script. It's working good in desktop and Ipad. I am facing problems in android devices. Can some one suggest the possible solution for this OR share thoughts/implementation using Lightning components please ? 

Regards,
Chethan.S.N
Hi ,

I am getting an issue when uploading jquery script file  to get pagination in lightning component.
Issue is  
Uncaught TypeError: Cannot read property 'expando' of undefined throw

 
I am using a lightning:datatable to display various fields, including a URL field which links to a printable PDF.

In the Spring 18 release, the URL field in the datatable now points to "javascript:void(0)" in the href attribute and the title attribute now contains the url which I am trying to set in the href field. 

Can someone please provide me a code example on how to get the href refrecne to work correctly?
Hi All,  

Just had a query, how can I create a custom tab on accounts page like news, related list, details in lightning? Also, how can that be brought in salesforce1 app?  We had creted such custom tabs in the account page b ut those are  visible only in desktop but not in mobile. What am I missing?

Thanks for the response
Hi 

I have scnerio where I need to capture IP address of current User in Lightning Community, is any way standard way  where I can capture IP address inside Lightning Components.
I have seen third party tools like - https://www.ipify.org/ to get Ip address 
Any recommendations are appreciated 

Thanks 
Hi all,

Im currently facing an issue with the "e.force:createRecord" when trying to pre populate some fields from an object to another one. Im using the "defaultFieldValues" and almost every field is populated correctly (Lookup, text,etc) except Currency and Master-Detail.

For your understanding of the issue, when i query the data and show it on the console its shows completly fine ("234" currency field), but at the moment to pre populate it just dont, it keeps the field blank. Also ive tried to: ParseInt, Integer the value, and nothing.
Also, the fuctionallity on Classic mode it working fine, so its not a permision issue (Profile, FLS,etc).

Do you know why is this happenening? Happens to 2 different currency field and also to the master-detail (havent reasearch or even tried anything on this but if you can help also i will appreciate it).

Thanks!!
Hi All,

Getting the below error when i click on quick action containing a lightning component. 
Action failed: forceChatter:lightningComponent$controller$doInit (undefined is not an object (evaluating 'fn-apply')]

quickActionHandlerHelper.js failed to create component - forceChatter:lightningComponent

Let me know what the issue could be.
<aura:component controller="SOWManager_CTL" implements="flexipage:availableForAllPageTypes">

      <aura:attribute name="theaters" type="String[]"/>
      <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
      <form>      
           <div class="header">
               <div style="margin-left:15%;float: left; margin-top:0.5%;" >
                 SOW ID : <ui:outputText aura:id="sowID"  value="{!v.Name}" />
             </div>
             <div style="margin-left:50%;float: left;margin-top:0.5%;">
                 SOW Status : <ui:outputText aura:id="sowStatus"   value="{!v.SOW_Status__c}" />
             </div>
         </div>     
        <lightning:tabset >
        <lightning:tab label="General Info">
             <fieldset class="slds-form--compound" style="margin-left:15%;margin-right:15%">
               <div class="slds-form-element__group">
                <div class="slds-form-element__row">
                  <div class="slds-form-element slds-size--1-of-2">
                      <lightning:select  name="theaterGeo"  label="Theater/Geography" required="true">
                          <option value="" text="Select Theater/Org"></option>
                          <aura:iteration items="{!v.theaters}" var="theater">
                            <option value="{!theater}" text="{!theater}"></option>
                        </aura:iteration>
                    </lightning:select>
                  </div>
                  <div class="slds-form-element slds-size--1-of-2">
    
                   </div>
                </div>
              </div>
            </fieldset>
        </lightning:tab>
 
    </lightning:tabset>

        
       
    </form>
</aura:component>
HI,
I am working on lightning component where I need progress indicator. I am using slds progress indicator but it is not showing css same as shown in the slds guide.
I have used the same code mentioned in the guide.https://www.lightningdesignsystem.com/components/progress-indicator/#flavor-base-default
But still it is not showing connecting line of two button. please find screenshot of issue.User-added image
According to guide image bar should look likeUser-added image

Please help me on the same

Thanks
Shikha
One approach we have tried is having a Lightning Component with a button and adding the component to the specific record page, however this approach makes the UI inconsistent.
Is there a way for one component to reference the functions in another without embedding?

If I have to embed the component, how do I reference there parent function from a  child component and vice versa?
Hi folks, 

I try to complete the "Build a Battle Station App" -> Modify the User Experience. Trail to complete. I checked everything and did it 3 times but every time I get the error:

Challenge Not yet complete... here's what's wrong: 
The 'Resources' related list was not found on the Page Layout 
Note: you may run into errors if you've skipped previous steps.

The Resources Column is in the Page Layout and I add the needed objects. 

Anybody an Idea?
Hi All,
Is there a way to bookmark a question from this forum?
Suppose a come across a question and I want to bookmark that question for future refrence. Can I do that?
Currently I am commenting on the already answered questions as a way to bookmark it.

Thanks,
Sathwick
Hi,
I was going through practice session about constructors but my program keeps on failing

I used the code:
public class TestObject2{
    private static final Integer DEFAULT_SIZE = 10;

    Integer size;

   //Constructor with no arguments
   public TestObject2() {
       this(DEFAULT_SIZE); // Using this(...) calls the one argument constructor    
   }

   // Constructor with one argument 
   public TestObject2(Integer ObjectSize) {
     size = ObjectSize;  
   }
}


and At Execute Anonymous Window Giving:

TestObject2 myObject1 = new TestObject2(42);
TestObject2 myObject2 = new TestObject2();

I am getting an error:

Line: 1, Column: 25
Constructor not defined: [TestObject2].<Constructor>(Integer)

What is wrong here?

When someone takes the time/effort to repspond to your question, you should take the time/effort to either mark the question as "Solved", or post a Follow-Up with addtional information.  

 

That way people with a similar question can find the Solution without having to re-post the same question again and again. And the people who reply to your post know that the issue has been resolved and they can stop working on it.