• MBarnard
  • NEWBIE
  • 25 Points
  • Member since 2013

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 13
    Replies
Well,

What I really want to do is this:

Create a SF Button.
That button fires an APEX Class/Trigger that pulls the most recent data from an external DB, through SSRS API.
That data then returns into the account AND then I also create a VF page that displays as a PDF for email purposes.

I have access to the SSRS API.

I just need to know if I can create the necessary class to call the SSRS API to return me the values I need.
   The third part is only possible if I get what I want above done, so let's start there.

I can't find documentation outside of the SF Canvas for what I am looking to do... Any fingers pointing in the correct direction would be amazing.
Hey Guys,

So I'm trying to create a new Class and Component that will pull all cases that were closed this week and all cases that aren't yet closed.
I have a few purposes for this, one is to create an email around this that will go out every friday, but I also plan to possibly in the future place this actually within Salesforce as a page for quick visibility.

However, I am running in to an issue that I can't for the life of me figure out what i screwed up.

Yes, I am fairly certain this could be done differently with a query and then a map, but I'm still new to Apex and this makes sense, in my head.

The Error I am running in to is: "Save error: Unknown property 'Case=_List.ClosedCasesThisWeek'

Here is the Class: (yes there are more variables i plan on utilizing in the component but without fixing this error, the additional variables don't matter anyways)
global class Case_List {

//Get Cases Currently Open, In Progress, In Dev, Open and Closed this Week
	
	global list <Case> OpenedCases = [select id, Case.CreatedBy.Name, Case.Account.Name, Subject, Case.Owner.Name from Case where status='Open'];
	global list <Case> ClosedCasesThisWeek = [select id, Case.CreatedBy.Name, Case.Account.Name, Subject, Case.Owner.Name, ClosedDate from Case where ClosedDate = THIS_WEEK];
	global list <Case> InDevCases = [select id, Case.CreatedBy.Name, Case.Account.Name, Subject, Case.Owner.Name from Case where status='In Dev'];
	global list <Case> InProgressCases = [select id, Case.CreatedBy.Name, Case.Account.Name, Subject, Case.Owner.Name from Case where status='In Progress'];
	global list <Case> CompletedCases = [select id, Case.CreatedBy.Name, Case.Account.Name, Subject, Case.Owner.Name from Case where Date_Time_Completed__c = THIS_WEEK];
	global list <Case> CompletedbutNotClosedCases = [select id, Case.CreatedBy.Name, Case.Account.Name, Subject, Case.Owner.Name from Case where Status ='Completed'];
	
	global integer CasesOpenCount = OpenedCases.size();
	global integer CasesCloseThisWeekCount = ClosedCasesThisWeek.size();
	global integer CasesInDevCount = InDevCases.size();
	global integer CasesInProgressCount = InProgressCases.size();
	global integer CasesCompletedCount = CompletedCases.size();
	global integer CasesCompletedbutNotClosedCount = CompletedbutNotClosedCases.size();

}
Here is the Component
<apex:component controller="Case_List" access="global">
	<apex:dataTable value="{!ClosedCasesThisWeek}" var="ClosedCases" id="ClosedCases" rowClasses="odd,even">

			<apex:column >
				<apex:facet name="header">Subject</apex:facet>
				<apex:outputText value="{!ClosedCases.Subject}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Account</apex:facet>
				<apex:outputText value="{!ClosedCases.Account.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Case Owner</apex:facet>
				<apex:outputText value="{!ClosedCases.Owner.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">CloseDate</apex:facet>
				<apex:outputText value="{!ClosedCases.ClosedDate}" />
			</apex:column>
	</apex:dataTable>
<apex:outputText html-font-size="17" value="Currently Open Cases" />
	<apex:dataTable value="{!OpenedCases}" var="Open" id="OpenCases" rowClasses="odd,even">
			<apex:column >
				<apex:facet name="header">Creator</apex:facet>
				<apex:outputText value="{!Open.CreatedBy.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Subject</apex:facet>
				<apex:outputText value="{!Open.Subject}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Account</apex:facet>
				<apex:outputText value="{!Open.Account.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Case Owner</apex:facet>
				<apex:outputText value="{!Open.Owner.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Opened Date</apex:facet>
				<apex:outputText value="{!Open.CreatedDate}" />
			</apex:column>
	</apex:dataTable>
	<br />
	<br />
	<apex:outputText html-font-size="17" value="Cases Currently In Dev" />
	<apex:dataTable value="{!InDevCases}" var="InDevCases" id="InDevCases" rowClasses="odd,even">
			<apex:column >
				<apex:facet name="header">Creator</apex:facet>
				<apex:outputText value="{!InDevCases.CreatedBy.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Subject</apex:facet>
				<apex:outputText value="{!InDevCases.Subject}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Account</apex:facet>
				<apex:outputText value="{!InDevCases.Account.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Case Owner</apex:facet>
				<apex:outputText value="{!InDevCases.Owner.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Open Date</apex:facet>
				<apex:outputText value="{!InDevCases.CreatedDate}" />
			</apex:column>
	</apex:dataTable>
	<br />
	<br />
	<apex:outputText html-font-size="17" value="Currently In Progress Cases" />
		<apex:dataTable value="{!InProgressCases}" var="InProgressCases" id="InProgressCases" rowClasses="odd,even">
			<apex:column >
				<apex:facet name="header">Creator</apex:facet>
				<apex:outputText value="{!InProgressCases.CreatedBy.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Subject</apex:facet>
				<apex:outputText value="{!InProgressCases.Subject}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Account</apex:facet>
				<apex:outputText value="{!InProgressCases.Account.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Case Owner</apex:facet>
				<apex:outputText value="{!InProgressCases.Owner.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Open Date</apex:facet>
				<apex:outputText value="{!InProgressCases.CreatedDate}" />
			</apex:column>
	</apex:dataTable>
	<br />
	<br />
	<apex:outputText html-font-size="17" value="Cases Completed but not yet Closed" />
		<apex:dataTable value="{!CompletedbutNotClosedCases}" var="CompletedbutNotClosedCases" id="CompletedbutNotClosedCases" rowClasses="odd,even">
			<apex:column >
				<apex:facet name="header">Creator</apex:facet>
				<apex:outputText value="{!CompletedbutNotClosedCases.CreatedBy.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Subject</apex:facet>
				<apex:outputText value="{!CompletedbutNotClosedCases.Subject}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Account</apex:facet>
				<apex:outputText value="{!CompletedbutNotClosedCases.Account.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Case Owner</apex:facet>
				<apex:outputText value="{!CompletedbutNotClosedCases.Owner.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Open Date</apex:facet>
				<apex:outputText value="{!CompletedbutNotClosedCases.CreatedDate}" />
			</apex:column>
	</apex:dataTable>	
</apex:component>

I am confused as it doesn't matter if I only try to query 'ClosedCasesThisWeek' nor does the order matter, etc etc etc... help?

Hey Guys,

 

I have an urgent fix needed, I deployed a new Trigger (and subsequently had to comment it out).

 

I have no idea, why when modifying an Account, is causing a Task trigger to error out. 

 

There are obviously two triggers fighting back and forth and I am not sure why.

 

The Trigger is this: 

trigger AccountUpdateonLogCall on Task (after insert, after update) {
	
	//To do - If the Purpose of a completed task contains "Low Redemption" or "Proactive", put the description of the completed task in the 
	//the "Low_Redemption_Notes__c" and/or "Proactive_Communication_Notes__c" field on the account object

//Create a set of related account ID's
Set <ID> acctIDs = new Set <ID> ();


//For every task, add it's related to account ID to the set
	for (Task t: Trigger.new){
	  acctIDs.add(t.accountID);
//Create a map to match the task related to ID's with their corresponding account ID's
	  Map<ID, Account> acctMap = new Map<ID, Account> ([Select ID, Proactive_Communication_Notes__c, Low_Redemption_Notes__c  from Account where ID in :acctIDs]);
//Create the account object
      Account acctRec = acctMap.get(t.whatID);

//If the account ID isn't null, the Purpose is Pro or Low, and the task has been marked as completed    
//Check to see if the which fields to update based upon the Purpose__c field.
  	  if (t.accountID != null && t.Purpose__c.Equals('Proactive Communication') && t.Status == 'Completed'){
//Update the Last_SW_Activity__c field on the account object with the task's end date  
  		  acctrec.Proactive_Communication_Notes__c = t.Description;
  		  update acctRec;
  	  }
  	  else if (t.accountID != null &&  t.Purpose__c == ('Low-Redemption Communication') && t.Status == ('Completed')){
  	  	  acctrec.Proactive_Communication_Notes__c = t.Description;
  	  	  acctrec.Low_Redemption_Notes__c = t.Description;
  		  update acctRec;
  	}
  }

 

 The end of the error is here: 

09:28:50.461|CUMULATIVE_LIMIT_USAGE_END

09:28:58.640 (15640685095)|CODE_UNIT_FINISHED|TestClass.myUnitTest
09:28:58.640 (15640691443)|EXECUTION_FINISHED
09:28:58.672 (15672545565)|EXECUTION_STARTED
09:28:58.672 (15672557111)|CODE_UNIT_STARTED|[EXTERNAL]|01pU0000000uhEc|unsubscribe.testUnsubscribe
09:28:58.672 (15672823603)|METHOD_ENTRY|[1]|01pU0000000uhEc|unsubscribe.unsubscribe()
09:28:58.672 (15672831894)|METHOD_EXIT|[1]|unsubscribe
09:28:58.672 (15672929931)|SYSTEM_CONSTRUCTOR_ENTRY|[94]|<init>()
09:28:58.672 (15672964293)|SYSTEM_CONSTRUCTOR_EXIT|[94]|<init>()
09:28:58.673 (15673000365)|SYSTEM_CONSTRUCTOR_ENTRY|[95]|<init>()
09:28:58.673 (15673018059)|SYSTEM_CONSTRUCTOR_EXIT|[95]|<init>()
09:28:58.673 (15673179045)|DML_BEGIN|[103]|Op:Insert|Type:Lead|Rows:1
09:28:59.261 (16261741837)|CODE_UNIT_STARTED|[EXTERNAL]|Workflow:Lead
09:28:59.268 (16268756720)|CODE_UNIT_FINISHED|Workflow:Lead
09:28:59.270 (16270842834)|DML_END|[103]
09:28:59.271 (16271021000)|DML_BEGIN|[110]|Op:Insert|Type:Contact|Rows:1
09:28:59.392 (16392831876)|DML_END|[110]
09:28:59.392 (16392927559)|CONSTRUCTOR_ENTRY|[117]|01pU0000000uhEc|<init>()
09:28:59.392 (16392984711)|CONSTRUCTOR_EXIT|[117]|01pU0000000uhEc|<init>()
09:28:59.393 (16393010727)|METHOD_ENTRY|[118]|01pU0000000uhEc|unsubscribe.handleInboundEmail(Messaging.InboundEmail, Messaging.InboundEnvelope)
09:28:59.393 (16393088911)|SYSTEM_CONSTRUCTOR_ENTRY|[8]|<init>()
09:28:59.393 (16393117648)|SYSTEM_CONSTRUCTOR_EXIT|[8]|<init>()
09:28:59.393 (16393137238)|SYSTEM_CONSTRUCTOR_ENTRY|[11]|<init>()
09:28:59.393 (16393158715)|SYSTEM_CONSTRUCTOR_EXIT|[11]|<init>()
09:28:59.393 (16393204778)|SYSTEM_CONSTRUCTOR_ENTRY|[12]|<init>()
09:28:59.393 (16393227885)|SYSTEM_CONSTRUCTOR_EXIT|[12]|<init>()
09:28:59.393 (16393527015)|SOQL_EXECUTE_BEGIN|[33]|Aggregations:0|select Id, Name, Email, HasOptedOutOfEmail from Contact 
09:28:59.418 (16418074120)|SOQL_EXECUTE_END|[33]|Rows:1
09:28:59.418 (16418167403)|SYSTEM_METHOD_ENTRY|[33]|Database.QueryLocator.iterator()
09:28:59.418 (16418328865)|SYSTEM_METHOD_ENTRY|[7]|QueryLocatorIterator.QueryLocatorIterator()
09:28:59.418 (16418343945)|SYSTEM_METHOD_EXIT|[7]|QueryLocatorIterator
09:28:59.418 (16418429734)|SYSTEM_METHOD_EXIT|[33]|Database.QueryLocator.iterator()
09:28:59.418 (16418447665)|SYSTEM_METHOD_ENTRY|[33]|Database.QueryLocatorIterator.hasNext()
09:28:59.418 (16418485833)|SYSTEM_METHOD_ENTRY|[33]|LIST<Contact>.size()
09:28:59.418 (16418516395)|SYSTEM_METHOD_EXIT|[33]|LIST<Contact>.size()
09:28:59.418 (16418532213)|SYSTEM_METHOD_EXIT|[33]|Database.QueryLocatorIterator.hasNext()
09:28:59.418 (16418543964)|SYSTEM_METHOD_ENTRY|[33]|Database.QueryLocatorIterator.next()
09:28:59.418 (16418562952)|SYSTEM_METHOD_ENTRY|[48]|Database.QueryLocatorIterator.hasNext()
09:28:59.418 (16418583322)|SYSTEM_METHOD_ENTRY|[33]|LIST<Contact>.size()
09:28:59.418 (16418594968)|SYSTEM_METHOD_EXIT|[33]|LIST<Contact>.size()
09:28:59.418 (16418605734)|SYSTEM_METHOD_EXIT|[48]|Database.QueryLocatorIterator.hasNext()
09:28:59.418 (16418645056)|SYSTEM_METHOD_EXIT|[33]|Database.QueryLocatorIterator.next()
09:28:59.418 (16418723679)|SYSTEM_METHOD_ENTRY|[41]|LIST<Contact>.add(Object)
09:28:59.418 (16418755646)|SYSTEM_METHOD_EXIT|[41]|LIST<Contact>.add(Object)
09:28:59.418 (16418766937)|SYSTEM_METHOD_ENTRY|[33]|Database.QueryLocatorIterator.hasNext()
09:28:59.418 (16418781516)|SYSTEM_METHOD_EXIT|[33]|Database.QueryLocatorIterator.hasNext()
09:28:59.418 (16418853617)|DML_BEGIN|[45]|Op:Update|Type:Contact|Rows:1
09:28:59.445 (16445474217)|DML_END|[45]
09:28:59.445 (16445960322)|SOQL_EXECUTE_BEGIN|[53]|Aggregations:0|select Id, Name, Email, HasOptedOutOfEmail from Lead 
09:28:59.477 (16477011223)|SOQL_EXECUTE_END|[53]|Rows:1
09:28:59.477 (16477077421)|SYSTEM_METHOD_ENTRY|[53]|Database.QueryLocator.iterator()
09:28:59.477 (16477308106)|SYSTEM_METHOD_EXIT|[53]|Database.QueryLocator.iterator()
09:28:59.477 (16477327336)|SYSTEM_METHOD_ENTRY|[53]|Database.QueryLocatorIterator.hasNext()
09:28:59.477 (16477368820)|SYSTEM_METHOD_ENTRY|[33]|LIST<Lead>.size()
09:28:59.477 (16477381191)|SYSTEM_METHOD_EXIT|[33]|LIST<Lead>.size()
09:28:59.477 (16477401035)|SYSTEM_METHOD_EXIT|[53]|Database.QueryLocatorIterator.hasNext()
09:28:59.477 (16477411846)|SYSTEM_METHOD_ENTRY|[53]|Database.QueryLocatorIterator.next()
09:28:59.477 (16477425170)|SYSTEM_METHOD_ENTRY|[48]|Database.QueryLocatorIterator.hasNext()
09:28:59.477 (16477439702)|SYSTEM_METHOD_ENTRY|[33]|LIST<Lead>.size()
09:28:59.477 (16477449821)|SYSTEM_METHOD_EXIT|[33]|LIST<Lead>.size()
09:28:59.477 (16477460138)|SYSTEM_METHOD_EXIT|[48]|Database.QueryLocatorIterator.hasNext()
09:28:59.477 (16477511767)|SYSTEM_METHOD_EXIT|[53]|Database.QueryLocatorIterator.next()
09:28:59.477 (16477588069)|SYSTEM_METHOD_ENTRY|[61]|LIST<Lead>.add(Object)
09:28:59.477 (16477623318)|SYSTEM_METHOD_EXIT|[61]|LIST<Lead>.add(Object)
09:28:59.477 (16477648698)|SYSTEM_METHOD_ENTRY|[63]|String.valueOf(Object)
09:28:59.477 (16477711423)|SYSTEM_METHOD_EXIT|[63]|String.valueOf(Object)
09:28:59.477 (16477729129)|SYSTEM_METHOD_ENTRY|[63]|System.debug(ANY)
09:28:59.477 (16477737311)|USER_DEBUG|[63]|DEBUG|Lead Object: Lead:{Name=Rasmus Mencke, Email=rmencke@salesforce.com, Id=00QU000000D4GPdMAN, HasOptedOutOfEmail=true}
09:28:59.477 (16477743969)|SYSTEM_METHOD_EXIT|[63]|System.debug(ANY)
09:28:59.477 (16477760011)|SYSTEM_METHOD_ENTRY|[53]|Database.QueryLocatorIterator.hasNext()
09:28:59.477 (16477772573)|SYSTEM_METHOD_EXIT|[53]|Database.QueryLocatorIterator.hasNext()
09:28:59.477 (16477815825)|DML_BEGIN|[66]|Op:Update|Type:Lead|Rows:1
09:28:59.535 (16535285783)|ENTERING_MANAGED_PKG|RT1
09:28:59.537 (16537085362)|CODE_UNIT_STARTED|[EXTERNAL]|Workflow:Lead
09:28:59.537 (16537109734)|CODE_UNIT_FINISHED|Workflow:Lead
09:28:59.537 (16537182920)|DML_END|[66]
09:28:59.537 (16537249306)|SYSTEM_METHOD_ENTRY|[73]|System.debug(ANY)
09:28:59.537 (16537272785)|USER_DEBUG|[73]|DEBUG|Found the unsubscribe word in the subject line.
09:28:59.537 (16537281200)|SYSTEM_METHOD_EXIT|[73]|System.debug(ANY)
09:28:59.537 (16537302671)|METHOD_EXIT|[118]|01pU0000000uhEc|unsubscribe.handleInboundEmail(Messaging.InboundEmail, Messaging.InboundEnvelope)
09:28:51.358 (16537327168)|CUMULATIVE_LIMIT_USAGE
09:28:51.358|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 2 out of 100
  Number of query rows: 2 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 4 out of 150
  Number of DML rows: 4 out of 10000
  Number of code statements: 27 out of 200000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 10
  Number of Email Invocations: 0 out of 10
  Number of fields describes: 0 out of 100
  Number of record type describes: 0 out of 100
  Number of child relationships describes: 0 out of 100
  Number of picklist describes: 0 out of 100
  Number of future calls: 0 out of 10

09:28:51.358|LIMIT_USAGE_FOR_NS|RT1|
  Number of SOQL queries: 0 out of 100
  Number of query rows: 0 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Number of code statements: 4 out of 200000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 10
  Number of Email Invocations: 0 out of 10
  Number of fields describes: 0 out of 100
  Number of record type describes: 0 out of 100
  Number of child relationships describes: 0 out of 100
  Number of picklist describes: 0 out of 100
  Number of future calls: 0 out of 10

09:28:51.358|CUMULATIVE_LIMIT_USAGE_END

09:28:59.537 (16537378369)|CODE_UNIT_FINISHED|unsubscribe.testUnsubscribe
09:28:59.537 (16537386450)|EXECUTION_FINISHED
09:28:59.597 (16597443514)|EXECUTION_STARTED
09:28:59.597 (16597456990)|CODE_UNIT_STARTED|[EXTERNAL]|01pU0000000uhEc|unsubscribe.testUnsubscribe2
09:28:59.597 (16597725101)|METHOD_ENTRY|[1]|01pU0000000uhEc|unsubscribe.unsubscribe()
09:28:59.597 (16597734223)|METHOD_EXIT|[1]|unsubscribe
09:28:59.597 (16597847377)|SYSTEM_CONSTRUCTOR_ENTRY|[125]|<init>()
09:28:59.597 (16597884686)|SYSTEM_CONSTRUCTOR_EXIT|[125]|<init>()
09:28:59.597 (16597903204)|SYSTEM_CONSTRUCTOR_ENTRY|[126]|<init>()
09:28:59.597 (16597917993)|SYSTEM_CONSTRUCTOR_EXIT|[126]|<init>()
09:28:59.598 (16598028373)|DML_BEGIN|[134]|Op:Insert|Type:Lead|Rows:1
09:28:59.689 (16689902323)|CODE_UNIT_STARTED|[EXTERNAL]|Workflow:Lead
09:28:59.689 (16689934241)|CODE_UNIT_FINISHED|Workflow:Lead
09:28:59.692 (16692004222)|DML_END|[134]
09:28:59.692 (16692166896)|DML_BEGIN|[141]|Op:Insert|Type:Contact|Rows:1
09:28:59.724 (16724815820)|DML_END|[141]
09:28:59.724 (16724868518)|CONSTRUCTOR_ENTRY|[148]|01pU0000000uhEc|<init>()
09:28:59.724 (16724907249)|CONSTRUCTOR_EXIT|[148]|01pU0000000uhEc|<init>()
09:28:59.724 (16724922296)|METHOD_ENTRY|[149]|01pU0000000uhEc|unsubscribe.handleInboundEmail(Messaging.InboundEmail, Messaging.InboundEnvelope)
09:28:59.724 (16724975920)|SYSTEM_CONSTRUCTOR_ENTRY|[8]|<init>()
09:28:59.724 (16724998785)|SYSTEM_CONSTRUCTOR_EXIT|[8]|<init>()
09:28:59.725 (16725021927)|SYSTEM_CONSTRUCTOR_ENTRY|[11]|<init>()
09:28:59.725 (16725027792)|SYSTEM_CONSTRUCTOR_EXIT|[11]|<init>()
09:28:59.725 (16725036228)|SYSTEM_CONSTRUCTOR_ENTRY|[12]|<init>()
09:28:59.725 (16725039402)|SYSTEM_CONSTRUCTOR_EXIT|[12]|<init>()
09:28:59.725 (16725076379)|SYSTEM_METHOD_ENTRY|[76]|System.debug(ANY)
09:28:59.725 (16725093675)|USER_DEBUG|[76]|DEBUG|No Unsuscribe word found in the subject line.
09:28:59.725 (16725099499)|SYSTEM_METHOD_EXIT|[76]|System.debug(ANY)
09:28:59.725 (16725108978)|METHOD_EXIT|[149]|01pU0000000uhEc|unsubscribe.handleInboundEmail(Messaging.InboundEmail, Messaging.InboundEnvelope)
09:28:51.546 (16725133358)|CUMULATIVE_LIMIT_USAGE
09:28:51.546|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 0 out of 100
  Number of query rows: 0 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 2 out of 150
  Number of DML rows: 2 out of 10000
  Number of code statements: 20 out of 200000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 10
  Number of Email Invocations: 0 out of 10
  Number of fields describes: 0 out of 100
  Number of record type describes: 0 out of 100
  Number of child relationships describes: 0 out of 100
  Number of picklist describes: 0 out of 100
  Number of future calls: 0 out of 10

09:28:51.546|CUMULATIVE_LIMIT_USAGE_END

09:28:59.725 (16725166488)|CODE_UNIT_FINISHED|unsubscribe.testUnsubscribe2
09:28:59.725 (16725171193)|EXECUTION_FINISHED

 

Hey Guys,

 

Been busy, writing my second ever Trigger.

 

This one is a bit more complex than my first, but no where near advanced.

 

What I am trying to do, is when a task with 'purpose' X or Y is logged, it takes the Description field and adds it to a custom field in the Account.

 

My Trigger is: 

trigger LoworProCommunicationLoggingAutomated on Task (after insert) {
Set<Id> acctIds = new Set<Id>();
    String DescToUpdate;
    String Purp;

    
for(Task t: [SELECT Subject, WhatId, Status, Purpose__c, Description FROM TASK WHERE ID IN:trigger.new]){
	
		String wId = t.WhatId;
		if(wId!=null && wId.startsWith('001') && !acctIds.contains(t.WhatId) && t.Status == 'Completed' && (t.Purpose__c.Equals('Proactive Communication') || t.Purpose__c.Equals('Low-Redemption Communication'))){
		acctIds.add(t.WhatId);
		DescToUpdate = t.Description;
		Purp = t.Purpose__c;

}

}
    for(Account a:[SELECT Low_Redemption_Notes__c, Proactive_Communication_Notes__c FROM Account WHERE ID IN:acctIds]){
    	if(Purp == 'Proactive Communication'){
                 a.Proactive_Communication_Notes__c = DesctoUpdate;
        update a; 
    	}
        else if (Purp == 'Low-Redemption Communication'){
        	a.Proactive_Communication_Notes__c = DesctoUpdate;
        	a.Low_Redemption_Notes__c = DesctoUpdate;
        update a;
        }
        
    }  
}

 

My Test Class is:

@isTest
private class LowProCommTest {

    static testMethod void myUnitTest() {
        // TO DO: implement unit test
        
        Account a = new Account(name='Test');
        insert a;
 
        Task t = new Task(subject='Test Activity', Status = 'Completed', Purpose__c = 'Proactive Communication', Description = 'I have Called This Dealership', whatId = a.id);
        insert t;
 
        a = [SELECT ID, Low_Redemption_Notes__c, Proactive_Communication_Notes__c  FROM Account WHERE ID = :a.id];
        System.assertEquals(t.Description, a.Proactive_Communication_Notes__c);
 
 
    }
 
}

 

 

Obviously, I have 0% coverage on my code.

 

However, before I attack that, I am running in to an issue that the notes field and the description are not equal as evidenced by my system.assertequals throwin an error.

 

I would love an actual description as to what I am doing wrong here so I can keep learning.

Hey Guys,

 

Having some issues with an APEX code that I have deployed.

 

When attempting to delete a task I am getting the following error:

 

There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Apex trigger qc.TaskTrigger caused an unexpected exception, contact your administrator: qc.TaskTrigger: execution of BeforeDelete caused by: System.NullPointerException: Attempt to de-reference a null object: (qc)". 

 

 

My APEX Trigger:

trigger ActivityAccountDetails on Task (before insert, before update) {
// Goal: Find the Account Status of the Account that a task is related to
// and update the Account_Status__c field on the task object with the value

// If related to an Account, query to find out the Account Status

// Create collection of tasks that are related to an Acct (where the Acct is listed only once)
	Set<Id> acctIds = new Set<Id>();
	for(Task t : trigger.new){
		String wId = t.WhatId;
		if(wId!=null && wId.startsWith('001') && !acctIds.contains(t.WhatId)){
			acctIds.add(t.WhatId);
		}
	}
	// Pull in acct ids and related field to populate task record
	List<Account> taskAcct = [Select Id, Account_Status__c from Account where Id in :acctIds];
	Map<Id, Account> acctMap = new Map<Id, Account>();
	for(Account a : taskAcct){
		acctMap.put(a.Id,a);
	}
	// Update custom task field with custom opp field
	for(Task t : trigger.new){
		String wId = t.WhatId;
		if(wId!=null && wId.startswith('001')){
			Account thisAcct = acctMap.get(t.WhatId);
			if(thisAcct!=null){t.Account_Status__c = thisAcct.Account_Status__c;} 
		}
	}

 Test Class:

@isTest
private class MyTest {

    static testMethod void myUnitTest() {
        // TO DO: implement unit test
        Account testAccount = new Account(name='Test Company Name');
        insert testAccount;
        
        testAccount.Account_Status__c='Prospect: Open';
        update testAccount;
              
        Task testTask = new Task(Subject= 'Test Task', WhatID = testAccount.Id);
        
       
        Account accountInfo = [SELECT Account_Status__c FROM Account WHERE Id = :testAccount.Id];
          
        System.assertEquals(accountInfo.Account_Status__c, testtask.Account_Status__c);
        
        insert testTask;
              
        System.assertEquals(testtask.AccountId, testAccount.Id);
    }
} 

 

Debug Log Detail

pex Debug Log Detail
User	test	Date	11/15/2013 5:02:44 PM EST
Status	Attempt to de-reference a null object	Application	Browser
Request Type	Application	Operation	/setup/own/deleteredirect.jsp
Duration (ms)	74	Log Size (bytes)	170
Log	
19.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
17:02:44.042 (42701000)|ENTERING_MANAGED_PKG|qc

 

 

Any input is greatly appreciated!

 

Thanks!

Mike

Hey Guys,

 

I am 90% sure I have this trigger a step away from completion.

 

This is the trigger:

trigger ActivityAccountDetails on Task (before insert, before update) {
// Goal: Find the Account Status of the Account that a task is related to
// and update the Account_Status__c field on the task object with the value

// If related to an Account, query to find out the Account Status

// Create collection of tasks that are related to an Acct (where the Acct is listed only once)
	Set<Id> acctIds = new Set<Id>();
	for(Task t : trigger.new){
		String wId = t.WhatId;
		if(wId!=null && wId.startsWith('001') && !acctIds.contains(t.WhatId)){
			acctIds.add(t.WhatId);
		}
	}
	// Pull in acct ids and related field to populate task record
	List<Account> taskAcct = [Select Id, Account_Status__c from Account where Id in :acctIds];
	Map<Id, Account> acctMap = new Map<Id, Account>();
	for(Account a : taskAcct){
		acctMap.put(a.Id,a);
	}
	// Update custom task field with custom opp field
	for(Task t : trigger.new){
		String wId = t.WhatId;
		if(wId!=null && wId.startswith('001')){
			Account thisAcct = acctMap.get(t.WhatId);
			if(thisAcct!=null){t.Account_Status__c = thisAcct.Account_Status__c;} 
		}
	}

 

This is my Test Class:

@isTest
private class MyTest {

    static testMethod void myUnitTest() {
        // TO DO: implement unit test
        Account testAccount = new Account(name='Test Company Name');
        insert testAccount;
        
        testAccount.Account_Status__c='Prospect: Open';
        update testAccount;
              
        Task testTask = new Task(Subject= 'Test Task', WhatID = testAccount.Id);
        
       
        Account accountInfo = [SELECT Account_Status__c FROM Account WHERE Id = :testAccount.Id];
          
        System.assertEquals(accountInfo.Account_Status__c, testtask.Account_Status__c);
        
        insert testTask;
              
        System.assertEquals(testtask.AccountId, testAccount.Id);
    }
} 

 I have two issues.

 

1: My test class isn't covering the trigger, at all. I have no idea how to fix that.

2: I have an error saying 'accountInfo.Account_Status__c is not equal to testtask.Account_Status__c' (or the syntax equivalent to that error)

 

I need a solution (or two) so that I can get this test coverage to apply to my trigger and why that error is occuring.

 

Thanks!

 

first ever Apex Trigger, so expect the craziness

Hey Guys,

 

Well, I have my lead weights on and am jumping off a 10' diving board into a 60' deep pool.

 

My first apex trigger.

 

I am looking to create a trigger, that when a task, that has a specific purpose is completed (purpose is a drop down field), it updates a notes field and date field within the Account object.

 

This is where i stand so far.

 

It is after insert.

 

I am going to try and use this as an open thread that I keep posting more into so would appreciate any sort of help or hints!

Hey Guys,

 

I am having an issue with a workflow rule (that i thought was working on Friday, but now it is not)

 

Basic gist of the situation is, I have a workflow rule, that will set an 'active on platform' date, the moment any one of five products goes live and then also have a rule to remove that date, if ALL of those five products get turned off, or all 'currently active' products get turned off. (they could have 1, 2, 4 products live and i need the date removed if they are "no longer active on platform")

 

Below, in sequence, is the logic I have developed and it is no longer working

 

Update Date for First Platform Activation

.........

AND( 
ISBLANK(Active_on_Platform_Date__c) 
, 
OR( 
ISCHANGED(Product1__c), 
ISCHANGED(Product2__c), 
ISCHANGED(Product3__c), 
ISCHANGED(Product4__c), 
ISCHANGED(Product5__c), 
ISCHANGED(Product6__c), 
ISCHANGED(Product7__c) 
), 
OR( 
ISPICKVAL(Product1__c, "Active"), 
ISPICKVAL(Product2__c, "Active"), 
ISPICKVAL(Product3__c, "Active"), 
ISPICKVAL(Product4__c, "Active"), 
ISPICKVAL(Product5__c, "Active"), 
ISPICKVAL(Product6__c, "Active"), 
ISPICKVAL(Product7__c, "Active") 
) 
)

 

 

Which triggers:

Field Update 

Active_on_Platform_Date__c = Now()

 

Which then triggers an instant internal alert to me and a '7 days after this date' alert

 

I then also have the following rule to eliminate that date:

 

AND( 
NOT( 
ISBLANK( 
Active_on_Platform_Date__c 
) 
), 
OR( 
ISCHANGED(Product1__c), 
ISCHANGED(Product2__c), 
ISCHANGED(Product3__c), 
ISCHANGED(Product4__c), 
ISCHANGED(Product5__c), 
ISCHANGED(Product6__c), 
ISCHANGED(Product7__c) 
), 
AND( 
OR( 
ISPICKVAL(Product1__c, "Canceled"), 
ISPICKVAL(Product1__c, "NA"), 
ISPICKVAL(Product1__c, "") 
), 
OR( 
ISPICKVAL(Product2__c, "Canceled"), 
ISPICKVAL(Product2__c, "NA"), 
ISPICKVAL(Product2__c, "") 
), 
OR( 
ISPICKVAL(Product3__c, "Canceled"), 
ISPICKVAL(Product3__c, "NA"), 
ISPICKVAL(Product3__c, "") 
), 
OR( 
ISPICKVAL(Product4__c, "Canceled"), 
ISPICKVAL(Product4__c, "NA"), 
ISPICKVAL(Product4__c, "") 
), 
OR( 
ISPICKVAL(Product5__c, "Canceled"), 
ISPICKVAL(Product5__c, "NA"), 
ISPICKVAL(Product5__c, "") 
), 
OR( 
ISPICKVAL(Product6__c, "Canceled"), 
ISPICKVAL(Product6__c, "NA"), 
ISPICKVAL(Product6__c, "") 
), 
OR( 
ISPICKVAL(Product7__c, "Canceled"), 
ISPICKVAL(Product7__c, "NA"), 
ISPICKVAL(Product7__c, "") 
) 
) 
)

 

 

Which triggers a field update to 'remove active on platform date' and blank it out.

 

 

Now, I swear on my life this was working thursday and now is no longer working.

 

Can anyone help me figure out why?

Hey guys,

 

Our account owners want to be CC'd on all emails that go out to the clients and I am wondering how to do this without having to enter the email manually every time.

 

My thought is to replace the 'Send Email' button on the account page within the 'Activity History' section with a custom one that will pull in the account owners email address.

 

From reading, it looks like it may require some java and a custom button.

 

Any input is appreciated

 

Mike

Hey Guys,

So I'm trying to create a new Class and Component that will pull all cases that were closed this week and all cases that aren't yet closed.
I have a few purposes for this, one is to create an email around this that will go out every friday, but I also plan to possibly in the future place this actually within Salesforce as a page for quick visibility.

However, I am running in to an issue that I can't for the life of me figure out what i screwed up.

Yes, I am fairly certain this could be done differently with a query and then a map, but I'm still new to Apex and this makes sense, in my head.

The Error I am running in to is: "Save error: Unknown property 'Case=_List.ClosedCasesThisWeek'

Here is the Class: (yes there are more variables i plan on utilizing in the component but without fixing this error, the additional variables don't matter anyways)
global class Case_List {

//Get Cases Currently Open, In Progress, In Dev, Open and Closed this Week
	
	global list <Case> OpenedCases = [select id, Case.CreatedBy.Name, Case.Account.Name, Subject, Case.Owner.Name from Case where status='Open'];
	global list <Case> ClosedCasesThisWeek = [select id, Case.CreatedBy.Name, Case.Account.Name, Subject, Case.Owner.Name, ClosedDate from Case where ClosedDate = THIS_WEEK];
	global list <Case> InDevCases = [select id, Case.CreatedBy.Name, Case.Account.Name, Subject, Case.Owner.Name from Case where status='In Dev'];
	global list <Case> InProgressCases = [select id, Case.CreatedBy.Name, Case.Account.Name, Subject, Case.Owner.Name from Case where status='In Progress'];
	global list <Case> CompletedCases = [select id, Case.CreatedBy.Name, Case.Account.Name, Subject, Case.Owner.Name from Case where Date_Time_Completed__c = THIS_WEEK];
	global list <Case> CompletedbutNotClosedCases = [select id, Case.CreatedBy.Name, Case.Account.Name, Subject, Case.Owner.Name from Case where Status ='Completed'];
	
	global integer CasesOpenCount = OpenedCases.size();
	global integer CasesCloseThisWeekCount = ClosedCasesThisWeek.size();
	global integer CasesInDevCount = InDevCases.size();
	global integer CasesInProgressCount = InProgressCases.size();
	global integer CasesCompletedCount = CompletedCases.size();
	global integer CasesCompletedbutNotClosedCount = CompletedbutNotClosedCases.size();

}
Here is the Component
<apex:component controller="Case_List" access="global">
	<apex:dataTable value="{!ClosedCasesThisWeek}" var="ClosedCases" id="ClosedCases" rowClasses="odd,even">

			<apex:column >
				<apex:facet name="header">Subject</apex:facet>
				<apex:outputText value="{!ClosedCases.Subject}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Account</apex:facet>
				<apex:outputText value="{!ClosedCases.Account.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Case Owner</apex:facet>
				<apex:outputText value="{!ClosedCases.Owner.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">CloseDate</apex:facet>
				<apex:outputText value="{!ClosedCases.ClosedDate}" />
			</apex:column>
	</apex:dataTable>
<apex:outputText html-font-size="17" value="Currently Open Cases" />
	<apex:dataTable value="{!OpenedCases}" var="Open" id="OpenCases" rowClasses="odd,even">
			<apex:column >
				<apex:facet name="header">Creator</apex:facet>
				<apex:outputText value="{!Open.CreatedBy.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Subject</apex:facet>
				<apex:outputText value="{!Open.Subject}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Account</apex:facet>
				<apex:outputText value="{!Open.Account.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Case Owner</apex:facet>
				<apex:outputText value="{!Open.Owner.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Opened Date</apex:facet>
				<apex:outputText value="{!Open.CreatedDate}" />
			</apex:column>
	</apex:dataTable>
	<br />
	<br />
	<apex:outputText html-font-size="17" value="Cases Currently In Dev" />
	<apex:dataTable value="{!InDevCases}" var="InDevCases" id="InDevCases" rowClasses="odd,even">
			<apex:column >
				<apex:facet name="header">Creator</apex:facet>
				<apex:outputText value="{!InDevCases.CreatedBy.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Subject</apex:facet>
				<apex:outputText value="{!InDevCases.Subject}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Account</apex:facet>
				<apex:outputText value="{!InDevCases.Account.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Case Owner</apex:facet>
				<apex:outputText value="{!InDevCases.Owner.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Open Date</apex:facet>
				<apex:outputText value="{!InDevCases.CreatedDate}" />
			</apex:column>
	</apex:dataTable>
	<br />
	<br />
	<apex:outputText html-font-size="17" value="Currently In Progress Cases" />
		<apex:dataTable value="{!InProgressCases}" var="InProgressCases" id="InProgressCases" rowClasses="odd,even">
			<apex:column >
				<apex:facet name="header">Creator</apex:facet>
				<apex:outputText value="{!InProgressCases.CreatedBy.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Subject</apex:facet>
				<apex:outputText value="{!InProgressCases.Subject}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Account</apex:facet>
				<apex:outputText value="{!InProgressCases.Account.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Case Owner</apex:facet>
				<apex:outputText value="{!InProgressCases.Owner.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Open Date</apex:facet>
				<apex:outputText value="{!InProgressCases.CreatedDate}" />
			</apex:column>
	</apex:dataTable>
	<br />
	<br />
	<apex:outputText html-font-size="17" value="Cases Completed but not yet Closed" />
		<apex:dataTable value="{!CompletedbutNotClosedCases}" var="CompletedbutNotClosedCases" id="CompletedbutNotClosedCases" rowClasses="odd,even">
			<apex:column >
				<apex:facet name="header">Creator</apex:facet>
				<apex:outputText value="{!CompletedbutNotClosedCases.CreatedBy.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Subject</apex:facet>
				<apex:outputText value="{!CompletedbutNotClosedCases.Subject}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Account</apex:facet>
				<apex:outputText value="{!CompletedbutNotClosedCases.Account.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Case Owner</apex:facet>
				<apex:outputText value="{!CompletedbutNotClosedCases.Owner.Name}" />
			</apex:column>
			<apex:column >
				<apex:facet name="header">Open Date</apex:facet>
				<apex:outputText value="{!CompletedbutNotClosedCases.CreatedDate}" />
			</apex:column>
	</apex:dataTable>	
</apex:component>

I am confused as it doesn't matter if I only try to query 'ClosedCasesThisWeek' nor does the order matter, etc etc etc... help?

Hey Guys,

 

I have an urgent fix needed, I deployed a new Trigger (and subsequently had to comment it out).

 

I have no idea, why when modifying an Account, is causing a Task trigger to error out. 

 

There are obviously two triggers fighting back and forth and I am not sure why.

 

The Trigger is this: 

trigger AccountUpdateonLogCall on Task (after insert, after update) {
	
	//To do - If the Purpose of a completed task contains "Low Redemption" or "Proactive", put the description of the completed task in the 
	//the "Low_Redemption_Notes__c" and/or "Proactive_Communication_Notes__c" field on the account object

//Create a set of related account ID's
Set <ID> acctIDs = new Set <ID> ();


//For every task, add it's related to account ID to the set
	for (Task t: Trigger.new){
	  acctIDs.add(t.accountID);
//Create a map to match the task related to ID's with their corresponding account ID's
	  Map<ID, Account> acctMap = new Map<ID, Account> ([Select ID, Proactive_Communication_Notes__c, Low_Redemption_Notes__c  from Account where ID in :acctIDs]);
//Create the account object
      Account acctRec = acctMap.get(t.whatID);

//If the account ID isn't null, the Purpose is Pro or Low, and the task has been marked as completed    
//Check to see if the which fields to update based upon the Purpose__c field.
  	  if (t.accountID != null && t.Purpose__c.Equals('Proactive Communication') && t.Status == 'Completed'){
//Update the Last_SW_Activity__c field on the account object with the task's end date  
  		  acctrec.Proactive_Communication_Notes__c = t.Description;
  		  update acctRec;
  	  }
  	  else if (t.accountID != null &&  t.Purpose__c == ('Low-Redemption Communication') && t.Status == ('Completed')){
  	  	  acctrec.Proactive_Communication_Notes__c = t.Description;
  	  	  acctrec.Low_Redemption_Notes__c = t.Description;
  		  update acctRec;
  	}
  }

 

 The end of the error is here: 

09:28:50.461|CUMULATIVE_LIMIT_USAGE_END

09:28:58.640 (15640685095)|CODE_UNIT_FINISHED|TestClass.myUnitTest
09:28:58.640 (15640691443)|EXECUTION_FINISHED
09:28:58.672 (15672545565)|EXECUTION_STARTED
09:28:58.672 (15672557111)|CODE_UNIT_STARTED|[EXTERNAL]|01pU0000000uhEc|unsubscribe.testUnsubscribe
09:28:58.672 (15672823603)|METHOD_ENTRY|[1]|01pU0000000uhEc|unsubscribe.unsubscribe()
09:28:58.672 (15672831894)|METHOD_EXIT|[1]|unsubscribe
09:28:58.672 (15672929931)|SYSTEM_CONSTRUCTOR_ENTRY|[94]|<init>()
09:28:58.672 (15672964293)|SYSTEM_CONSTRUCTOR_EXIT|[94]|<init>()
09:28:58.673 (15673000365)|SYSTEM_CONSTRUCTOR_ENTRY|[95]|<init>()
09:28:58.673 (15673018059)|SYSTEM_CONSTRUCTOR_EXIT|[95]|<init>()
09:28:58.673 (15673179045)|DML_BEGIN|[103]|Op:Insert|Type:Lead|Rows:1
09:28:59.261 (16261741837)|CODE_UNIT_STARTED|[EXTERNAL]|Workflow:Lead
09:28:59.268 (16268756720)|CODE_UNIT_FINISHED|Workflow:Lead
09:28:59.270 (16270842834)|DML_END|[103]
09:28:59.271 (16271021000)|DML_BEGIN|[110]|Op:Insert|Type:Contact|Rows:1
09:28:59.392 (16392831876)|DML_END|[110]
09:28:59.392 (16392927559)|CONSTRUCTOR_ENTRY|[117]|01pU0000000uhEc|<init>()
09:28:59.392 (16392984711)|CONSTRUCTOR_EXIT|[117]|01pU0000000uhEc|<init>()
09:28:59.393 (16393010727)|METHOD_ENTRY|[118]|01pU0000000uhEc|unsubscribe.handleInboundEmail(Messaging.InboundEmail, Messaging.InboundEnvelope)
09:28:59.393 (16393088911)|SYSTEM_CONSTRUCTOR_ENTRY|[8]|<init>()
09:28:59.393 (16393117648)|SYSTEM_CONSTRUCTOR_EXIT|[8]|<init>()
09:28:59.393 (16393137238)|SYSTEM_CONSTRUCTOR_ENTRY|[11]|<init>()
09:28:59.393 (16393158715)|SYSTEM_CONSTRUCTOR_EXIT|[11]|<init>()
09:28:59.393 (16393204778)|SYSTEM_CONSTRUCTOR_ENTRY|[12]|<init>()
09:28:59.393 (16393227885)|SYSTEM_CONSTRUCTOR_EXIT|[12]|<init>()
09:28:59.393 (16393527015)|SOQL_EXECUTE_BEGIN|[33]|Aggregations:0|select Id, Name, Email, HasOptedOutOfEmail from Contact 
09:28:59.418 (16418074120)|SOQL_EXECUTE_END|[33]|Rows:1
09:28:59.418 (16418167403)|SYSTEM_METHOD_ENTRY|[33]|Database.QueryLocator.iterator()
09:28:59.418 (16418328865)|SYSTEM_METHOD_ENTRY|[7]|QueryLocatorIterator.QueryLocatorIterator()
09:28:59.418 (16418343945)|SYSTEM_METHOD_EXIT|[7]|QueryLocatorIterator
09:28:59.418 (16418429734)|SYSTEM_METHOD_EXIT|[33]|Database.QueryLocator.iterator()
09:28:59.418 (16418447665)|SYSTEM_METHOD_ENTRY|[33]|Database.QueryLocatorIterator.hasNext()
09:28:59.418 (16418485833)|SYSTEM_METHOD_ENTRY|[33]|LIST<Contact>.size()
09:28:59.418 (16418516395)|SYSTEM_METHOD_EXIT|[33]|LIST<Contact>.size()
09:28:59.418 (16418532213)|SYSTEM_METHOD_EXIT|[33]|Database.QueryLocatorIterator.hasNext()
09:28:59.418 (16418543964)|SYSTEM_METHOD_ENTRY|[33]|Database.QueryLocatorIterator.next()
09:28:59.418 (16418562952)|SYSTEM_METHOD_ENTRY|[48]|Database.QueryLocatorIterator.hasNext()
09:28:59.418 (16418583322)|SYSTEM_METHOD_ENTRY|[33]|LIST<Contact>.size()
09:28:59.418 (16418594968)|SYSTEM_METHOD_EXIT|[33]|LIST<Contact>.size()
09:28:59.418 (16418605734)|SYSTEM_METHOD_EXIT|[48]|Database.QueryLocatorIterator.hasNext()
09:28:59.418 (16418645056)|SYSTEM_METHOD_EXIT|[33]|Database.QueryLocatorIterator.next()
09:28:59.418 (16418723679)|SYSTEM_METHOD_ENTRY|[41]|LIST<Contact>.add(Object)
09:28:59.418 (16418755646)|SYSTEM_METHOD_EXIT|[41]|LIST<Contact>.add(Object)
09:28:59.418 (16418766937)|SYSTEM_METHOD_ENTRY|[33]|Database.QueryLocatorIterator.hasNext()
09:28:59.418 (16418781516)|SYSTEM_METHOD_EXIT|[33]|Database.QueryLocatorIterator.hasNext()
09:28:59.418 (16418853617)|DML_BEGIN|[45]|Op:Update|Type:Contact|Rows:1
09:28:59.445 (16445474217)|DML_END|[45]
09:28:59.445 (16445960322)|SOQL_EXECUTE_BEGIN|[53]|Aggregations:0|select Id, Name, Email, HasOptedOutOfEmail from Lead 
09:28:59.477 (16477011223)|SOQL_EXECUTE_END|[53]|Rows:1
09:28:59.477 (16477077421)|SYSTEM_METHOD_ENTRY|[53]|Database.QueryLocator.iterator()
09:28:59.477 (16477308106)|SYSTEM_METHOD_EXIT|[53]|Database.QueryLocator.iterator()
09:28:59.477 (16477327336)|SYSTEM_METHOD_ENTRY|[53]|Database.QueryLocatorIterator.hasNext()
09:28:59.477 (16477368820)|SYSTEM_METHOD_ENTRY|[33]|LIST<Lead>.size()
09:28:59.477 (16477381191)|SYSTEM_METHOD_EXIT|[33]|LIST<Lead>.size()
09:28:59.477 (16477401035)|SYSTEM_METHOD_EXIT|[53]|Database.QueryLocatorIterator.hasNext()
09:28:59.477 (16477411846)|SYSTEM_METHOD_ENTRY|[53]|Database.QueryLocatorIterator.next()
09:28:59.477 (16477425170)|SYSTEM_METHOD_ENTRY|[48]|Database.QueryLocatorIterator.hasNext()
09:28:59.477 (16477439702)|SYSTEM_METHOD_ENTRY|[33]|LIST<Lead>.size()
09:28:59.477 (16477449821)|SYSTEM_METHOD_EXIT|[33]|LIST<Lead>.size()
09:28:59.477 (16477460138)|SYSTEM_METHOD_EXIT|[48]|Database.QueryLocatorIterator.hasNext()
09:28:59.477 (16477511767)|SYSTEM_METHOD_EXIT|[53]|Database.QueryLocatorIterator.next()
09:28:59.477 (16477588069)|SYSTEM_METHOD_ENTRY|[61]|LIST<Lead>.add(Object)
09:28:59.477 (16477623318)|SYSTEM_METHOD_EXIT|[61]|LIST<Lead>.add(Object)
09:28:59.477 (16477648698)|SYSTEM_METHOD_ENTRY|[63]|String.valueOf(Object)
09:28:59.477 (16477711423)|SYSTEM_METHOD_EXIT|[63]|String.valueOf(Object)
09:28:59.477 (16477729129)|SYSTEM_METHOD_ENTRY|[63]|System.debug(ANY)
09:28:59.477 (16477737311)|USER_DEBUG|[63]|DEBUG|Lead Object: Lead:{Name=Rasmus Mencke, Email=rmencke@salesforce.com, Id=00QU000000D4GPdMAN, HasOptedOutOfEmail=true}
09:28:59.477 (16477743969)|SYSTEM_METHOD_EXIT|[63]|System.debug(ANY)
09:28:59.477 (16477760011)|SYSTEM_METHOD_ENTRY|[53]|Database.QueryLocatorIterator.hasNext()
09:28:59.477 (16477772573)|SYSTEM_METHOD_EXIT|[53]|Database.QueryLocatorIterator.hasNext()
09:28:59.477 (16477815825)|DML_BEGIN|[66]|Op:Update|Type:Lead|Rows:1
09:28:59.535 (16535285783)|ENTERING_MANAGED_PKG|RT1
09:28:59.537 (16537085362)|CODE_UNIT_STARTED|[EXTERNAL]|Workflow:Lead
09:28:59.537 (16537109734)|CODE_UNIT_FINISHED|Workflow:Lead
09:28:59.537 (16537182920)|DML_END|[66]
09:28:59.537 (16537249306)|SYSTEM_METHOD_ENTRY|[73]|System.debug(ANY)
09:28:59.537 (16537272785)|USER_DEBUG|[73]|DEBUG|Found the unsubscribe word in the subject line.
09:28:59.537 (16537281200)|SYSTEM_METHOD_EXIT|[73]|System.debug(ANY)
09:28:59.537 (16537302671)|METHOD_EXIT|[118]|01pU0000000uhEc|unsubscribe.handleInboundEmail(Messaging.InboundEmail, Messaging.InboundEnvelope)
09:28:51.358 (16537327168)|CUMULATIVE_LIMIT_USAGE
09:28:51.358|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 2 out of 100
  Number of query rows: 2 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 4 out of 150
  Number of DML rows: 4 out of 10000
  Number of code statements: 27 out of 200000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 10
  Number of Email Invocations: 0 out of 10
  Number of fields describes: 0 out of 100
  Number of record type describes: 0 out of 100
  Number of child relationships describes: 0 out of 100
  Number of picklist describes: 0 out of 100
  Number of future calls: 0 out of 10

09:28:51.358|LIMIT_USAGE_FOR_NS|RT1|
  Number of SOQL queries: 0 out of 100
  Number of query rows: 0 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Number of code statements: 4 out of 200000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 10
  Number of Email Invocations: 0 out of 10
  Number of fields describes: 0 out of 100
  Number of record type describes: 0 out of 100
  Number of child relationships describes: 0 out of 100
  Number of picklist describes: 0 out of 100
  Number of future calls: 0 out of 10

09:28:51.358|CUMULATIVE_LIMIT_USAGE_END

09:28:59.537 (16537378369)|CODE_UNIT_FINISHED|unsubscribe.testUnsubscribe
09:28:59.537 (16537386450)|EXECUTION_FINISHED
09:28:59.597 (16597443514)|EXECUTION_STARTED
09:28:59.597 (16597456990)|CODE_UNIT_STARTED|[EXTERNAL]|01pU0000000uhEc|unsubscribe.testUnsubscribe2
09:28:59.597 (16597725101)|METHOD_ENTRY|[1]|01pU0000000uhEc|unsubscribe.unsubscribe()
09:28:59.597 (16597734223)|METHOD_EXIT|[1]|unsubscribe
09:28:59.597 (16597847377)|SYSTEM_CONSTRUCTOR_ENTRY|[125]|<init>()
09:28:59.597 (16597884686)|SYSTEM_CONSTRUCTOR_EXIT|[125]|<init>()
09:28:59.597 (16597903204)|SYSTEM_CONSTRUCTOR_ENTRY|[126]|<init>()
09:28:59.597 (16597917993)|SYSTEM_CONSTRUCTOR_EXIT|[126]|<init>()
09:28:59.598 (16598028373)|DML_BEGIN|[134]|Op:Insert|Type:Lead|Rows:1
09:28:59.689 (16689902323)|CODE_UNIT_STARTED|[EXTERNAL]|Workflow:Lead
09:28:59.689 (16689934241)|CODE_UNIT_FINISHED|Workflow:Lead
09:28:59.692 (16692004222)|DML_END|[134]
09:28:59.692 (16692166896)|DML_BEGIN|[141]|Op:Insert|Type:Contact|Rows:1
09:28:59.724 (16724815820)|DML_END|[141]
09:28:59.724 (16724868518)|CONSTRUCTOR_ENTRY|[148]|01pU0000000uhEc|<init>()
09:28:59.724 (16724907249)|CONSTRUCTOR_EXIT|[148]|01pU0000000uhEc|<init>()
09:28:59.724 (16724922296)|METHOD_ENTRY|[149]|01pU0000000uhEc|unsubscribe.handleInboundEmail(Messaging.InboundEmail, Messaging.InboundEnvelope)
09:28:59.724 (16724975920)|SYSTEM_CONSTRUCTOR_ENTRY|[8]|<init>()
09:28:59.724 (16724998785)|SYSTEM_CONSTRUCTOR_EXIT|[8]|<init>()
09:28:59.725 (16725021927)|SYSTEM_CONSTRUCTOR_ENTRY|[11]|<init>()
09:28:59.725 (16725027792)|SYSTEM_CONSTRUCTOR_EXIT|[11]|<init>()
09:28:59.725 (16725036228)|SYSTEM_CONSTRUCTOR_ENTRY|[12]|<init>()
09:28:59.725 (16725039402)|SYSTEM_CONSTRUCTOR_EXIT|[12]|<init>()
09:28:59.725 (16725076379)|SYSTEM_METHOD_ENTRY|[76]|System.debug(ANY)
09:28:59.725 (16725093675)|USER_DEBUG|[76]|DEBUG|No Unsuscribe word found in the subject line.
09:28:59.725 (16725099499)|SYSTEM_METHOD_EXIT|[76]|System.debug(ANY)
09:28:59.725 (16725108978)|METHOD_EXIT|[149]|01pU0000000uhEc|unsubscribe.handleInboundEmail(Messaging.InboundEmail, Messaging.InboundEnvelope)
09:28:51.546 (16725133358)|CUMULATIVE_LIMIT_USAGE
09:28:51.546|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 0 out of 100
  Number of query rows: 0 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 2 out of 150
  Number of DML rows: 2 out of 10000
  Number of code statements: 20 out of 200000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 10
  Number of Email Invocations: 0 out of 10
  Number of fields describes: 0 out of 100
  Number of record type describes: 0 out of 100
  Number of child relationships describes: 0 out of 100
  Number of picklist describes: 0 out of 100
  Number of future calls: 0 out of 10

09:28:51.546|CUMULATIVE_LIMIT_USAGE_END

09:28:59.725 (16725166488)|CODE_UNIT_FINISHED|unsubscribe.testUnsubscribe2
09:28:59.725 (16725171193)|EXECUTION_FINISHED

 

Hey Guys,

 

Been busy, writing my second ever Trigger.

 

This one is a bit more complex than my first, but no where near advanced.

 

What I am trying to do, is when a task with 'purpose' X or Y is logged, it takes the Description field and adds it to a custom field in the Account.

 

My Trigger is: 

trigger LoworProCommunicationLoggingAutomated on Task (after insert) {
Set<Id> acctIds = new Set<Id>();
    String DescToUpdate;
    String Purp;

    
for(Task t: [SELECT Subject, WhatId, Status, Purpose__c, Description FROM TASK WHERE ID IN:trigger.new]){
	
		String wId = t.WhatId;
		if(wId!=null && wId.startsWith('001') && !acctIds.contains(t.WhatId) && t.Status == 'Completed' && (t.Purpose__c.Equals('Proactive Communication') || t.Purpose__c.Equals('Low-Redemption Communication'))){
		acctIds.add(t.WhatId);
		DescToUpdate = t.Description;
		Purp = t.Purpose__c;

}

}
    for(Account a:[SELECT Low_Redemption_Notes__c, Proactive_Communication_Notes__c FROM Account WHERE ID IN:acctIds]){
    	if(Purp == 'Proactive Communication'){
                 a.Proactive_Communication_Notes__c = DesctoUpdate;
        update a; 
    	}
        else if (Purp == 'Low-Redemption Communication'){
        	a.Proactive_Communication_Notes__c = DesctoUpdate;
        	a.Low_Redemption_Notes__c = DesctoUpdate;
        update a;
        }
        
    }  
}

 

My Test Class is:

@isTest
private class LowProCommTest {

    static testMethod void myUnitTest() {
        // TO DO: implement unit test
        
        Account a = new Account(name='Test');
        insert a;
 
        Task t = new Task(subject='Test Activity', Status = 'Completed', Purpose__c = 'Proactive Communication', Description = 'I have Called This Dealership', whatId = a.id);
        insert t;
 
        a = [SELECT ID, Low_Redemption_Notes__c, Proactive_Communication_Notes__c  FROM Account WHERE ID = :a.id];
        System.assertEquals(t.Description, a.Proactive_Communication_Notes__c);
 
 
    }
 
}

 

 

Obviously, I have 0% coverage on my code.

 

However, before I attack that, I am running in to an issue that the notes field and the description are not equal as evidenced by my system.assertequals throwin an error.

 

I would love an actual description as to what I am doing wrong here so I can keep learning.

Hey Guys,

 

Having some issues with an APEX code that I have deployed.

 

When attempting to delete a task I am getting the following error:

 

There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Apex trigger qc.TaskTrigger caused an unexpected exception, contact your administrator: qc.TaskTrigger: execution of BeforeDelete caused by: System.NullPointerException: Attempt to de-reference a null object: (qc)". 

 

 

My APEX Trigger:

trigger ActivityAccountDetails on Task (before insert, before update) {
// Goal: Find the Account Status of the Account that a task is related to
// and update the Account_Status__c field on the task object with the value

// If related to an Account, query to find out the Account Status

// Create collection of tasks that are related to an Acct (where the Acct is listed only once)
	Set<Id> acctIds = new Set<Id>();
	for(Task t : trigger.new){
		String wId = t.WhatId;
		if(wId!=null && wId.startsWith('001') && !acctIds.contains(t.WhatId)){
			acctIds.add(t.WhatId);
		}
	}
	// Pull in acct ids and related field to populate task record
	List<Account> taskAcct = [Select Id, Account_Status__c from Account where Id in :acctIds];
	Map<Id, Account> acctMap = new Map<Id, Account>();
	for(Account a : taskAcct){
		acctMap.put(a.Id,a);
	}
	// Update custom task field with custom opp field
	for(Task t : trigger.new){
		String wId = t.WhatId;
		if(wId!=null && wId.startswith('001')){
			Account thisAcct = acctMap.get(t.WhatId);
			if(thisAcct!=null){t.Account_Status__c = thisAcct.Account_Status__c;} 
		}
	}

 Test Class:

@isTest
private class MyTest {

    static testMethod void myUnitTest() {
        // TO DO: implement unit test
        Account testAccount = new Account(name='Test Company Name');
        insert testAccount;
        
        testAccount.Account_Status__c='Prospect: Open';
        update testAccount;
              
        Task testTask = new Task(Subject= 'Test Task', WhatID = testAccount.Id);
        
       
        Account accountInfo = [SELECT Account_Status__c FROM Account WHERE Id = :testAccount.Id];
          
        System.assertEquals(accountInfo.Account_Status__c, testtask.Account_Status__c);
        
        insert testTask;
              
        System.assertEquals(testtask.AccountId, testAccount.Id);
    }
} 

 

Debug Log Detail

pex Debug Log Detail
User	test	Date	11/15/2013 5:02:44 PM EST
Status	Attempt to de-reference a null object	Application	Browser
Request Type	Application	Operation	/setup/own/deleteredirect.jsp
Duration (ms)	74	Log Size (bytes)	170
Log	
19.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
17:02:44.042 (42701000)|ENTERING_MANAGED_PKG|qc

 

 

Any input is greatly appreciated!

 

Thanks!

Mike

Hey Guys,

 

I am 90% sure I have this trigger a step away from completion.

 

This is the trigger:

trigger ActivityAccountDetails on Task (before insert, before update) {
// Goal: Find the Account Status of the Account that a task is related to
// and update the Account_Status__c field on the task object with the value

// If related to an Account, query to find out the Account Status

// Create collection of tasks that are related to an Acct (where the Acct is listed only once)
	Set<Id> acctIds = new Set<Id>();
	for(Task t : trigger.new){
		String wId = t.WhatId;
		if(wId!=null && wId.startsWith('001') && !acctIds.contains(t.WhatId)){
			acctIds.add(t.WhatId);
		}
	}
	// Pull in acct ids and related field to populate task record
	List<Account> taskAcct = [Select Id, Account_Status__c from Account where Id in :acctIds];
	Map<Id, Account> acctMap = new Map<Id, Account>();
	for(Account a : taskAcct){
		acctMap.put(a.Id,a);
	}
	// Update custom task field with custom opp field
	for(Task t : trigger.new){
		String wId = t.WhatId;
		if(wId!=null && wId.startswith('001')){
			Account thisAcct = acctMap.get(t.WhatId);
			if(thisAcct!=null){t.Account_Status__c = thisAcct.Account_Status__c;} 
		}
	}

 

This is my Test Class:

@isTest
private class MyTest {

    static testMethod void myUnitTest() {
        // TO DO: implement unit test
        Account testAccount = new Account(name='Test Company Name');
        insert testAccount;
        
        testAccount.Account_Status__c='Prospect: Open';
        update testAccount;
              
        Task testTask = new Task(Subject= 'Test Task', WhatID = testAccount.Id);
        
       
        Account accountInfo = [SELECT Account_Status__c FROM Account WHERE Id = :testAccount.Id];
          
        System.assertEquals(accountInfo.Account_Status__c, testtask.Account_Status__c);
        
        insert testTask;
              
        System.assertEquals(testtask.AccountId, testAccount.Id);
    }
} 

 I have two issues.

 

1: My test class isn't covering the trigger, at all. I have no idea how to fix that.

2: I have an error saying 'accountInfo.Account_Status__c is not equal to testtask.Account_Status__c' (or the syntax equivalent to that error)

 

I need a solution (or two) so that I can get this test coverage to apply to my trigger and why that error is occuring.

 

Thanks!

 

first ever Apex Trigger, so expect the craziness

Hey Guys,

 

I am having an issue with a workflow rule (that i thought was working on Friday, but now it is not)

 

Basic gist of the situation is, I have a workflow rule, that will set an 'active on platform' date, the moment any one of five products goes live and then also have a rule to remove that date, if ALL of those five products get turned off, or all 'currently active' products get turned off. (they could have 1, 2, 4 products live and i need the date removed if they are "no longer active on platform")

 

Below, in sequence, is the logic I have developed and it is no longer working

 

Update Date for First Platform Activation

.........

AND( 
ISBLANK(Active_on_Platform_Date__c) 
, 
OR( 
ISCHANGED(Product1__c), 
ISCHANGED(Product2__c), 
ISCHANGED(Product3__c), 
ISCHANGED(Product4__c), 
ISCHANGED(Product5__c), 
ISCHANGED(Product6__c), 
ISCHANGED(Product7__c) 
), 
OR( 
ISPICKVAL(Product1__c, "Active"), 
ISPICKVAL(Product2__c, "Active"), 
ISPICKVAL(Product3__c, "Active"), 
ISPICKVAL(Product4__c, "Active"), 
ISPICKVAL(Product5__c, "Active"), 
ISPICKVAL(Product6__c, "Active"), 
ISPICKVAL(Product7__c, "Active") 
) 
)

 

 

Which triggers:

Field Update 

Active_on_Platform_Date__c = Now()

 

Which then triggers an instant internal alert to me and a '7 days after this date' alert

 

I then also have the following rule to eliminate that date:

 

AND( 
NOT( 
ISBLANK( 
Active_on_Platform_Date__c 
) 
), 
OR( 
ISCHANGED(Product1__c), 
ISCHANGED(Product2__c), 
ISCHANGED(Product3__c), 
ISCHANGED(Product4__c), 
ISCHANGED(Product5__c), 
ISCHANGED(Product6__c), 
ISCHANGED(Product7__c) 
), 
AND( 
OR( 
ISPICKVAL(Product1__c, "Canceled"), 
ISPICKVAL(Product1__c, "NA"), 
ISPICKVAL(Product1__c, "") 
), 
OR( 
ISPICKVAL(Product2__c, "Canceled"), 
ISPICKVAL(Product2__c, "NA"), 
ISPICKVAL(Product2__c, "") 
), 
OR( 
ISPICKVAL(Product3__c, "Canceled"), 
ISPICKVAL(Product3__c, "NA"), 
ISPICKVAL(Product3__c, "") 
), 
OR( 
ISPICKVAL(Product4__c, "Canceled"), 
ISPICKVAL(Product4__c, "NA"), 
ISPICKVAL(Product4__c, "") 
), 
OR( 
ISPICKVAL(Product5__c, "Canceled"), 
ISPICKVAL(Product5__c, "NA"), 
ISPICKVAL(Product5__c, "") 
), 
OR( 
ISPICKVAL(Product6__c, "Canceled"), 
ISPICKVAL(Product6__c, "NA"), 
ISPICKVAL(Product6__c, "") 
), 
OR( 
ISPICKVAL(Product7__c, "Canceled"), 
ISPICKVAL(Product7__c, "NA"), 
ISPICKVAL(Product7__c, "") 
) 
) 
)

 

 

Which triggers a field update to 'remove active on platform date' and blank it out.

 

 

Now, I swear on my life this was working thursday and now is no longer working.

 

Can anyone help me figure out why?