• karthic sankar 9
  • NEWBIE
  • 85 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 38
    Questions
  • 40
    Replies
I have requirement, when a contact is converted as an external user, page displays two profiles to select for the user like below. But I want  it to default to only one profile, how can i achieve this? User-added image
HI Team,

Please let me how to get rid of this error,

My Controller method.

public void Init()
    {
        System.debug('Test method called');
         strText = ApexPages.currentPage().getParameters().get('str');
        //strText1 = ApexPages.currentPage().getParameters().get('str1');
        System.debug(strText);
        list<String> strTextVal = strText.split(',');
        System.debug(strTextVal[0]);
        System.debug(strTextVal[1]);
        queryData = [select RadioFeild__c, During_Week_Availability__c,Status__c,Reason_Comments__c,Reason_comments_for_Recent_Rejection__c, During_Week_OtherWorkFile__c, During_Week_OtherWorkEst__c,During_Week_FileSelection__c,During_Week__c,During_Week_Debreifs__c,During_Week_Core__c, Reason_Rejection__c, Other3_core__c, Total_Total_time__c, CommentsAvailability__c, Other1Title__c, Other2Title__c, Picklist__c, Date_QAAM__c, Week_Start_Date__c,
                                                  Availability__c, ReasonAvailability__c, Work_Hours__c, Pre_Vet_Reviews__c, BAU_File_Reviews__c, Debriefs__c,
                                                  File_Selection__c, Other_work__c, Other_work_Estimate__c, Total_Work_Time__c, Team_Meeting__c, Huddle__c, 
                                                  Quarterly_Updates__c, Governance_Forums__c, Performance_Reviews__c, Tea_Breaks__c, CPD_e_Learning_Maintenance__c, 
                                                  Coaching__c, PD_Days__c, One_on_Ones__c, Weekly_Tracker_preparation__c, Business_Communications__c, 
                                                  Other__c, Other1__c, Other2__c, Project_Time__c, Other_Time__c, Project_Time_Description__c, 
                                                  Other_Time_Description__c, Shrinkage_time__c, Available_Time__c, Availability_Checking__c, id, Week__C 
                                                  from QAAM_Weekly_Planner__c where Week__C =: strTextVal[0] and CreatedBy.Name =:strTextVal[1]];
        list<String> weekDataStatic = new list<String>{'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'};
            integer i=0;
            
}

My test class

 static testmethod void Init()
    {
        a init = new a();
        init.strText = 'abc,abc';

        init.queryData = [select CommentsAvailability__c, Other1Title__c, Other2Title__c, Picklist__c, 
                                                  Date_QAAM__c, Week_Start_Date__c, Availability__c, ReasonAvailability__c, 
                                                  Work_Hours__c, Pre_Vet_Reviews__c, BAU_File_Reviews__c, Debriefs__c, File_Selection__c,
                                                  Other_work__c, Other_work_Estimate__c, Total_Work_Time__c, Team_Meeting__c, Huddle__c,
                                                  Quarterly_Updates__c, Governance_Forums__c, Performance_Reviews__c, Tea_Breaks__c, 
                                                  CPD_e_Learning_Maintenance__c, Coaching__c, PD_Days__c, One_on_Ones__c, 
                                                  Weekly_Tracker_preparation__c, Business_Communications__c, Other__c, Other1__c, 
                                                  Other2__c, Project_Time__c, Other_Time__c, Project_Time_Description__c, 
                                                  Other_Time_Description__c, Shrinkage_time__c, Available_Time__c, 
                                                  Availability_Checking__c, id, Week__C from QAAM_Weekly_Planner__c];

test.startTest();
        init.Init();
        test.stopTest();

}

Error:
System.NullPointerException: Attempt to de-reference a null object
Hi All,

I have a crazy question here, please help.

On every thursday, I need to send an email to users whose role is A if they havent saved a record. I can send this on thursday morning.

This record can be identified using picklist, or date feild.

Kindly help.

 
Kindly let me what mistake I am making in below SOQL?

select Week__c from cutomobject where OwnerId = userinfo.getUserId()

select Week__c, max(createddate),max(Name) Submittername from cutomObject where OwnerId = :userinfo.getUserId() group by Week__c order by max(createddate) desc LIMIT 10
Hi All,

Please let me whom i need to contact to delete all the questions I have posted. I wanted to do it for some unwanted reason.

Regards
Karthic

Hi Guys,

I have a VF page, which loads the value when its opened based on SOQL query output.

When user modifies the input value, it should update on the same record whereas its not heppening for me.

Below is my code, and its very urgent. Can someone pls help me? as I am new to this development, I am struggling.

Controller:
public class EditQAAMController {
 Double MondayPrevet{get; set;}
    public Double EmpMap_Monday { get
    {
    return EmpMap.get('Monday');    
    }
    set
    {
        this.MondayPrevet = EmpMap_Monday;
    }
      }

public map<String,Double> EmpMap = new map<String, Double>();

 public EditQAAMController()
    {
         strText = ApexPages.currentPage().getParameters().get('str');
        System.debug(strText);
    }
    
