• nagendra kumar 21
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 13
    Replies
Hi Everyone, 

Does anyone know/working on Field service lightning?
I have to create a real-time POC for my client which I’m working now. 
Could anyone please help if you know about it
 
Hi Everyone, 

I'm bad in coding and new to salesforce, in my team tester got this error while testing some scenario i would like to share here and hoping someone can fix this error for me,
 
Below is the error message  that he got.
 
Apex script unhandled exception by user/organization: 0057A0000016sh1/00D7A0000000Q5l Source organization: 00Dj0000001scFo (null) Visualforce Page: /apex/LogAnInteraction 
caused by: System.ListException: Duplicate id in list: 00vj000000R4iTTAAZ
Class.LogAnInteractionExtension.save: line 198, column 1
 ************
 
public with sharing class LogAnInteractionExtension {
    
    public Task task;
    public string taskId;
    public Set<Id> accContactIds = new Set<Id>();        
    public Set<Id> cmpgnContactIds = new Set<Id>();
    public List<Campaign> relatedCampaigns  {get;set;}
    public Account thisAccount {get;set;}
    public String AccName {get;set;}
    public list<CampaignWrapper> CampaignWrapperList {get;set;}
    private Task currentTaskRecord;
    public Account currentAccountRecord;
    public Contact currentContactRecord;
    public string LeadId;
    public ID accId;
    public Account acc {get;set;}
    Set<Id> selectedIdCamp = new Set<Id>();
    public List<CampaignMember> campMem= new List<CampaignMember>();
    public List<CampaignMember> updateConMem= new List<CampaignMember>(); 
    public static final String DECLINED_CM_STATUS =  'Declined'; 
    public static final String FULFILLED_CM_STATUS = 'Fulfilled';
    private final string Campaign_Activity_RecType  = Label.RT_CampaignActivity;
    public boolean isWater{get;set;}
    @testVisible private boolean testRun{get;set;}
    
    ApexPages.Standardcontroller controller;
    
    String CAMPAIGN_ACTIVITY_RECTYPEID = Schema.SObjectType.Task.getRecordTypeInfosByName().get(Campaign_Activity_RecType).getRecordTypeId();
    
    //Controller
    public LogAnInteractionExtension(ApexPages.StandardController controller) {
        //check to see if profile is water
        isWater = false;
        testRun = false;
        
        String profileName=[Select Id,Name from Profile where Id=:userinfo.getProfileId()].Name;
            for(WaterProfiles__c setting : WaterProfiles__c.getAll().values()){
                if (setting.Profile_Name__c == profileName) {
                    isWater=true;
                } 
            }
        
        this.task = (Task)controller.getRecord(); 
        this.task.Status = 'Completed';
        this.task.ActivityDate = system.today();
        this.task.Interaction_Origin__c = ''; 
        this.task.RecordTypeId = ApexPages.currentPage().getParameters().get('RecordType');
        //System.debug('@@Record Type' + this.task.RecordTypeId);
        this.task.Date_of_Activity__c = date.today();
        this.task.order__c = ApexPages.currentPage().getParameters().get('orderId');
        User u = [Select Id From User Where id = :UserInfo.getUserId()];
        task.OwnerId = u.Id;    
        this.controller = controller;
        
        if(isWater || testRun){
            LeadId = ApexPages.currentPage().getParameters().get('who_id');
            if(!String.isBlank(ApexPages.currentPage().getParameters().get('what_id'))){
                System.debug('ACC' + ApexPages.currentPage().getParameters().get('what_id'));
                this.currentAccountRecord = [Select Id From Account Where Id = :ApexPages.currentPage().getParameters().get('what_id')];
                accId = currentAccountRecord.Id;
            }
            else if(!String.isBlank(ApexPages.currentPage().getParameters().get('who_id')))
            {
                task.whoId = LeadId; 
            }
            
            else{
                
                this.currentContactRecord = [SELECT Id, AccountID from Contact WHERE ID =:ApexPages.currentPage().getParameters().get('who_id')];
                accId = currentContactRecord.AccountID;
            }
            
        }
        else{
            //fetch all the contacts present on the Account
            if(!String.isBlank(ApexPages.currentPage().getParameters().get('what_id'))){
                this.currentAccountRecord = [Select Id From Account Where Id = :ApexPages.currentPage().getParameters().get('what_id')];
                accId = currentAccountRecord.Id;
            }
            else if(!String.isBlank(ApexPages.currentPage().getParameters().get('who_id'))){
                this.currentContactRecord = [SELECT Id, AccountID from Contact WHERE ID =:ApexPages.currentPage().getParameters().get('who_id')];
                accId = currentContactRecord.AccountID;
                task.whoId = ApexPages.currentPage().getParameters().get('who_id');
                
            }
            
        }
        if(accId != null){
            task.WhatId = accId;
        }
        thisAccount = new Account();
        for(Account acc : [select id,Name,Top_200_Ranking__c,(select Id,Name from Contacts )  From Account where id = :accId ])
        {    
            thisAccount  = acc;
            
            for(Contact cnt: acc.contacts){
                accContactIds.add(cnt.Id);
            }
        }
        //fetch all the campaigns related to the Account
    relatedCampaigns = new List<Campaign>();
        getrelatedcampains();
        CampaignWrapperList = new List<CampaignWrapper>(); 
        
        Map<Id, List<SelectOption>> campaignRelatedStatus = new Map<Id, List<SelectOption>>();
        for(CampaignMemberStatus cms : [Select Id, CampaignId, Label From CampaignMemberStatus WHERE CampaignId IN :relatedCampaigns ORDER BY CampaignId]){
            SelectOption option = new SelectOption(cms.Label, cms.Label);
            if(!campaignRelatedStatus.containsKey(cms.CampaignId)){
                campaignRelatedStatus.put(cms.CampaignId, new List<SelectOption>{option});
            }
            else{
                List<SelectOption> existingValues = new List<SelectOption>();
                existingValues = campaignRelatedStatus.get(cms.CampaignId);
                existingValues.add(option);
                campaignRelatedStatus.put(cms.CampaignId,existingValues);
            }   
        }
        
        for(Campaign cmp : relatedCampaigns)
        { 
            for(CampaignMember cmpmem : cmp.CampaignMembers)
            { 
                CampaignWrapperList.add(new CampaignWrapper (cmp, cmpmem.Status, cmpmem.Name, cmpmem, campaignRelatedStatus.get(cmp.Id))); 
            }
        } 
    }
    
    public void getrelatedcampains()
    {
      for(Campaign c : [Select Name, status, StartDate, Type, Id, 
                (Select Name, CampaignId, ContactId, Status, HasResponded, Contact.AccountId
                  from CampaignMembers 
                  where Contact.AccountId  =:accId 
                  and status!=: DECLINED_CM_STATUS 
                  and status!=: FULFILLED_CM_STATUS 
                  ORDER By LastModifiedDate DESC ) 
                  from Campaign where isActive = true ])
                  
      {
        
        relatedCampaigns.add(c);
      }
       
        
    }
    public class CampaignWrapper {
        //Fetch Campaign details
        public Campaign campgn {get; set;}
        public String CampStatus {get; set;} 
        public List<SelectOption> statusValues   {get;set;}
        public String campMemName {get; set;}
        public CampaignMember campgnMember {get; set;}
        //select checkbox
        public Boolean selectCheck  {get;set;}
        public CampaignWrapper(Campaign c, String CampStatus, String campMemName, CampaignMember campgnMember, List<SelectOption> statuses) {
            campgn = c;
            selectCheck= false;
            this.CampStatus = CampStatus; 
            this.campMemName = campMemName;
            this.campgnMember = campgnMember;
            statusValues = statuses;
        }
    }
    
    public PageReference save() {
        
        String selectedcampId  = ''; 
        task.Top_200_Account__c = String.valueOf(thisAccount.Top_200_Ranking__c);
        
        List<Task> newtaskList = new List<Task>();
        Task tempTask;
        if(!CampaignWrapperList.isEmpty()) { 
            for(CampaignWrapper cm : CampaignWrapperList){ 
                
                if(cm.selectCheck == true) {
                    
        tempTask = new Task(Subject = task.Subject,RecordTypeId = CAMPAIGN_ACTIVITY_RECTYPEID,Status =task.Status,
            Top_200_Account__c = task.Top_200_Account__c,Interaction_Origin__c = task.Interaction_Origin__c,
            Activity_Account__c = task.WhatId,Activity_Descriptions__c = task.Activity_Descriptions__c,WhatId = cm.campgn.id, 
            Campaign_Member_Name__c = cm.campMemName , Campaign_Member_Status__c = cm.CampStatus );
        newtaskList.add(tempTask);
                    
                    cm.campgnMember.Status = cm.CampStatus; 
                    system.debug(cm.campgnmember);
                    updateConMem.add(cm.campgnMember);
                }
                if(cm.selectCheck) { 
                    selectedIdCamp.add(cm.campgnMember.Id); 
                    if(selectedcampId =='') 
                        selectedcampId = cm.campgnMember.Id;
                    else { 
                        selectedcampId = selectedcampId + ';'+cm.campgnMember.Id; 
                        
                    } 
                } 
            }
            
            update updateConMem;
            
            string selectcmpIds= selectedcampId ;
            this.task.selectedcampaign__c= selectcmpIds;
        } 
        try{
            if(!newtaskList.isEmpty()){
                insert newtaskList;
            }
            upsert task;
            PageReference pr = new PageReference('/'+task.Id);
            return pr;
            
        }catch(DMLException e){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,Label.Log_An_Interaction_Error));
            SystemLoggingService.log(e);
            
            return null;
            
        }catch(Exception e){
            ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR, e.getMessage());
            ApexPages.addmessage(myMsg);
            
            return null;
        }
        
    }
    public PageReference cancel(){
        PageReference page;
        if( ApexPages.currentPage().getParameters().get('what_id') != null &&
           ApexPages.currentPage().getParameters().get('what_id') ==task.WhatId ){
               page = new PageReference('/'+task.WhatId );
           }
        else{
            page = new PageReference('/'+task.whoId);
            
        }
        page.setRedirect(true);
        return page;
    }
    
    public PageReference saveNew()
    { PageReference pr; 
     try{
         controller.save(); 
         Schema.DescribeSObjectResult describeResult = controller.getRecord().getSObjectType().getDescribe(); 
         //pr = new PageReference('/' + describeResult.getKeyPrefix() + '/e');
         pr = new PageReference('/setup/ui/recordtypeselect.jsp?ent=Task' );
         
         pr.setRedirect(true); return pr; 
     }catch(Exception e)
     {
         ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, e.getMessage())); return null; 
     }//try 
    }//saveNew 
    
    
}

 
Hi Everyone,

