• Preya Vaishnavi
  • NEWBIE
  • 135 Points
  • Member since 2012

  • Chatter
    Feed
  • 4
    Best Answers
  • 0
    Likes Received
  • 2
    Likes Given
  • 9
    Questions
  • 42
    Replies
Hi,

Please can someone help with rectifying the error- surely I am missing something? Managed to create this formula to make fields required if certian picklist values are selected, but for some reasons it is not working.. (able to save the record without a value in required fields). Not sure if it is beacuse of type of fields as mentioned below in comments. 

AND( 
OR( 
ISPICKVAL(Contact_Status__c, "Unqualified / Inactive"), 
ISPICKVAL(Contact_Status__c,"Qualified & Actively looking"), 
ISPICKVAL(Contact_Status__c, "Passive C"), 
ISPICKVAL(Contact_Status__c,"Placed By Us"), 
ISPICKVAL(Contact_Status__c, "Contracting For Us")), 

AND ( 
ISBLANK(User_Group__c), [is a multi-picklist]
ISBLANK(TEXT(Domain__c)), [is a picklist] 
ISBLANK(TEXT(Industry__c)), [is a picklist] 
ISBLANK(Technology_Skills__c)))  [is a multi-picklist]

Would really appreciate your help here.

Thanks in advance.

Swapnil
 
Hi,

Need help in writing Test Class for the below Apex Class which use AggregateResult.
Apex Code:
 
global class AccountProcessor {
    
    @future
    public static void countContacts(List<Id> AccntIds)
    {
        List<Account> list_of_Account = [select Id,sompaul__Number_of_Contacts__c from Account where Id IN: AccntIds];
        system.debug('List of accounts'+list_of_Account);
        List<Account> accountToBeUpdated = new List<Account>();
        Integer Contact_cnt=0;
        //Map<Id,Decimal> = new Map<Id,Decimal>();
        List<AggregateResult> agrRes = [select count(Id),Contact.Account.Id from Contact,Contact.Account where Contact.Account.Id IN : AccntIds group by Contact.Account.Id];
        system.debug('AggregateResult value:'+agrRes);
        
        for(AggregateResult ar: agrRes)
        {
            
            for(Account a:list_of_Account)
            {
                if(a.Id == ar.get('Id'))
                {
                    a.sompaul__Number_of_Contacts__c = (Decimal)ar.get('expr0');
                    accountToBeUpdated.add(a);
                }
            }
            system.debug('Account Data to be updtaed'+accountToBeUpdated);
            
        }
        if(!accountToBeUpdated.isEmpty())
        {
            update accountToBeUpdated;
        }
        
    }
}

Test Class for the above:
@IsTest
private class AccountProcessorTest {
    
    private static testMethod void testAccountProcessor()
    {
        List<Id> accntList = new List<Id>();
        accntList = createAccount();
        Test.startTest();
        AccountProcessor.countContacts(accntList);
        Test.stopTest();
    }
    private static List<Id> createAccount()
    {
        List<Id> accntList = new List<Id>();
        for(Integer i=0;i<10;i++)
        {
            Account a = new Account(Name='Test Account'+i);
            for(Integer j=0;j<5;j++)
            {
                Contact con = new Contact(LastName ='Test Contact'+j,AccountId=a.Id);
            }
            accntList.add(a.Id);
        }
        return accntList;
    }

}

Code Coverage: 50%. Below strike through codes do not fall under test coverage.

global class AccountProcessor {
    
    @future
    public static void countContacts(List<Id> AccntIds)
    {
        List<Account> list_of_Account = [select Id,sompaul__Number_of_Contacts__c from Account where Id IN: AccntIds];
        system.debug('List of accounts'+list_of_Account);
        List<Account> accountToBeUpdated = new List<Account>();
        Integer Contact_cnt=0;
        //Map<Id,Decimal> = new Map<Id,Decimal>();
        List<AggregateResult> agrRes = [select count(Id),Contact.Account.Id from Contact,Contact.Account where Contact.Account.Id IN : AccntIds group by Contact.Account.Id];
        system.debug('AggregateResult value:'+agrRes);
        
        for(AggregateResult ar: agrRes)
        {
            
            for(Account a:list_of_Account)
            {
                if(a.Id == ar.get('Id'))
                {
                    a.sompaul__Number_of_Contacts__c = (Decimal)ar.get('expr0');
                    accountToBeUpdated.add(a);
                }
            }

            system.debug('Account Data to be updtaed'+accountToBeUpdated);
            
        }
        if(!accountToBeUpdated.isEmpty())
        {
            update accountToBeUpdated;
        }
        
    }
}

