• SupriyaH
  • NEWBIE
  • 0 Points
  • Member since 2015
  • Information Processing Consultant - Salesforce
  • UW - Madison

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
Hello, 
I have created a Custom List of Tasks owned by logged in user for the Home Page compoent. My WhoId and WhatId are being properly linked to the corresponding records but my Task Subjects are not (not even the IDs).
Here is my simple VF page:
<apex:pageBlock title="Priority Tasks">
	<apex:pageblocktable value="{!priorityTasks}" var="pt" id="mid">
		<apex:column style="{font-size:20px;}" headervalue="Subject" value="{!pt.Subject}"/>
		<apex:column headervalue="Date" value="{!pt.ActivityDate}"/>
		<apex:column headervalue="Status" value="{!pt.Status}"/>
		<apex:column headervalue="Program Track" value="{!pt.WhatId}"/>
		<apex:column headervalue="Contact" value="{!pt.WhoId}"/>
		<apex:column headervalue="Priority Score" value="{!pt.Priority_Score__c}"/>
	</apex:pageblocktable>

And Controller:
public with sharing class PrioritizedTaskListController{
    public List<Task> priorityTasks {get; set;}

    public PrioritizedTaskListController(){
        priorityTasks = [Select Subject,
        			ActivityDate, 
                                Status, 
                                WhatId, 
                                WhoId,
                                Priority_Score__c from Task where IsClosed = FALSE
                                and OwnerId =: UserInfo.getUserId()
                                order by Priority_Score__c desc];
    }
}

 

User-added image

 
I am having scenario some thing like this.. I wanrt to fire trigger on insert if salary less than 1000 and in update salary must be greater than 1300...BUT..BUT BUT.... main thing... during update i dont want to fire the update trigger record when the salary amount does not chnages.. it only get fired when  during update the salary amount is being changed..During update if i changes or updates any other field, except salary the before update trigger should not fire ... I done some something like this.. before insert is correct but i am having problem in before update... that when i changes the salary then only it shoul fire.. if old value != new value then fire the trigger
trigger salaryCheck on Teacher__c (before Insert, before Update) 
{
 for(Teacher__c tch : trigger.New)
 {
  if(trigger.isInsert && tch.Salary__c < 1000)
  {
   tch.addError('Must be greater than 1000');
  }
 }
 
 List<Teacher__c> oldlstTch = new List<Teacher__c>(trigger.old);
 for(Teacher__c newLstTch : trigger.new)
 {
  if(trigger.isUpdate &&  newLstTch.Salary__c != oldlstTch.Salary__c  )
  {
    if(newLstTch.Salary__c == null ||newLstTch.Salary__c < 1300)
      {
       newLstTch.Salary__c.addError('can not be null and greater than 1300');
      }
  }
 }
}
Error : Compile Error: Initial term of field expression must be a concrete SObject: List<Teacher__c> at line 14 column 50
 
Hello, 
I have created a Custom List of Tasks owned by logged in user for the Home Page compoent. My WhoId and WhatId are being properly linked to the corresponding records but my Task Subjects are not (not even the IDs).
Here is my simple VF page:
<apex:pageBlock title="Priority Tasks">
	<apex:pageblocktable value="{!priorityTasks}" var="pt" id="mid">
		<apex:column style="{font-size:20px;}" headervalue="Subject" value="{!pt.Subject}"/>
		<apex:column headervalue="Date" value="{!pt.ActivityDate}"/>
		<apex:column headervalue="Status" value="{!pt.Status}"/>
		<apex:column headervalue="Program Track" value="{!pt.WhatId}"/>
		<apex:column headervalue="Contact" value="{!pt.WhoId}"/>
		<apex:column headervalue="Priority Score" value="{!pt.Priority_Score__c}"/>
	</apex:pageblocktable>

And Controller:
public with sharing class PrioritizedTaskListController{
    public List<Task> priorityTasks {get; set;}

    public PrioritizedTaskListController(){
        priorityTasks = [Select Subject,
        			ActivityDate, 
                                Status, 
                                WhatId, 
                                WhoId,
                                Priority_Score__c from Task where IsClosed = FALSE
                                and OwnerId =: UserInfo.getUserId()
                                order by Priority_Score__c desc];
    }
}

 

User-added image