    list<QAAM_Weekly_Planner__c> queryData;
    public void init()
    {
        queryData = [select CommentsAvailability__c, Other1Title__c, Other2Title__c, Picklist__c, Date_QAAM__c, Week_Start_Date__c,
                                                  Availability__c, ReasonAvailability__c, Work_Hours__c, Pre_Vet_Reviews__c, BAU_File_Reviews__c, Debriefs__c,
                                                  File_Selection__c, Other_work__c, Other_work_Estimate__c, Total_Work_Time__c, Team_Meeting__c, Huddle__c, 
                                                  Quarterly_Updates__c, Governance_Forums__c, Performance_Reviews__c, Tea_Breaks__c, CPD_e_Learning_Maintenance__c, 
                                                  Coaching__c, PD_Days__c, One_on_Ones__c, Weekly_Tracker_preparation__c, Business_Communications__c, 
                                                  Other__c, Other1__c, Other2__c, Project_Time__c, Other_Time__c, Project_Time_Description__c, 
                                                  Other_Time_Description__c, Shrinkage_time__c, Available_Time__c, Availability_Checking__c, id, Week__C 
                                                  from QAAM_Weekly_Planner__c where Week__C =: strText];
        list<String> weekDataStatic = new list<String>{'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'};
            integer i=0;
        for(QAAM_Weekly_Planner__c q : queryData)
        {
            dateInput = q.Week_Start_Date__c;
            EmpMap.put(weekDataStatic[i], q.Pre_Vet_Reviews__c);

}

/////This below method is called while doing the save action

 public void saveButton() {
         List<QAAM_Weekly_Planner__c> updateWeekValuetotal = new List<QAAM_Weekly_Planner__c>(); 
        for(QAAM_Weekly_Planner__c q : queryData)
        {
            q.Week_Start_Date__c = q.Week_Start_Date__c;
            System.debug('The value from UI is: ' +MondayPrevet); 
           q.Pre_Vet_Reviews__c = MondayPrevet;
            updateWeekValuetotal.add(q);
        }
        update updateWeekValuetotal;
    }

}

 

HI Everyone.

Controller

public class ViewQAAMController {
public ViewQAAMController()
    {
String weekData = '20/07/2020 - 24/07/2020';
        list<String> lstSplitDate1 = new list<String>();
        lstSplitDate1.clear();
        lstSplitDate1 = weekData.split(' - ');
        strText = ApexPages.currentPage().getParameters().get('str');
        System.debug('inside method '+ApexPages.currentPage().getParameters().get('weekValue'));
        System.debug('inside method value '+test);
        System.debug('inside method value for strText'+strText);
        
        //for(String s : lstSplitDate1)
        //{
            //System.debug('The date is '+s);
        //}
        
        list<QAAM_Weekly_Planner__c> queryData = [select CommentsAvailability__c, Other1Title__c, Other2Title__c, Picklist__c, Date_QAAM__c, Week_Start_Date__c, Availability__c, ReasonAvailability__c, Work_Hours__c, Pre_Vet_Reviews__c, BAU_File_Reviews__c, Debriefs__c, File_Selection__c, Other_work__c, Other_work_Estimate__c, Total_Work_Time__c, Team_Meeting__c, Huddle__c, Quarterly_Updates__c, Governance_Forums__c, Performance_Reviews__c, Tea_Breaks__c, CPD_e_Learning_Maintenance__c, Coaching__c, PD_Days__c, One_on_Ones__c, Weekly_Tracker_preparation__c, Business_Communications__c, Other__c, Other1__c, Other2__c, Project_Time__c, Other_Time__c, Project_Time_Description__c, Other_Time_Description__c, Shrinkage_time__c, Available_Time__c, Availability_Checking__c, id, Week__C from QAAM_Weekly_Planner__c where Week__C =: strText];
        System.debug('The query value is: '+queryData);
        list<String> weekDataStatic = new list<String>{'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'};
            integer i=0;
        for(QAAM_Weekly_Planner__c q : queryData)
        {
             dateValues = q.Week_Start_Date__c;
            AvailabilityMap.put(weekDataStatic[i], q.Availability__c);

}

}


Please help me in wriritng a testclass guys. I am fully stuck up.

Regards
Karthic Sankar V P
Please help to resolve my error.


Line: 772, Column: 1
System.LimitException: Too many SOQL queries: 101

My method

public class ViewQAAMController {

public void queryOperation()
    {
        String weekData = '20/07/2020 - 24/07/2020';
        list<String> lstSplitDate1 = new list<String>();
        lstSplitDate1.clear();
        lstSplitDate1 = weekData.split(' - ');
        for(String s : lstSplitDate1)
        {
            System.debug('The date is '+s);
        }
        
        list<QAAM_Weekly_Planner__c> queryData = [select Week_Start_Date__c, Availability__c, ReasonAvailability__c, Work_Hours__c, Pre_Vet_Reviews__c, BAU_File_Reviews__c, Debriefs__c, File_Selection__c, Other_work__c, Other_work_Estimate__c, Total_Work_Time__c, Team_Meeting__c, Huddle__c, Quarterly_Updates__c, Governance_Forums__c, Performance_Reviews__c, Tea_Breaks__c, CPD_e_Learning_Maintenance__c, Coaching__c, PD_Days__c, One_on_Ones__c, Weekly_Tracker_preparation__c, Business_Communications__c, Other__c, Other1__c, Other2__c, Project_Time__c, Other_Time__c, Project_Time_Description__c, Other_Time_Description__c, Shrinkage_time__c, Available_Time__c, Availability_Checking__c, id, Week__C from QAAM_Weekly_Planner__c where Week__C =: weekData];
        list<String> weekDataStatic = new list<String>{'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'};
            integer i=0;
        for(QAAM_Weekly_Planner__c q : queryData)
        {
            
    AvailabilityMap.put(weekDataStatic[i], q.Availability__c);
     //Availabity Map
    CommentsMap.put(weekDataStatic[i], q.ReasonAvailability__c);
     WorkHoursMap.put(weekDataStatic[i], q.Work_Hours__c);
    //Core Categories Map
     EmpMap.put(weekDataStatic[i], q.Pre_Vet_Reviews__c);
     BAUFileReviewsMap.put(weekDataStatic[i], q.BAU_File_Reviews__c);
     DebriefsMap.put(weekDataStatic[i], q.Debriefs__c);
     FileSelectionMap.put(weekDataStatic[i], q.File_Selection__c);
     OtherworkMap.put(weekDataStatic[i], q.Other_work__c);
     OtherworkEstimation.put(weekDataStatic[i], q.Other_work_Estimate__c);
        TotalWorkTime.put(weekDataStatic[i], q.Total_Work_Time__c);
    //Shrinkage Categories Map
     TeamMeetingMap.put(weekDataStatic[i], q.Team_Meeting__c);
     HuddleMap.put(weekDataStatic[i], q.Huddle__c);
     QuarterlyUpdatesMap.put(weekDataStatic[i], q.Quarterly_Updates__c);
     GovernanceForumsMap.put(weekDataStatic[i], q.Governance_Forums__c);
     PerformanceReviewsMap.put(weekDataStatic[i], q.Performance_Reviews__c);
     TeaBreaksMap.put(weekDataStatic[i], q.Tea_Breaks__c);
     LearningMaintenanceMap.put(weekDataStatic[i], q.CPD_e_Learning_Maintenance__c);
     CoachingMap.put(weekDataStatic[i], q.Coaching__c);
     PDDaysMap.put(weekDataStatic[i], q.PD_Days__c);
     OneonOnesMap.put(weekDataStatic[i], q.One_on_Ones__c);
     WeeklyTrackerpreparationMap.put(weekDataStatic[i], q.Weekly_Tracker_preparation__c);
     BusinessCommunicationsMap.put(weekDataStatic[i], q.Business_Communications__c);
     OtherMap.put(weekDataStatic[i], q.Other__c);
     Other1Map.put(weekDataStatic[i], q.Other1__c);
     Other2Map.put(weekDataStatic[i], q.Other2__c);
     ProjecttimeMap.put(weekDataStatic[i], q.Project_Time__c);
     OthertimeMap.put(weekDataStatic[i], q.Other_Time__c);
    ProjecttimeDesMap.put(weekDataStatic[i], q.Project_Time_Description__c);
    OthertimeDesMap.put(weekDataStatic[i], q.Other_Time_Description__c);
    ShrinkageTimeMonMap.put(weekDataStatic[i], q.Shrinkage_time__c);
    //Available Hours
    AvailMonMap.put(weekDataStatic[i], q.Available_Time__c);
    CheckMonMap.put(weekDataStatic[i], q.Availability_Checking__c);
            i++;
        }
    }