Can somebody please help here.
Thanks in advance !!
Hi
I have a checkbox in case. When I checked this checkbox, I want to automatically close the case after one day.
Please suggest me how to do it?
I tried using new task, but it is not working.

Thanks in Advance

Regards
Hari

Hi all,

 

I need to export 10000 records on clicking a custom button on VF page.On clicking the custom button on VF page it redirects to another vf page for which the content type is excel format.I am now facing the problem of hitting the  view state size limit (135KB) .I have even included readonly="true" in my both VF pages but that doesnt solve my problem.Even declaring the variable as transient doesnot solve my problem.Let me know if you have faced the issue and the ways you have tried to avoid it.

 

Note:I have used pageblock table on my VF page for excel export.Even using html tags doesnt solve my problem

 

Any suggestions on this is highly appreciated.

 

Thanks in advance!!!!

 

 

Hi all,

 

I need to retrieve the email addresss of the recepients of the mails that are sent through the targetobjectid (contact or user's email) by using messaging.sendemail method... Is that possible?I am using messaging.singleemailmessage and the target objectid to configure the recepient's email address.Any pointers could help me.. Thanks in advance!!!!

 

 

Hi,

 

I need to display values from different objects in a table.And these objects have no relationship between them directly.So i went for wrapper classes.But how to use a wrapper class for displaying values from different object in the visualforce page?

 

for eg: i need to display accounts in the account name column and the related contacts' name,phone,email in the contact name ,phone,email columns respectively in a table.

 

Any code that is already developed would be handy .....

 

Thanks

Hello all,

 

We have a requirement to make our visualforce page work both for old console and new service cloud console in salesforce.But some functions is not working in our page.We have overriddent view with our visualforce page.So hyperlinks,and the frames in which the related lists will load is not loading in old console..In our new console we have this new problem that if i add an attachment to the case or delete an attachment from the case,the case detail page suddenly gets disappeared.But the attachment is added.(We have done page redirections by overriding view page)

 

Googled a lot for this stuff.Only found few posts related to this.Please help..

 

i found only this line in salesforce doc

 

Visualforce page might not display correctly in a Service Cloud console unless they're updated to show in it.

 

What should we do to update a visualforce page to display correctly in service cloud console

 

Your help is much appreciated

 

Thanks!!!!!!!!!

I have a Visualforce page which displays a case record and allows inline editing. When I make an inline edit that triggers a validation error, the page returns to a non-editing state and displays the error message (with all the buttons edit,delete,clone). The main problem here is that the non-editing state shows that the changes have been made when in fact they are not. I need the page to stay in inline edit mode so the user understands that the changes have not taken place, and can correct the issue.

 

Any pointers for the above problem would be very helpful...

 

Has somebody faced the same problem above and have found any solution to this?

 

 

Hi, 

 

  we have a requirement in our project for which we have to override new , edit, view buttons on the case standard object .After overriding ,when i edit the cases , Performance of my system is slow(CPU Usage) is very high during case editing time -peaks to about 75% max. Is this a expected behaviour when we override std buttons or do we need to optimise the code in any way??? Any help around this would be helpful. 

 

Hi all,

 

There are 3 dependent fields test1,test2,test3,

 

test3 is dependent upon test2

test2 is dependent upon test1

 

test3 may or may not have a value...

 

Now i need to check in my apex class...whether test3 has any value for a particular value of test2

 

for eg: test2='value1' for this value of test2....test3 does not have any value... I need to check this without seeing the value of test3...

 

Is it possible...?

 

Thanks Much!!!!!!!!!!!!!


Hi ,

 

  We tried to bring inline editing in visualforce pages using apex:inlineeditsupport tag .

 

Inline edit is working on fields but buttons are not visible (Save , Save&New , Cancel) on the top .

 

we gave id's of showonedit and hideonedit attribute in Apex:inlineeditsupport tag but stilll save button is not visible.

 

Is there a way to make a boolean true while inline edit using any attribute , so that the boolean can be used in the render condition of the save button inorder to make it visible .

 

Any help around this would be helpful ..

 

Note: we have overrided edit button

 

 

Hi All,i have overridden edit button for a particular requirement such that if i edit a record of a particular record type it should get directed to visual force page else it  should be directed to standard page.But when i direct to a standard page the inline editing gets disabled for the standard page.Please provide some solution.

 

The second one is on overriding edit button the  security of the profiles also gets overridden.... which will lead to security issues

 

 

Guys Any pointers on this ???

//@author : Anjum Attar
//Creation Date :
//Modification History :
public with sharing class EmailOppInvoice {
    public Opportunity oppRecord{get;set;}
    public String id{get;set;}
    public String eSubject{get;set;}
    public String eBody{get;set;}
    //public  Contact objcon = new Contact();
    
    public EmailOppInvoice(ApexPages.StandardController controller) {
        oppRecord = (Opportunity)controller.getRecord();
        id = oppRecord.id;
        oppRecord = [Select Id,Name,Email__c,Account.Id From Opportunity Where Id =: id];
        eSubject ='';
        eBody = '';
    }
    
    public EmailOppInvoice() {
    }
    
    public pageReference SendEmail() {
       Messaging.singleEmailMessage email = new Messaging.singleEmailMessage();
       PageReference pdfExample = new pagereference('/apex/OpportunityInvoice?id='+id);  
       pdfExample.setRedirect(true);
        
        Blob content = pdfExample.getContent();
        Messaging.emailFileAttachment fileAttachment = new Messaging.emailFileAttachment();
        fileAttachment.setFileName('Invoice.pdf');
        fileAttachment.setBody(content);
        String[] eAddress = new List<String>();
        try {
            eAddress.add(oppRecord.Email__c);
            email.setSubject(eSubject);
            email.setPlainTextBody(eBody);
            email.setToAddresses(eAddress);
            email.setFileAttachments(new Messaging.EmailFileAttachment[] {fileAttachment});
            Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});
            return null;
        }
        catch(Exception e) {
             ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Email Field of Account does not contain any value'));
        }
        return null;
    }
}
I saw TONS of errors like this in the web, most of them are related to double underscore (__).
I double and triple checked and i have no idea what am i missing, will appreicate if someone can assist.