Currently we are manually changing/updating custom field values every time we did refresh from production. But we have different values in Production and sandbox, when we refreshed sandbox values are getting Prod values and we are doing manual changes to them. 
To avoid this manual change is there any other way that can be auto update to old values whenever refresh is done??

Note: -  we can do I with Apex scheduler "but we don’t want to go with code" other than Apex please suggest any other flow.
​any suggestions are appreciated 
 
Talent tool for data loader
Hello Everyone,

I recently placed in one firm as Salesforce Consultant and I’m new to Salesforce.
in my company they wanted to implement "Workforce Management" WFM and for that they wanted to purchase Salesforce AppExchange named "Aria".
Can anyone please tell me on 
1. What is Workforce management?
2. For what they will Use this?
3. How can we work in it?
4. Did anyone ever work on Aria WFM?

Any suggestions are appreciated. 


Thanks in Advance, 
Thanks,
​Nagendra
 
Hi Every One, 
I'm trying to add new pick list values on Standard fields "Industry" On Account Object. After adding values and while saving I’m getting "Error: Duplicate Values" but they are new values. can anyone please give let me know how to fix this error?

Thanks in Advance,
​Nagendra
 
Hi Everyone, Here i'm facing an issue while deploying my code to Prodection.
I'm a new Bee to SFDC, and i took forms help and others help i wrote a Test class, When i ran it in Dev Org i'm getting 79% code coverage but when i'm trying to deploy it to production it is showing code coverage was 45% as a Error, I have no clue why it is happening. Below i'm giving you my test code, please can any one check what is going on with my code.