 public void EmpMapSecValues()
    {
        EmpMap_Monday = EmpMap.get('Monday');
        EmpMap_Tuesday = EmpMap.get('Tuesday');
        EmpMap_Wednesday = EmpMap.get('Wednesday');
        EmpMap_Thursday = EmpMap.get('Thursday');
        EmpMap_Friday = EmpMap.get('Friday');
        System.debug(EmpMap_Monday + '-' +EmpMap_Tuesday  + '-' + EmpMap_Wednesday + '-' +EmpMap_Thursday  +'-' +EmpMap_Friday);
    }

}

I call this in 

ViewQAAMController obj = new ViewQAAMController();
obj.queryOperation();
obj.EmpMapSecValues();

and I get the error Line: 772, Column: 1 System.LimitException: Too many SOQL queries: 101

Line 772 is: integer i=0;

Regards
Karthic Sankar V P
Hi Experts,

I have a controller like below.

public class paramtest {
    public string value { get; set;}
    public string Availability_Mon { get; set;}
    public string Availability_Tue { get; set;}
    public string Availability_Wed { get; set;}
    public string Availability_Thur { get; set;}
    public string Availability_Fri { get; set;}
    
    public map<String,String> AvailabilityMap = new map<String, String>();
    
public void loadValues()
    {
    AvailabilityMap.put('Monday', 'Karthic1');
    AvailabilityMap.put('Tuesday', 'Karthic2');
    AvailabilityMap.put('Wednesday', 'Karthic3');
    AvailabilityMap.put('Thursday', 'Karthic4');
    AvailabilityMap.put('Friday', 'Karthic5');
    assignValues();
    }
    
    public void assignValues()
    {
    Availability_Mon = AvailabilityMap.get('Monday');
    Availability_Tue = AvailabilityMap.get('Tuesday');
    Availability_Wed = AvailabilityMap.get('Wednesday');
    Availability_Thur = AvailabilityMap.get('Thursday');
    Availability_Fri = AvailabilityMap.get('Friday');
    }
}

My VF is like below.

<apex:page controller="paramtest" docType="html-5.0">
<apex:form >
<apex:pageBlock title="Core Categories" id="pgCoreCategories">
           <table border="0.3px" width="100%" height="80%" style="page-break-inside:auto; text-align: center;">
                   <tr style="text-align: center;">
                       <th style="font-size:125%;"></th>
                       <th style="font-size:125%; text-align: center;">Standard Timing</th>
                       <th style="font-size:125%; text-align: center;">Monday</th>
                       <th style="font-size:125%; text-align: center;">Tuesday</th>
                       <th style="font-size:125%; text-align: center;">Wednesday</th>
                       <th style="font-size:125%; text-align: center;">Thursday</th>
                       <th style="font-size:125%; text-align: center;">Friday</th>
                       <th style="font-size:125%; text-align: center;">During Week</th>
                   </tr>
                  <tr>
                       <th style="font-size:125%;">Pre-Vet Reviews</th>
                       <th style="font-size:125%; text-align: center;">180 Mins</th>
                       <td><apex:inputText value="{!Availability_Mon}" id="inputPrevetReviewMon" html-class="CoreMonday" onkeyup="testMethod()"  style="text-align: center;" html-placeholder="Enter # of files"/></td>
                       <td><apex:inputText value="{!Availability_Tue}" id="inputPrevetReviewTue" html-class="CoreTuesday" onkeyup="testMethod()"  style="text-align: center;" html-placeholder="Enter # of files"/></td>
                       <td><apex:inputText value="{!Availability_Wed}" id="inputPrevetReviewWed" html-class="CoreWednesday" onkeyup="testMethod()" style="text-align: center;" html-placeholder="Enter # of files"/></td>
                       <td><apex:inputText value="{!Availability_Thur}" id="inputPrevetReviewThur" html-class="CoreThursday" onkeyup="testMethod()" style="text-align: center;"  html-placeholder="Enter # of files"/></td>
                       <td><apex:inputText value="{!Availability_Fri}" id="inputPrevetReviewFri" html-class="CoreFriday" onkeyup="testMethod()"  style="text-align: center;" html-placeholder="Enter # of files"/></td>
                       <td><apex:inputText value="{!Availability_Fri}" id="inputPrevetReviewDummy" html-class="CoreDummy" onkeyup="testMethod()" style="text-align: center;" html-placeholder="Enter # of files"/></td>
                       