Obviously, the API name of these fields are similiar - Can someone please point me what am I missing? 

Edit | Del Internal SummaryInternal_Summary__c Long Text Area(32768)  Tal Tsror, 10/6/2016 12:03 PM
Edit | Del Internal Summary HistoryInternal_Summary_History__c Long Text Area(32768)  Tal Tsror, 10/10/2016 3:41 PM

error
Please find below code:
public class MyController {
        private final Account account;
               public MyController() {
                   account = [SELECT Id, Name, Site FROM Account
                   WHERE Id = :ApexPages.currentPage().getParameters().get('id')];
               }
        public Account getAccount() {
               return account;
        }
        
        public PageReference save() {
               update account;
               return null;
        }
   }

In above example is it possible to change the method name "save"?  I am new to the visualforce. Any help would be really appreciable.

Thank you..
Hi Guys,

I'm facing issue is dynamic soql query values wrote from one method. this concept implement everything in controller that controller using wrapper class. 

my scenario is Datefilters concept ,if user gives from date and/or  todate values in page.based on date the table of information is filterd.

Now i'm getting null point argument in displaydetails method. please guide me if you have any idea about wrapper class in SFDC
Before filter Displaying Table :

User-added image

after filter displaying Table::

User-added image
<code>

public class AccountHandler{
    
public static Account insertNewAccount (String accName){ 

   if(accName!=''){    
       try{
           Account a = new Account(Name=accName);
           insert a;
           System.debug('Bravo User5633! Account created');
           return a;
       } catch(Exception e){
           System.Debug('Account not created');
           return null;
       }
   } else {
       return null;
   }
}
}    

</code>    

Challenge Not yet complete... here's what's wrong: 
Executing the 'insertNewAccount' method failed. Either the method does not exist, is not static, or does not insert the proper account.
Hi All,

I have requirement I need to create Funnel Dashboard using Visualforce page chart,I am not able to find any Funnel type component in Visualforce chart,can any one help me how to implement funnel visualforce  Chart in salesforce,
(With out creating report directly i have to implement Funnel type Dashboard in Visualforce Chart)

Thanks for your inputs.
  • October 06, 2016
  • Like
  • 0