@isTest(SeeAllData = False)
    public With Sharing class Test_AccountSalesviewTriggerHandler{
        
        static testMethod void testAccountSalesview_Create(){
    
            Account acc = CreateTestClassData.createCustomerAccount();
            acc.RecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Water').getRecordTypeId();
            update acc;
            Salesview__c SV = CreateTestClassData.CreateSalesview();
            
            Test.StartTest();            
            List < Account_Salesview__c > lstsalesviewrecords = new List < Account_Salesview__c > ();
            
                for(Integer i=1; i<=10;i++){
                    Account_Salesview__c tempSV = new Account_Salesview__c();
                    tempSV.Name = 'ABC';
                    tempSV.SalesOrg_DistChann_Div_Cust__c = 'idexx123'+i ;                  
                    tempSV.Account__c = acc.Id;
                    tempSV.SalesView__c =  SV.Id;    
                    tempSV.Price_Group__c = 'DD';            
                    lstsalesviewrecords.add(tempSV);
                }
            insert lstsalesviewrecords;
            system.assertequals(acc.name,'Customer Testing Account'); 
            Test.StopTest();
        }
        
        static testMethod void testAccountSalesview_Update(){
    
            Account acc = CreateTestClassData.createCustomerAccount();
            acc.RecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Water').getRecordTypeId();
            update acc;
            Salesview__c SV = CreateTestClassData.CreateSalesview();
            
            Test.StartTest();            
            List < Account_Salesview__c > lstsalesviewrecords = new List < Account_Salesview__c > ();           
            List < Account_Salesview__c > lstsalesviewrecordsupdate = new List < Account_Salesview__c > ();
            
            
                for(Integer i=1; i<=10;i++){
                    Account_Salesview__c tempSV = new Account_Salesview__c();
                    tempSV.Name = 'ABC';
                    tempSV.SalesOrg_DistChann_Div_Cust__c = 'idexx123'+i ;                  
                    tempSV.Account__c = acc.Id;
                    tempSV.SalesView__c =  SV.Id;                   
                    lstsalesviewrecords.add(tempSV);
                }
            insert lstsalesviewrecords; 
            Integer i = 0;
            for (Account_Salesview__c tempSV : lstsalesviewrecords){
                    
                    tempSV.Name = 'ABCD';
                    tempSV.SalesOrg_DistChann_Div_Cust__c = 'idexx1234'+i ;                  
                    tempSV.Account__c = acc.Id;
                    tempSV.SalesView__c =  SV.Id;                   
                    lstsalesviewrecordsupdate.add(tempSV);
                    i++;
                
            }
            update lstsalesviewrecordsupdate;
            system.assertequals(acc.name,'Customer Testing Account'); 
            Test.StopTest();
        }
        
        
        static testMethod void testAccountSalesview_Delete(){
    
            Account acc = CreateTestClassData.createCustomerAccount();
            //Account acc = CreateTestClassData.createCustomerAccount();
            acc.RecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Water').getRecordTypeId();
            update acc;
            
            Salesview__c SV = CreateTestClassData.CreateSalesview();
            
            Test.StartTest();            
            List < Account_Salesview__c > lstsalesviewrecords = new List < Account_Salesview__c > ();
            
                for(Integer i=1; i<=10;i++){
                    Account_Salesview__c tempSV = new Account_Salesview__c();
                    tempSV.Name = 'ABC';
                    tempSV.SalesOrg_DistChann_Div_Cust__c = 'idexx123'+i ;                  
                    tempSV.Account__c = acc.Id;
                    tempSV.SalesView__c =  SV.Id;                   
                    lstsalesviewrecords.add(tempSV);
                }
            insert lstsalesviewrecords; 
            delete lstsalesviewrecords;
            system.assertequals(acc.name,'Customer Testing Account'); 
            Test.StopTest();
        }
    }