                   </tr>
                </table>
                </apex:pageBlock>   
                


</apex:form>
</apex:page>

I wanted the assign the values from my map to all the input feilds available on my visualforce page on pageload.

Kindly help me on how to achieve this.

Regards
Karthic Sankar V P
HI Experts,

Can someone please tell me how to resolve this issue.

public void UpdateTheValue(List<QAAM_Weekly_Planner__c> weekValues)
    {
       List<QAAM_Weekly_Planner__c> updateWeekValuetotal = new List<QAAM_Weekly_Planner__c>(); 
        for(QAAM_Weekly_Planner__c plan : weekValues)
        {
            List<QAAM_Weekly_Planner__c> updateWeekValue = [select Pre_Vet_Reviews__c, id from QAAM_Weekly_Planner__c where id =:plan.id];
            updateWeekValue.Pre_Vet_Reviews__c = 5.0; 
            updateWeekValuetotal.add(updateWeekValue);
        }
        update updateWeekValuetotal;
    }

Error:
Variable does not exist: Pre_Vet_Reviews__c

Reagrds
Karthic Sankar V P
Hi Experts,

I have below controller which inserts data five times as five different records


public class AddQAAMWeeklyPlanner
{
//Shrinkage Time
    public String ShrinkageTimeFri { get; set; }
    public String ShrinkageTimeThur { get; set; }
    public String ShrinkageTimeWed { get; set; }
    public String ShrinkageTimeTue { get; set; }
    public String ShrinkageTimeMon { get; set; }

      //Otherttime Description add
    public String OthertimeDes_Fri { get; set; }
    public String OthertimeDes_Thur { get; set; }
    public String OthertimeDes_Wed { get; set; }
    public String OthertimeDes_Tue { get; set; }
    public String OthertimeDes_Mon { get; set; }