<apex:page standardController="Employee__c" extensions="Chbox_ShowHide_Controller">

  <apex:form >
      <apex:pageBlock id="cpBlock" rendered="true" >
      <apex:pageBlockButtons >
          <apex:commandButton value="save" action="{!save}"/>
           <apex:commandButton value="Cancel" action="{!cancel}"/>
      </apex:pageBlockButtons>
      
          <apex:pageBlockSection title="Personal Details" id="Block">
              <apex:inputField value="{!Employee__c.First_Name__c}"/>
              <apex:inputField value="{!Employee__c.Last_Name__c}"/>
              <apex:inputField value="{!Employee__c.DOB__c}"/>
              <apex:inputField value="{!Employee__c.Email__c}"/>
              <apex:inputField value="{!Employee__c.Address__c}"/>
          </apex:pageBlockSection>
               <apex:outputText value="Employed"/>
          <apex:inputCheckbox id="val" value="{!optSelected}" label="Employed"> 
                   <apex:actionSupport event="onchange" reRender="cpBlock" action="{!display}"/>
                </apex:inputCheckbox> 
         
                
            <apex:outputPanel id="r" rendered="{!optSelected }">
            <apex:pageBlockSection title="Employment Details" rendered="{!if(ShowHide==true,true,false)}">
              <apex:inputField value="{!Employee__c.Company_Name__c}"/>
              <apex:inputField value="{!Employee__c.Company_Address__c}"/>
              <apex:inputField value="{!Employee__c.Date_of_Joining__c}"/>
              <apex:inputField value="{!Employee__c.Notice_Period__c}"/>
              <apex:inputField value="{!Employee__c.Designation__c}"/>
              <apex:inputField value="{!Employee__c.Department__c}"/>
          </apex:pageBlockSection>
          </apex:outputPanel>
         
          <apex:outputPanel id="re">
           {!showHide}
          <apex:pageBlockSection title="Skill Sets" rendered="{!if(ShowHide==false,true,false)}">
              <apex:inputField value="{!Employee__c.Graduation__c}"/>
              <apex:inputField value="{!Employee__c.Post_Graduation__c}"/>
              <apex:inputField value="{!Employee__c.University__c}"/>
              <apex:inputField value="{!Employee__c.College_Name__c}"/>
              <apex:inputField value="{!Employee__c.Programming_Languages__c}"/>
          </apex:pageBlockSection>
          </apex:outputPanel>
      </apex:pageBlock>
  </apex:form>
</apex:page>

after saving record it do not get saved.
Essentially if the product name is UH I want the plan package name to be set using Ultimate Health a space and the field armada plan package name. 

trigger PlanPackageNames on Plan__c (Before Insert) {
for (Plan__c Plan__c : Trigger.new)
{
IF(Plan__c.Product_Name__c=='UH')
{
Plan__c.Name='Ultimate Health'+' '+Plan__c.Armada_Plan_Package_Name__c;
            }
    }
    
}
Hi,
I want to know what is the best way to compare two set <id>
 Set <id> a = new Set<id>();   
 Set <id> b = new Set<id>();  
Set <id> accToDeactivate = new Set<id>();    

I want to know if the any of the Ids on  are on b, if the are not I want add those ids to another set
I tried this code but is not working, it is getting me all the id on b.
 If
for(Id objId: b){
            if(a.contains(objId)) {
//do nothing 
           }else{
 accToDeactivate.add(objId);
            }
      }
Hi All,

A batch apex is called from trigger.If I import records through dataloader do the trigger calls the apex 100 times.How do we handle this situation.I heard that while importing data through dataloader trigger should be deactivated.Is it the accurate solution.
Thanks
Hi guys,
I have 1 scenario using workflow i need to update 1 field based on some criteria and using Trigger i need to update same object and same field how can i achieve this can anyone help me out.if possible send me code.
Thanks in Advance
Actually, I need a trigger on Email Message Object  that checks Whether the Email Message Object Headers (Email Message Field) String Contains the Email Services Address  String in it So how can I get the String  Email Services Address  at Email-to-case page in my Trigger
 
Can we call one batch apex from another batch apex?

Thanks
Hi,

Please can someone help with rectifying the error- surely I am missing something? Managed to create this formula to make fields required if certian picklist values are selected, but for some reasons it is not working.. (able to save the record without a value in required fields). Not sure if it is beacuse of type of fields as mentioned below in comments. 