Hello Everyone,

I would like to know what should i use update a field on Account object based on chiled objects fields on account.

I Have created a Checkbox field on Account, and it needs to be True if 
account division field is  'xx' and MFD field (checkbox) is 'False' then the fiel on account which i created should be True(check) and they should no longer show up as a 'abc customer' 
, If not false(uncheck)..

Please suggest me how can i do this.. If i need to write a code for this please provide a smaple code for it..
Any suggestions is appriceated.


Thanks,
Nag
Hi All,

I could see Save and Cancel buttons in my VFP. But Save button is not highlighted and it isn't working. I used the same code as above. Please help.
Belowe code i used for this.

https://gist.github.com/Karanraj/6bd1ffc13252b0a22ae0
Hi Everyone,

I'm Up-To-The-Minute to Saleforce.com, Recently i got placed at a top IT company, They assigend me a project name "Voicemail to Case CX".
Can anyone please Brief Me about What is "Voicemail to Case CX"  and is ther any suggestable links,
And i would be appricate if you any could help me in Coding part too.
Hello  Everyone.
Could any one please suggest me how can i translate/Edit  "ERROR"  word on the page??? 
In the provided image you can see that ERROR word in Red color i need to change that to Plosih word.
RED colored Error Word need to be change to POLISH word.
Hi Every One, 
I'm trying to add new pick list values on Standard fields "Industry" On Account Object. After adding values and while saving I’m getting "Error: Duplicate Values" but they are new values. can anyone please give let me know how to fix this error?

Thanks in Advance,
​Nagendra
 
Hi Everyone, 