   public map<String,String> OthertimeDesMap= new map<String, String>();
    public map<String,String> ShrinkageTimeMonMap = new map<String, String>();

public void AddAvailability()
     {
OthertimeDesMap.put('Monday',OthertimeDes_Mon);
        OthertimeDesMap.put('Tuesday',OthertimeDes_Tue);
        OthertimeDesMap.put('Wednesday',OthertimeDes_Wed);
        OthertimeDesMap.put('Thursday',OthertimeDes_Thur);
        OthertimeDesMap.put('Friday',OthertimeDes_Fri);
       
               ShrinkageTimeMonMap.put('Monday', ShrinkageTimeMon);
             ShrinkageTimeMonMap.put('Tuesday', ShrinkageTimeTue);
             ShrinkageTimeMonMap.put('Wednesday', ShrinkageTimeWed);
             ShrinkageTimeMonMap.put('Thursday', ShrinkageTimeThur);
             ShrinkageTimeMonMap.put('Friday', ShrinkageTimeFri);

}

public void saveAllDetails()
        {
AddAvailability();
List<QAAM_Weekly_Planner__c> testList = new List<QAAM_Weekly_Planner__c>();
string enteredDayfromUI = ‘Monday’;
if(enteredDayfromUI.equals('Monday'))
        {

for(String k : ShrinkageTimeMonMap.keySet())
        {
QAAM_Weekly_Planner__c acc= new QAAM_Weekly_Planner__c ();
acc. Shrinkage_time__c = Double.valueOf(ShrinkageTimeMonMap.get(k));
acc. OthertimeDes__c = OthertimeDesMap.get(k);
testList.add(acc);
}
Insert testList;
}


I want to check, it data is already available, I just to update my records rather than doing a new insert. Kindly help.

This query will return me the ID's of primary feilds.

List<QAAM_Weekly_Planner__c> weekValues = [select Week_Start_Date__c, id, Week__C from QAAM_Weekly_Planner__c where Week__C =: week];

if size of weekValues is greater than 0, I have to take all record ID's [to be precise 5 records will be available] and I have to run the method saveAllDetails() with upsert operation. Kindly help me.

Thanks
Karthic Sankar V P
Hi Experts,

Please guide me on how to covert string to date.

I have string in this format 01-01-2020
I need this to be date format 01-01-2020

Reagrds
Karthic 
Hi All,

I have field with data type date:

How to query based on that field.

select id, Week_Start_Date__c from QAAM_Weekly_Planner__c where Week_Start_Date__c  := 6/07/2020

I get unknown parse error.

Kindly help.
Hi Experts,

Can anyone pls help me why I am gettting NULL value here.

MY Contoller

public class ViewQAAMController {

    public PageReference MyMethod() {
        System.debug('I am called');
        pageReference pg = new pageReference('http://www.google.com/');
        pg.setRedirect(true);
        return pg;
    }
    
    public void callMe()
    {
        System.debug('I am called by JavaScript' + ValueFromVF);
        
    }


    public String valueFromVF { get; set; }
    //valueFromVF
   
    public List<AggregateResult> BadgeList
  {
      get
      {
          List<AggregateResult> badges = [select Week__c, max(createddate) apple from QAAM_Weekly_Planner__c Max group by Week__c order by max(createddate) desc LIMIT 10];
          return badges;
      }
      set;
  }
    
   }

My VF page:

<apex:page controller="ViewQAAMController">
<apex:form >
<apex:actionFunction action="{!callMe}" name="callthisinJavaScript" reRender="a" />
<apex:pageBlock >

<apex:pageBlockTable value="{!BadgeList}" var="data" align="center" styleClass="table table-striped" >
<apex:column headerValue="MyValues">
<apex:outputLink value="{!data['Week__c']}" onclick="openWindow()">{!data['Week__c']}</apex:outputLink>
<apex:param name="weekValue" value="{!data['Week__c']}" assignTo="{!valueFromVF}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
<script>
function openWindow(){
         window.open('/apex/AddQAAMWeeklyPlanner');
         alert(callthisinJavaScript());
         callthisinJavaScript();
        }
    </script>
</apex:page>


I am getting value as NULL in controller

Regards
Karthic
 
HI Experts,

Can u pls guide me on how to write unit test for below method?

public String valueFromVF { get; set; 
     public void callMe()
    {
         valueFromVF = apexpages.currentPage().getParameters().get('weekValue');
    }

Regards
Karthic Sankar V P
Hi Experts,

Please let me know how to write unit test method for below.

  public List<AggregateResult> BadgeList
  {
      get
      {
          List<AggregateResult> badges = [select Week__c, max(createddate) apple from QAAM_Weekly_Planner__c Max group by Week__c order by max(createddate) desc LIMIT 10];
          return badges;
      }
      set;
  }

Reagrds
Karthic Sankar V P
Hi Experts,

Please tell me how to do below scenario.

I have a controller class which has a method 

Class variable.
public map<String,Integer> EmpMap = new map<String, Integer>();
Method Name.
public void saveAllDetails()
        {
        AddCoreCategories();
        AddShrinkageCategories();
        AddAvailability();
        WeekDuration();
        set<String> allKeys = EmpMap.keySet();
        list<Integer> allValues = EmpMap.Values();

}

My test class

@isTest
public class AddQAAMWeeklyPlannerTest {
    
    static testmethod void saveAllDetails()
    {
        AddQAAMWeeklyPlanner obj = new AddQAAMWeeklyPlanner();
        obj.
saveAllDetails();
}
}

My underlined statements are always gettting failed, pls tell me a way to set value for class variable.

Reagrds
Karthic Sankar V P
Hi Experts,

I have a VF page like below
User-added image

I wanted to add all input data and show it on below screen.

User-added imageI have writen a JavaScript for it as like below

<script type="text/javascript">
function getValuesMon() 
{
var TeamMonday= 0;
var HuddleMonday = 0;
var QupdatMonday = 0;
var GFMonday = 0;
var PerformanceRevMonday = 0;
var TeaBrksMonday =0;
var CPDMon = 0;
var CoachMonday = 0;
var PDdayMonday =0;
var OneOneMonday =0;
var WeeklyTracMonday =0;
var BusinessMonday =0;
var OthMonday =0;
var OthMonday1 =0;
var OthMonday2 =0;
var ProjecttimeMonda1=0;
var OthtimeMonday1=0;
var total = 0;


var obj = document.getElementsByClassName("Moncalc");
      for(var i=0; i<obj.length; i++)
      {
         if(obj[i].name == "pg:QAAMPlanner:PBQAAMPlanner:ShrinkagePB:TeamMeetMonday")
            {
            var TeamMonday = obj[i].value;
            var TeamMonday= parseInt(TeamMonday);
            }
            
         if(obj[i].name == "pg:QAAMPlanner:PBQAAMPlanner:ShrinkagePB:HuddleMonday")
            {
                var HuddleMonday = obj[i].value;
            var HuddleMonday = parseInt(HuddleMonday);
            }
            
            
            if(obj[i].name == "pg:QAAMPlanner:PBQAAMPlanner:ShrinkagePB:QupdatesMonday")
            {
                var QupdatMonday = obj[i].value;
            var QupdatMonday = parseInt(QupdatMonday);
            }
            
            
            
            
            if(obj[i].name == "pg:QAAMPlanner:PBQAAMPlanner:ShrinkagePB:GoverFormsMonday")
            {
                var GFMonday = obj[i].value;
            var GFMonday = parseInt(GFMonday);
            }
            
            
            
            
            if(obj[i].name == "pg:QAAMPlanner:PBQAAMPlanner:ShrinkagePB:PerformanceReviewMonday")
            {
                var PerformanceRevMonday = obj[i].value;
            var PerformanceRevMonday = parseInt(PerformanceRevMonday);
            }
            
            
            
            if(obj[i].name == "pg:QAAMPlanner:PBQAAMPlanner:ShrinkagePB:TeaBreaksMonday")
            {
                var TeaBrksMonday= obj[i].value;
            var TeaBrksMonday= parseInt(TeaBrksMonday);
            }
                       
            
            if(obj[i].name == "pg:QAAMPlanner:PBQAAMPlanner:ShrinkagePB:CPDMonday")
            {   
            var CPDMon = obj[i].value;
            var CPDMon = parseInt(CPDMon);
            }
            
            
            if(obj[i].name == "pg:QAAMPlanner:PBQAAMPlanner:ShrinkagePB:CoachingMonday")
            {   
            var CoachMonday = obj[i].value;
            var CoachMonday = parseInt(CoachMonday);
            }
            
            
            if(obj[i].name == "pg:QAAMPlanner:PBQAAMPlanner:ShrinkagePB:PDdaysMonday")
            {   
            var PDdayMonday = obj[i].value;
            var PDdayMonday = parseInt(PDdayMonday);
            }
            
            
            if(obj[i].name == "pg:QAAMPlanner:PBQAAMPlanner:ShrinkagePB:OneonOneMonday")
            {   
            var OneOneMonday = obj[i].value;
            var OneOneMonday = parseInt(OneOneMonday);
            }
            
            
            if(obj[i].name == "pg:QAAMPlanner:PBQAAMPlanner:ShrinkagePB:WeeklyTrackerMonday")
            {   
            var WeeklyTracMonday = obj[i].value;
            var WeeklyTracMonday = parseInt(WeeklyTracMonday);
            }
            
            
            if(obj[i].name == "pg:QAAMPlanner:PBQAAMPlanner:ShrinkagePB:BusinessCommMonday")
            {   
            var BusinessMonday = obj[i].value;
            var BusinessMonday = parseInt(BusinessMonday);
            }
            
             
             if(obj[i].name == "pg:QAAMPlanner:PBQAAMPlanner:ShrinkagePB:OtherMonday")
            {   
            var OthMonday = obj[i].value;
            var OthMonday = parseInt(OthMonday);
            }
           
            
            if(obj[i].name == "pg:QAAMPlanner:PBQAAMPlanner:ShrinkagePB:OtherMonday1")
            {   
            var OthMonday1 = obj[i].value;
            var OthMonday1  = parseInt(OthMonday1);
            }
            
            
            if(obj[i].name == "pg:QAAMPlanner:PBQAAMPlanner:ShrinkagePB:OtherMonday2")
            {   
            var OthMonday2 = obj[i].value;
            var OthMonday2 = parseInt(OthMonday2);
            }
            
            
            if(obj[i].name == "pg:QAAMPlanner:PBQAAMPlanner:ShrinkagePB:ProjecttimeMonday1")
            {   
            var ProjecttimeMonda1 = obj[i].value;
            var ProjecttimeMonda1 = parseInt(ProjecttimeMonda1);
            }
            
            
            if(obj[i].name == "pg:QAAMPlanner:PBQAAMPlanner:ShrinkagePB:OthertimeMonday1")
            {   
            var OthtimeMonday1 = obj[i].value;
            var OthtimeMonday1 = parseInt(OthtimeMonday1);
            }
            
            
             if(obj[i].name == "pg:QAAMPlanner:PBQAAMPlanner:pbavailabletime:MondayAvailableTime")
             {
              
                    var coreValueMonday = parseFloat(getCoreValues());
                    coreValueMonday = coreValueMonday*60;
                    var all=TeamMonday+HuddleMonday+QupdatMonday+GFMonday+PerformanceRevMonday+TeaBrksMonday+CPDMon+CoachMonday+PDdayMonday+OneOneMonday+WeeklyTracMonday+BusinessMonday+OthMonday+OthMonday1+OthMonday2+coreValueMonday-ProjecttimeMonda1-OthtimeMonday1;
                    var all = all/60;
                    var all= all.toString().match(/^-?\d+(?:\.\d{0,2})?/)[0]
                  obj[i].value = all;
                  alert(all);
                  total+=(obj[i].value*1);

              }
              
         }
}


The point is, it only adds after the last value is entered into feild (Project Time), kindly sugest me a logic where I can add the values and show it on respective feild as soon a value is entered in the input feild. 

Regards
Karthic Sankar V P
Hi Experts,

Can u pls let me know how to pass argument from my VF page to controller, using javaScript?

My VF page

<apex:page controller="ViewQAAMController">
<apex:form >
<apex:actionFunction action="{!callMe}" name="callthisinJavaScript" reRender="a" />
<apex:pageBlock >

<apex:pageBlockTable value="{!BadgeList}" var="data" align="center" styleClass="table table-striped" >
<apex:column headerValue="MyValues">
<apex:outputLink value="{!data['Week__c']}" onclick="openWindow()">{!data['Week__c']}</apex:outputLink>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
<script>
function openWindow(){
         window.open('/apex/AddQAAMWeeklyPlanner');
         alert(callthisinJavaScript());
         callthisinJavaScript();
        }
    </script>
</apex:page>

My controller:

public class ViewQAAMController {

    public PageReference MyMethod() {
        System.debug('I am called');
        pageReference pg = new pageReference('http://www.google.com/');
        pg.setRedirect(true);
        return pg;
    }
    
    public void callMe()
    {
        System.debug('I am called by JavaScript');
    }


    //public List<AggregateResult> BadgeList { get; set; }
   
    public List<AggregateResult> BadgeList
  {
      get
      {
          List<AggregateResult> badges = [select Week__c, max(createddate) apple from QAAM_Weekly_Planner__c Max group by Week__c order by max(createddate) desc LIMIT 10];
          return badges;
      }
      set;
  }
    
   }

I wanted to pass value: {!data['Week__c']} to my controller from JavaScript, pls let me know how to achieve this?

Regards
Karthic Sankar V P
Hi All,

Please help me with below request.

I want to calll a apex method from my javaScript

<apex:page controller="ViewQAAMController">
<apex:form >
<apex:pageBlock >

<apex:pageBlockTable value="{!BadgeList}" var="data" align="center" styleClass="table table-striped" >
<apex:column headerValue="MyValues">
<apex:outputLink value="{!data['Week__c']}" onclick="openWindow()">{!data['Week__c']}</apex:outputLink>
</apex:column>
</apex:pageBlockTable>
<apex:actionFunction action="{!MyMethod}" name="myFunction" />
</apex:pageBlock>
</apex:form>
<script>
function openWindow(){
         window.open('/apex/AddQAAMWeeklyPlanner');
         MyFunction();
        }
    </script>
</apex:page>


Controller:

public class ViewQAAMController {

    public PageReference MyMethod() {
            System.debug('I am called ILU');
        return null;
    }


    //public List<AggregateResult> BadgeList { get; set; }
   
    public List<AggregateResult> BadgeList
  {
      get
      {
          List<AggregateResult> badges = [select Week__c, max(createddate) apple from QAAM_Weekly_Planner__c Max group by Week__c order by max(createddate) desc LIMIT 10];
          return badges;
      }
      set;
  }
    
   }

I want to call Mymethod() from controller from Java Script.

Kindly help

Regards
Karthic Sankar V P
Hi All,

Please let me whom i need to contact to delete all the questions I have posted. I wanted to do it for some unwanted reason.

Regards
Karthic

Hi Guys,

I have a VF page, which loads the value when its opened based on SOQL query output.

When user modifies the input value, it should update on the same record whereas its not heppening for me.

Below is my code, and its very urgent. Can someone pls help me? as I am new to this development, I am struggling.

Controller:
public class EditQAAMController {
 Double MondayPrevet{get; set;}
    public Double EmpMap_Monday { get
    {
    return EmpMap.get('Monday');    
    }
    set
    {
        this.MondayPrevet = EmpMap_Monday;
    }
      }

public map<String,Double> EmpMap = new map<String, Double>();

 public EditQAAMController()
    {
         strText = ApexPages.currentPage().getParameters().get('str');
        System.debug(strText);
    }
    
    list<QAAM_Weekly_Planner__c> queryData;
    public void init()
    {
        queryData = [select CommentsAvailability__c, Other1Title__c, Other2Title__c, Picklist__c, Date_QAAM__c, Week_Start_Date__c,
                                                  Availability__c, ReasonAvailability__c, Work_Hours__c, Pre_Vet_Reviews__c, BAU_File_Reviews__c, Debriefs__c,
                                                  File_Selection__c, Other_work__c, Other_work_Estimate__c, Total_Work_Time__c, Team_Meeting__c, Huddle__c, 
                                                  Quarterly_Updates__c, Governance_Forums__c, Performance_Reviews__c, Tea_Breaks__c, CPD_e_Learning_Maintenance__c, 
                                                  Coaching__c, PD_Days__c, One_on_Ones__c, Weekly_Tracker_preparation__c, Business_Communications__c, 
                                                  Other__c, Other1__c, Other2__c, Project_Time__c, Other_Time__c, Project_Time_Description__c, 
                                                  Other_Time_Description__c, Shrinkage_time__c, Available_Time__c, Availability_Checking__c, id, Week__C 
                                                  from QAAM_Weekly_Planner__c where Week__C =: strText];
        list<String> weekDataStatic = new list<String>{'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'};
            integer i=0;
        for(QAAM_Weekly_Planner__c q : queryData)
        {
            dateInput = q.Week_Start_Date__c;
            EmpMap.put(weekDataStatic[i], q.Pre_Vet_Reviews__c);

}

/////This below method is called while doing the save action

 public void saveButton() {
         List<QAAM_Weekly_Planner__c> updateWeekValuetotal = new List<QAAM_Weekly_Planner__c>(); 
        for(QAAM_Weekly_Planner__c q : queryData)
        {
            q.Week_Start_Date__c = q.Week_Start_Date__c;
            System.debug('The value from UI is: ' +MondayPrevet); 
           q.Pre_Vet_Reviews__c = MondayPrevet;
            updateWeekValuetotal.add(q);
        }
        update updateWeekValuetotal;
    }

}

 

HI Everyone.

Controller

public class ViewQAAMController {
public ViewQAAMController()
    {
String weekData = '20/07/2020 - 24/07/2020';
        list<String> lstSplitDate1 = new list<String>();
        lstSplitDate1.clear();
        lstSplitDate1 = weekData.split(' - ');
        strText = ApexPages.currentPage().getParameters().get('str');
        System.debug('inside method '+ApexPages.currentPage().getParameters().get('weekValue'));
        System.debug('inside method value '+test);
        System.debug('inside method value for strText'+strText);
        
        //for(String s : lstSplitDate1)
        //{
            //System.debug('The date is '+s);
        //}
        
        list<QAAM_Weekly_Planner__c> queryData = [select CommentsAvailability__c, Other1Title__c, Other2Title__c, Picklist__c, Date_QAAM__c, Week_Start_Date__c, Availability__c, ReasonAvailability__c, Work_Hours__c, Pre_Vet_Reviews__c, BAU_File_Reviews__c, Debriefs__c, File_Selection__c, Other_work__c, Other_work_Estimate__c, Total_Work_Time__c, Team_Meeting__c, Huddle__c, Quarterly_Updates__c, Governance_Forums__c, Performance_Reviews__c, Tea_Breaks__c, CPD_e_Learning_Maintenance__c, Coaching__c, PD_Days__c, One_on_Ones__c, Weekly_Tracker_preparation__c, Business_Communications__c, Other__c, Other1__c, Other2__c, Project_Time__c, Other_Time__c, Project_Time_Description__c, Other_Time_Description__c, Shrinkage_time__c, Available_Time__c, Availability_Checking__c, id, Week__C from QAAM_Weekly_Planner__c where Week__C =: strText];
        System.debug('The query value is: '+queryData);
        list<String> weekDataStatic = new list<String>{'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'};
            integer i=0;
        for(QAAM_Weekly_Planner__c q : queryData)
        {
             dateValues = q.Week_Start_Date__c;
            AvailabilityMap.put(weekDataStatic[i], q.Availability__c);

}

}


Please help me in wriritng a testclass guys. I am fully stuck up.

Regards
Karthic Sankar V P
HI Experts,

Can someone please tell me how to resolve this issue.

public void UpdateTheValue(List<QAAM_Weekly_Planner__c> weekValues)
    {
       List<QAAM_Weekly_Planner__c> updateWeekValuetotal = new List<QAAM_Weekly_Planner__c>(); 
        for(QAAM_Weekly_Planner__c plan : weekValues)
        {
            List<QAAM_Weekly_Planner__c> updateWeekValue = [select Pre_Vet_Reviews__c, id from QAAM_Weekly_Planner__c where id =:plan.id];
            updateWeekValue.Pre_Vet_Reviews__c = 5.0; 
            updateWeekValuetotal.add(updateWeekValue);
        }
        update updateWeekValuetotal;
    }

Error:
Variable does not exist: Pre_Vet_Reviews__c

Reagrds
Karthic Sankar V P
Hi Experts,

Please guide me on how to covert string to date.

I have string in this format 01-01-2020
I need this to be date format 01-01-2020

Reagrds
Karthic 
Hi All,

I have field with data type date:

How to query based on that field.

select id, Week_Start_Date__c from QAAM_Weekly_Planner__c where Week_Start_Date__c  := 6/07/2020

I get unknown parse error.

Kindly help.
Hi Experts,

Can anyone pls help me why I am gettting NULL value here.

MY Contoller

public class ViewQAAMController {

    public PageReference MyMethod() {
        System.debug('I am called');
        pageReference pg = new pageReference('http://www.google.com/');
        pg.setRedirect(true);
        return pg;
    }
    
    public void callMe()
    {
        System.debug('I am called by JavaScript' + ValueFromVF);
        
    }


    public String valueFromVF { get; set; }
    //valueFromVF
   
    public List<AggregateResult> BadgeList
  {
      get
      {
          List<AggregateResult> badges = [select Week__c, max(createddate) apple from QAAM_Weekly_Planner__c Max group by Week__c order by max(createddate) desc LIMIT 10];
          return badges;
      }
      set;
  }
    
   }

My VF page:

<apex:page controller="ViewQAAMController">
<apex:form >
<apex:actionFunction action="{!callMe}" name="callthisinJavaScript" reRender="a" />
<apex:pageBlock >

<apex:pageBlockTable value="{!BadgeList}" var="data" align="center" styleClass="table table-striped" >
<apex:column headerValue="MyValues">
<apex:outputLink value="{!data['Week__c']}" onclick="openWindow()">{!data['Week__c']}</apex:outputLink>
<apex:param name="weekValue" value="{!data['Week__c']}" assignTo="{!valueFromVF}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
<script>
function openWindow(){
         window.open('/apex/AddQAAMWeeklyPlanner');
         alert(callthisinJavaScript());
         callthisinJavaScript();
        }
    </script>
</apex:page>


I am getting value as NULL in controller

Regards
Karthic
 
Hi Experts,

Can u pls let me know how to pass argument from my VF page to controller, using javaScript?

My VF page

<apex:page controller="ViewQAAMController">
<apex:form >
<apex:actionFunction action="{!callMe}" name="callthisinJavaScript" reRender="a" />
<apex:pageBlock >

<apex:pageBlockTable value="{!BadgeList}" var="data" align="center" styleClass="table table-striped" >
<apex:column headerValue="MyValues">
<apex:outputLink value="{!data['Week__c']}" onclick="openWindow()">{!data['Week__c']}</apex:outputLink>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
<script>
function openWindow(){
         window.open('/apex/AddQAAMWeeklyPlanner');
         alert(callthisinJavaScript());
         callthisinJavaScript();
        }
    </script>
</apex:page>

My controller:

public class ViewQAAMController {

    public PageReference MyMethod() {
        System.debug('I am called');
        pageReference pg = new pageReference('http://www.google.com/');
        pg.setRedirect(true);
        return pg;
    }
    
    public void callMe()
    {
        System.debug('I am called by JavaScript');
    }


    //public List<AggregateResult> BadgeList { get; set; }
   
    public List<AggregateResult> BadgeList
  {
      get
      {
          List<AggregateResult> badges = [select Week__c, max(createddate) apple from QAAM_Weekly_Planner__c Max group by Week__c order by max(createddate) desc LIMIT 10];
          return badges;
      }
      set;
  }
    
   }

I wanted to pass value: {!data['Week__c']} to my controller from JavaScript, pls let me know how to achieve this?

Regards
Karthic Sankar V P
Hi All,

Please help me with below request.

I want to calll a apex method from my javaScript

<apex:page controller="ViewQAAMController">
<apex:form >
<apex:pageBlock >

<apex:pageBlockTable value="{!BadgeList}" var="data" align="center" styleClass="table table-striped" >
<apex:column headerValue="MyValues">
<apex:outputLink value="{!data['Week__c']}" onclick="openWindow()">{!data['Week__c']}</apex:outputLink>
</apex:column>
</apex:pageBlockTable>
<apex:actionFunction action="{!MyMethod}" name="myFunction" />
</apex:pageBlock>
</apex:form>
<script>
function openWindow(){
         window.open('/apex/AddQAAMWeeklyPlanner');
         MyFunction();
        }
    </script>
</apex:page>


Controller:

public class ViewQAAMController {

    public PageReference MyMethod() {
            System.debug('I am called ILU');
        return null;
    }


    //public List<AggregateResult> BadgeList { get; set; }
   
    public List<AggregateResult> BadgeList
  {
      get
      {
          List<AggregateResult> badges = [select Week__c, max(createddate) apple from QAAM_Weekly_Planner__c Max group by Week__c order by max(createddate) desc LIMIT 10];
          return badges;
      }
      set;
  }
    
   }

I want to call Mymethod() from controller from Java Script.

Kindly help

Regards
Karthic Sankar V P
HI Experts,

I have a related list page which is VF page. I manged to create hyperlinks in related list page like below.

upon clicking on the hyperlink i wanted to redirect to another visualForce page. Kindly help. Below is myContoller and VF page.

User-added image

VF page
<apex:page controller="ViewQAAMController">
<apex:form >
<apex:pageBlock >

<apex:pageBlockTable value="{!BadgeList}" var="data" align="center" styleClass="table table-striped" >
<apex:column headerValue="MyValues">
<apex:outputLink value="{!data['Week__c']}" onclick="openWindow()">{!data['Week__c']}</apex:outputLink>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
<script>
function openWindow(){
        window.location.href = https://connect--cpsdev7--c.cs60.visual.force.com/apex/AddQAAMWeeklyPlanner;
        }
    </script>
</apex:page>

Controller

public class ViewQAAMController {

    //public List<AggregateResult> BadgeList { get; set; }
   
    public List<AggregateResult> BadgeList
  {
      get
      {
          List<AggregateResult> badges = [select Week__c, max(createddate) apple from QAAM_Weekly_Planner__c Max group by Week__c order by max(createddate) desc LIMIT 10];
          return badges;
      }
      set;
  }
    
   }

KIndly help guys..


Thanks and Reagrds
Karthic Sankar V P

 
Please help me in resolving this issue..

My controller:

public class ViewQAAMController {
 
    List<QAAM_Weekly_Planner__c> acc {get; set;}
    List<String> strvalues = new LIst<String>();
    List<AggregateResult> groupedResults = new List<AggregateResult>();
    String week = '';
   
    public ViewQAAMController()
     {
        String str;
        groupedResults.clear();
        strvalues.clear();
        groupedResults = [select Week__c from QAAM_Weekly_Planner__c Max group by Week__c order by max(createddate) desc LIMIT 10];
        if(groupedResults.size() > 0)
        {
            for(AggregateResult s : groupedResults)
        {
             strvalues.add('' + s.get('Week__c'));
             
        }
        }
        acc.clear();
        for(String s: strvalues)
        {
            QAAM_Weekly_Planner__c wp = new QAAM_Weekly_Planner__c();
            wp.Week__c = s;
            acc.add(wp);
        }
     }
    

}

My VF

<apex:page controller="ViewQAAMController">
<apex:form >
<apex:pageBlock >

<apex:pageBlockTable var="data" value="{!acc}">

    <apex:column value="{!data.Week__c}"/>

</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

I wanted to print the values from my contructor in pageblocktable.

Kindly help, i get below error.
Error: Unknown property 'String.Week__c'