AND( 
OR( 
ISPICKVAL(Contact_Status__c, "Unqualified / Inactive"), 
ISPICKVAL(Contact_Status__c,"Qualified & Actively looking"), 
ISPICKVAL(Contact_Status__c, "Passive C"), 
ISPICKVAL(Contact_Status__c,"Placed By Us"), 
ISPICKVAL(Contact_Status__c, "Contracting For Us")), 

AND ( 
ISBLANK(User_Group__c), [is a multi-picklist]
ISBLANK(TEXT(Domain__c)), [is a picklist] 
ISBLANK(TEXT(Industry__c)), [is a picklist] 
ISBLANK(Technology_Skills__c)))  [is a multi-picklist]

Would really appreciate your help here.

Thanks in advance.

Swapnil
 
Hi,

Need help in writing Test Class for the below Apex Class which use AggregateResult.
Apex Code:
 
global class AccountProcessor {
    
    @future
    public static void countContacts(List<Id> AccntIds)
    {
        List<Account> list_of_Account = [select Id,sompaul__Number_of_Contacts__c from Account where Id IN: AccntIds];
        system.debug('List of accounts'+list_of_Account);
        List<Account> accountToBeUpdated = new List<Account>();
        Integer Contact_cnt=0;
        //Map<Id,Decimal> = new Map<Id,Decimal>();
        List<AggregateResult> agrRes = [select count(Id),Contact.Account.Id from Contact,Contact.Account where Contact.Account.Id IN : AccntIds group by Contact.Account.Id];
        system.debug('AggregateResult value:'+agrRes);
        
        for(AggregateResult ar: agrRes)
        {
            
            for(Account a:list_of_Account)
            {
                if(a.Id == ar.get('Id'))
                {
                    a.sompaul__Number_of_Contacts__c = (Decimal)ar.get('expr0');
                    accountToBeUpdated.add(a);
                }
            }
            system.debug('Account Data to be updtaed'+accountToBeUpdated);
            
        }
        if(!accountToBeUpdated.isEmpty())
        {
            update accountToBeUpdated;
        }
        
    }
}

Test Class for the above:
@IsTest
private class AccountProcessorTest {
    
    private static testMethod void testAccountProcessor()
    {
        List<Id> accntList = new List<Id>();
        accntList = createAccount();
        Test.startTest();
        AccountProcessor.countContacts(accntList);
        Test.stopTest();
    }
    private static List<Id> createAccount()
    {
        List<Id> accntList = new List<Id>();
        for(Integer i=0;i<10;i++)
        {
            Account a = new Account(Name='Test Account'+i);
            for(Integer j=0;j<5;j++)
            {
                Contact con = new Contact(LastName ='Test Contact'+j,AccountId=a.Id);
            }
            accntList.add(a.Id);
        }
        return accntList;
    }

}

Code Coverage: 50%. Below strike through codes do not fall under test coverage.

global class AccountProcessor {
    
    @future
    public static void countContacts(List<Id> AccntIds)
    {
        List<Account> list_of_Account = [select Id,sompaul__Number_of_Contacts__c from Account where Id IN: AccntIds];
        system.debug('List of accounts'+list_of_Account);
        List<Account> accountToBeUpdated = new List<Account>();
        Integer Contact_cnt=0;
        //Map<Id,Decimal> = new Map<Id,Decimal>();
        List<AggregateResult> agrRes = [select count(Id),Contact.Account.Id from Contact,Contact.Account where Contact.Account.Id IN : AccntIds group by Contact.Account.Id];
        system.debug('AggregateResult value:'+agrRes);
        
        for(AggregateResult ar: agrRes)
        {
            
            for(Account a:list_of_Account)
            {
                if(a.Id == ar.get('Id'))
                {
                    a.sompaul__Number_of_Contacts__c = (Decimal)ar.get('expr0');
                    accountToBeUpdated.add(a);
                }
            }

            system.debug('Account Data to be updtaed'+accountToBeUpdated);
            
        }
        if(!accountToBeUpdated.isEmpty())
        {
            update accountToBeUpdated;
        }
        
    }
}

Can somebody please help here.
Thanks in advance !!
Hi,

I added a custom list button say  "Custom Message Button" to a custom object. This button displays a simple alert message.
This being a list button it gets displayed in the related list section when viewing another related object.

This button displays in its tooltip "Custom Message Button". I want to change this while retaining the label for the button. Basically I only want to change the tooltip information.

Is it possible ? I do not want to create a new VF page just to view a different tooltip !
I want to continue to use the default SF page for the object which displays the related list.

Thanks