Does anyone know/working on Field service lightning?
I have to create a real-time POC for my client which I’m working now. 
Could anyone please help if you know about it
 
Hi Everyone, 

I'm bad in coding and new to salesforce, in my team tester got this error while testing some scenario i would like to share here and hoping someone can fix this error for me,
 
Below is the error message  that he got.
 
Apex script unhandled exception by user/organization: 0057A0000016sh1/00D7A0000000Q5l Source organization: 00Dj0000001scFo (null) Visualforce Page: /apex/LogAnInteraction 
caused by: System.ListException: Duplicate id in list: 00vj000000R4iTTAAZ
Class.LogAnInteractionExtension.save: line 198, column 1
 ************
 
public with sharing class LogAnInteractionExtension {
    
    public Task task;
    public string taskId;
    public Set<Id> accContactIds = new Set<Id>();        
    public Set<Id> cmpgnContactIds = new Set<Id>();
    public List<Campaign> relatedCampaigns  {get;set;}
    public Account thisAccount {get;set;}
    public String AccName {get;set;}
    public list<CampaignWrapper> CampaignWrapperList {get;set;}
    private Task currentTaskRecord;
    public Account currentAccountRecord;
    public Contact currentContactRecord;
    public string LeadId;
    public ID accId;
    public Account acc {get;set;}
    Set<Id> selectedIdCamp = new Set<Id>();
    public List<CampaignMember> campMem= new List<CampaignMember>();
    public List<CampaignMember> updateConMem= new List<CampaignMember>(); 
    public static final String DECLINED_CM_STATUS =  'Declined'; 
    public static final String FULFILLED_CM_STATUS = 'Fulfilled';
    private final string Campaign_Activity_RecType  = Label.RT_CampaignActivity;
    public boolean isWater{get;set;}
    @testVisible private boolean testRun{get;set;}
    
    ApexPages.Standardcontroller controller;
    
    String CAMPAIGN_ACTIVITY_RECTYPEID = Schema.SObjectType.Task.getRecordTypeInfosByName().get(Campaign_Activity_RecType).getRecordTypeId();
    
    //Controller
    public LogAnInteractionExtension(ApexPages.StandardController controller) {
        //check to see if profile is water
        isWater = false;
        testRun = false;
        
        String profileName=[Select Id,Name from Profile where Id=:userinfo.getProfileId()].Name;
            for(WaterProfiles__c setting : WaterProfiles__c.getAll().values()){
                if (setting.Profile_Name__c == profileName) {
                    isWater=true;
                } 
            }
        
        this.task = (Task)controller.getRecord(); 
        this.task.Status = 'Completed';
        this.task.ActivityDate = system.today();
        this.task.Interaction_Origin__c = ''; 
        this.task.RecordTypeId = ApexPages.currentPage().getParameters().get('RecordType');
        //System.debug('@@Record Type' + this.task.RecordTypeId);
        this.task.Date_of_Activity__c = date.today();
        this.task.order__c = ApexPages.currentPage().getParameters().get('orderId');
        User u = [Select Id From User Where id = :UserInfo.getUserId()];
        task.OwnerId = u.Id;    
        this.controller = controller;
        
        if(isWater || testRun){
            LeadId = ApexPages.currentPage().getParameters().get('who_id');
            if(!String.isBlank(ApexPages.currentPage().getParameters().get('what_id'))){
                System.debug('ACC' + ApexPages.currentPage().getParameters().get('what_id'));
                this.currentAccountRecord = [Select Id From Account Where Id = :ApexPages.currentPage().getParameters().get('what_id')];
                accId = currentAccountRecord.Id;
            }
            else if(!String.isBlank(ApexPages.currentPage().getParameters().get('who_id')))
            {
                task.whoId = LeadId; 
            }
            
            else{
                
                this.currentContactRecord = [SELECT Id, AccountID from Contact WHERE ID =:ApexPages.currentPage().getParameters().get('who_id')];
                accId = currentContactRecord.AccountID;
            }
            
        }
        else{
            //fetch all the contacts present on the Account
            if(!String.isBlank(ApexPages.currentPage().getParameters().get('what_id'))){
                this.currentAccountRecord = [Select Id From Account Where Id = :ApexPages.currentPage().getParameters().get('what_id')];
                accId = currentAccountRecord.Id;
            }
            else if(!String.isBlank(ApexPages.currentPage().getParameters().get('who_id'))){
                this.currentContactRecord = [SELECT Id, AccountID from Contact WHERE ID =:ApexPages.currentPage().getParameters().get('who_id')];
                accId = currentContactRecord.AccountID;
                task.whoId = ApexPages.currentPage().getParameters().get('who_id');
                
            }
            
        }
        if(accId != null){
            task.WhatId = accId;
        }
        thisAccount = new Account();
        for(Account acc : [select id,Name,Top_200_Ranking__c,(select Id,Name from Contacts )  From Account where id = :accId ])
        {    
            thisAccount  = acc;
            
            for(Contact cnt: acc.contacts){
                accContactIds.add(cnt.Id);
            }
        }
        //fetch all the campaigns related to the Account
    relatedCampaigns = new List<Campaign>();
        getrelatedcampains();
        CampaignWrapperList = new List<CampaignWrapper>(); 
        
        Map<Id, List<SelectOption>> campaignRelatedStatus = new Map<Id, List<SelectOption>>();
        for(CampaignMemberStatus cms : [Select Id, CampaignId, Label From CampaignMemberStatus WHERE CampaignId IN :relatedCampaigns ORDER BY CampaignId]){
            SelectOption option = new SelectOption(cms.Label, cms.Label);
            if(!campaignRelatedStatus.containsKey(cms.CampaignId)){
                campaignRelatedStatus.put(cms.CampaignId, new List<SelectOption>{option});
            }
            else{
                List<SelectOption> existingValues = new List<SelectOption>();
                existingValues = campaignRelatedStatus.get(cms.CampaignId);
                existingValues.add(option);
                campaignRelatedStatus.put(cms.CampaignId,existingValues);
            }   
        }
        
        for(Campaign cmp : relatedCampaigns)
        { 
            for(CampaignMember cmpmem : cmp.CampaignMembers)
            { 
                CampaignWrapperList.add(new CampaignWrapper (cmp, cmpmem.Status, cmpmem.Name, cmpmem, campaignRelatedStatus.get(cmp.Id))); 
            }
        } 
    }
    
    public void getrelatedcampains()
    {
      for(Campaign c : [Select Name, status, StartDate, Type, Id, 
                (Select Name, CampaignId, ContactId, Status, HasResponded, Contact.AccountId
                  from CampaignMembers 
                  where Contact.AccountId  =:accId 
                  and status!=: DECLINED_CM_STATUS 
                  and status!=: FULFILLED_CM_STATUS 
                  ORDER By LastModifiedDate DESC ) 
                  from Campaign where isActive = true ])
                  
      {
        
        relatedCampaigns.add(c);
      }
       
        
    }
    public class CampaignWrapper {
        //Fetch Campaign details
        public Campaign campgn {get; set;}
        public String CampStatus {get; set;} 
        public List<SelectOption> statusValues   {get;set;}
        public String campMemName {get; set;}
        public CampaignMember campgnMember {get; set;}
        //select checkbox
        public Boolean selectCheck  {get;set;}
        public CampaignWrapper(Campaign c, String CampStatus, String campMemName, CampaignMember campgnMember, List<SelectOption> statuses) {
            campgn = c;
            selectCheck= false;
            this.CampStatus = CampStatus; 
            this.campMemName = campMemName;
            this.campgnMember = campgnMember;
            statusValues = statuses;
        }
    }
    
    public PageReference save() {
        
        String selectedcampId  = ''; 
        task.Top_200_Account__c = String.valueOf(thisAccount.Top_200_Ranking__c);
        
        List<Task> newtaskList = new List<Task>();
        Task tempTask;
        if(!CampaignWrapperList.isEmpty()) { 
            for(CampaignWrapper cm : CampaignWrapperList){ 
                
                if(cm.selectCheck == true) {
                    
        tempTask = new Task(Subject = task.Subject,RecordTypeId = CAMPAIGN_ACTIVITY_RECTYPEID,Status =task.Status,
            Top_200_Account__c = task.Top_200_Account__c,Interaction_Origin__c = task.Interaction_Origin__c,
            Activity_Account__c = task.WhatId,Activity_Descriptions__c = task.Activity_Descriptions__c,WhatId = cm.campgn.id, 
            Campaign_Member_Name__c = cm.campMemName , Campaign_Member_Status__c = cm.CampStatus );
        newtaskList.add(tempTask);
                    
                    cm.campgnMember.Status = cm.CampStatus; 
                    system.debug(cm.campgnmember);
                    updateConMem.add(cm.campgnMember);
                }
                if(cm.selectCheck) { 
                    selectedIdCamp.add(cm.campgnMember.Id); 
                    if(selectedcampId =='') 
                        selectedcampId = cm.campgnMember.Id;
                    else { 
                        selectedcampId = selectedcampId + ';'+cm.campgnMember.Id; 
                        
                    } 
                } 
            }
            
            update updateConMem;
            
            string selectcmpIds= selectedcampId ;
            this.task.selectedcampaign__c= selectcmpIds;
        } 
        try{
            if(!newtaskList.isEmpty()){
                insert newtaskList;
            }
            upsert task;
            PageReference pr = new PageReference('/'+task.Id);
            return pr;
            
        }catch(DMLException e){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,Label.Log_An_Interaction_Error));
            SystemLoggingService.log(e);
            
            return null;
            
        }catch(Exception e){
            ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR, e.getMessage());
            ApexPages.addmessage(myMsg);
            
            return null;
        }
        
    }
    public PageReference cancel(){
        PageReference page;
        if( ApexPages.currentPage().getParameters().get('what_id') != null &&
           ApexPages.currentPage().getParameters().get('what_id') ==task.WhatId ){
               page = new PageReference('/'+task.WhatId );
           }
        else{
            page = new PageReference('/'+task.whoId);
            
        }
        page.setRedirect(true);
        return page;
    }
    
    public PageReference saveNew()
    { PageReference pr; 
     try{
         controller.save(); 
         Schema.DescribeSObjectResult describeResult = controller.getRecord().getSObjectType().getDescribe(); 
         //pr = new PageReference('/' + describeResult.getKeyPrefix() + '/e');
         pr = new PageReference('/setup/ui/recordtypeselect.jsp?ent=Task' );
         
         pr.setRedirect(true); return pr; 
     }catch(Exception e)
     {
         ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, e.getMessage())); return null; 
     }//try 
    }//saveNew 
    
    
}

 
Hi Everyone, Here i'm facing an issue while deploying my code to Prodection.
I'm a new Bee to SFDC, and i took forms help and others help i wrote a Test class, When i ran it in Dev Org i'm getting 79% code coverage but when i'm trying to deploy it to production it is showing code coverage was 45% as a Error, I have no clue why it is happening. Below i'm giving you my test code, please can any one check what is going on with my code.

