• Victor Quiron
  • NEWBIE
  • 0 Points
  • Member since 2023

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
How can i access Shopify Services API in Salesforce. And how can i get Shopify EndPoint URL .

Hi everyone-

 

I believe I'm coming pretty close to finalizing my apex code.  Unfortunately I'm getting a compile error and could use some help.  I have included comments within the code to show exactly what I'm trying to accomplish.  Can somebody please take a look and see what modifications need to be made?

 

trigger LastSWDate on Task (before insert, before update) {
	
	//To do - If the subject of a completed task contains "SW", put the date of the completed task in the 
	//the "Last_SW_Activity__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, Last_SW_Activity__c from Account where ID in :acctIDs]);
//Create the account object
      Account acctRec = acctMap.get(t.accountID);

//If the account ID isn't null, the subject line starts with "sw", and the task has been marked as completed    
	If (t.accountID =!null && t.subject.indexOf('sw') && t.Status == 'Completed')
//Check to see if the Last_SW_Activity__c field is current compared with the latest completed activity
  	  If (acctMap.get.(t.accountID).Last_SW_Activity__c < t.endDateTime || acctMap.get(t.accountID).Last_SW_Activity ==null){
//Update the Last_SW_Activity__c field on the account object with the task's end date  
  		  acctrec.Last_SW_Activity__c = t.endDatetime;
  	}
  }
}

 

 

 

 The error I'm getting states "Invalid field endDatetime for SObject Task".  It's refering to the last line of code.  Does anybody have any idea why it's giving me that error?

  • July 19, 2011
  • Like
  • 1