@isTest(SeeAllData = False)
    public With Sharing class Test_AccountSalesviewTriggerHandler{
        
        static testMethod void testAccountSalesview_Create(){
    
            Account acc = CreateTestClassData.createCustomerAccount();
            acc.RecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Water').getRecordTypeId();
            update acc;
            Salesview__c SV = CreateTestClassData.CreateSalesview();
            
            Test.StartTest();            
            List < Account_Salesview__c > lstsalesviewrecords = new List < Account_Salesview__c > ();
            
                for(Integer i=1; i<=10;i++){
                    Account_Salesview__c tempSV = new Account_Salesview__c();
                    tempSV.Name = 'ABC';
                    tempSV.SalesOrg_DistChann_Div_Cust__c = 'idexx123'+i ;                  
                    tempSV.Account__c = acc.Id;
                    tempSV.SalesView__c =  SV.Id;    
                    tempSV.Price_Group__c = 'DD';            
                    lstsalesviewrecords.add(tempSV);
                }
            insert lstsalesviewrecords;
            system.assertequals(acc.name,'Customer Testing Account'); 
            Test.StopTest();
        }
        
        static testMethod void testAccountSalesview_Update(){
    
            Account acc = CreateTestClassData.createCustomerAccount();
            acc.RecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Water').getRecordTypeId();
            update acc;
            Salesview__c SV = CreateTestClassData.CreateSalesview();
            
            Test.StartTest();            
            List < Account_Salesview__c > lstsalesviewrecords = new List < Account_Salesview__c > ();           
            List < Account_Salesview__c > lstsalesviewrecordsupdate = new List < Account_Salesview__c > ();
            
            
                for(Integer i=1; i<=10;i++){
                    Account_Salesview__c tempSV = new Account_Salesview__c();
                    tempSV.Name = 'ABC';
                    tempSV.SalesOrg_DistChann_Div_Cust__c = 'idexx123'+i ;                  
                    tempSV.Account__c = acc.Id;
                    tempSV.SalesView__c =  SV.Id;                   
                    lstsalesviewrecords.add(tempSV);
                }
            insert lstsalesviewrecords; 
            Integer i = 0;
            for (Account_Salesview__c tempSV : lstsalesviewrecords){
                    
                    tempSV.Name = 'ABCD';
                    tempSV.SalesOrg_DistChann_Div_Cust__c = 'idexx1234'+i ;                  
                    tempSV.Account__c = acc.Id;
                    tempSV.SalesView__c =  SV.Id;                   
                    lstsalesviewrecordsupdate.add(tempSV);
                    i++;
                
            }
            update lstsalesviewrecordsupdate;
            system.assertequals(acc.name,'Customer Testing Account'); 
            Test.StopTest();
        }
        
        
        static testMethod void testAccountSalesview_Delete(){
    
            Account acc = CreateTestClassData.createCustomerAccount();
            //Account acc = CreateTestClassData.createCustomerAccount();
            acc.RecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Water').getRecordTypeId();
            update acc;
            
            Salesview__c SV = CreateTestClassData.CreateSalesview();
            
            Test.StartTest();            
            List < Account_Salesview__c > lstsalesviewrecords = new List < Account_Salesview__c > ();
            
                for(Integer i=1; i<=10;i++){
                    Account_Salesview__c tempSV = new Account_Salesview__c();
                    tempSV.Name = 'ABC';
                    tempSV.SalesOrg_DistChann_Div_Cust__c = 'idexx123'+i ;                  
                    tempSV.Account__c = acc.Id;
                    tempSV.SalesView__c =  SV.Id;                   
                    lstsalesviewrecords.add(tempSV);
                }
            insert lstsalesviewrecords; 
            delete lstsalesviewrecords;
            system.assertequals(acc.name,'Customer Testing Account'); 
            Test.StopTest();
        }
    }
Hello Everyone,

I would like to know what should i use update a field on Account object based on chiled objects fields on account.

I Have created a Checkbox field on Account, and it needs to be True if 
account division field is  'xx' and MFD field (checkbox) is 'False' then the fiel on account which i created should be True(check) and they should no longer show up as a 'abc customer' 
, If not false(uncheck)..

Please suggest me how can i do this.. If i need to write a code for this please provide a smaple code for it..
Any suggestions is appriceated.


Thanks,
Nag
Hello,

When i access my visualforce page, i get lops is developer console.
since two days i find it difficult to get logs.

I am opening in same session.

Any idea what i can do ?
Hi All,

I could see Save and Cancel buttons in my VFP. But Save button is not highlighted and it isn't working. I used the same code as above. Please help.
Belowe code i used for this.

https://gist.github.com/Karanraj/6bd1ffc13252b0a22ae0
Hello  Everyone.
Could any one please suggest me how can i translate/Edit  "ERROR"  word on the page??? 
In the provided image you can see that ERROR word in Red color i need to change that to Plosih word.
RED colored Error Word need to be change to POLISH word.
I would like to create a custom visualforce page for creating a new task. Scenario: user clicks a button on the Activities related list on the parent object. That button launches a VF force page with both standard fields and custom fields for the Task. User populates those fields, then clicks Save. 

I've tried all sorts of things hobbled together from research online, but so far, no luck. 

(I'm a newbie at VF and apex)

Here's my current VF Page code:

<apex:page standardController="Task" extensions="extension_task">
<apex:form >
<apex:pageBlock mode="edit">
<apex:pageblockButtons >
<apex:commandButton value="Save" action="{!save}" />
</apex:pageblockButtons>
        <apex:pageBlockSection title="Quick Edits" columns="1">
            <apex:inputField value="{!Task.Whatid}"/>
            <apex:inputField value="{!Task.Subject}"/>
            <apex:inputField value="{!Task.Representative__c}"/>
            <apex:inputField value="{!Task.Category__c}"/>
            <apex:inputField value="{!Task.Comments__c}" style="width:400px; height:200px"/>
            <apex:inputField value="{!Task.Perceived_Call_Value__c}"/>
            <apex:inputField value="{!Task.Referred_To__c}"/>
            <apex:inputField value="{!Task.Interaction__c}"/>
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:form>

</apex:page>


Here's the apex class extension:

public class extension_task{

    Task task = new Task();
   
    public extension_task(ApexPages.StandardController controller) {
      this.task = (Task)controller.getRecord();  
    }

}

**************************
I think a problem is that Task cannot be used as a StandardController. I tried setting the StandardController="ACA_Member__c", but that gives me an error (Error: Unknown property 'ACA_Member__cStandardController.Task'). It seems I should be able to use my custom object with standardController based on this page (http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_std_associate.htm).

Thanks any advance for any help!