-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
5Questions
-
5Replies
Unknown DatetimeMethod line in debug log
Hi,
I've written a trigger to create an Event when a Campaign Member is created but it's not actually working and I don't understand what the debug log is telling me.
This is the trigger:
And this is the relevant part of the debug log:
I don't understand what 'com.salesforce.api.interop.apex.bcl.DatetimeMethods.date()' means - why is it failing?!
Any help would be gratefully received, thanks!
I've written a trigger to create an Event when a Campaign Member is created but it's not actually working and I don't understand what the debug log is telling me.
This is the trigger:
trigger CreateEventforCampaignMember on CampaignMember (after insert) { // 1. create a list of events List <Event> eventsToInsert = new List <Event>(); User usr = [SELECT Id FROM User WHERE FirstName =: 'Mark' AND LastName =: 'Alger' AND IsActive = TRUE LIMIT 1]; // This is to ensure that all events belong to Mark. try { // 2. for every campaign member being inserted, add to the list of events (this is so that the trigger can handle bulk inserts) for (CampaignMember cm : trigger.new) { system.debug('*** cm.Id ' + cm.Id); system.debug('*** cm.Date_of_Event__c.Date() = ' + cm.Date_of_Event__c.Date()); system.debug('*** cm.Date_of_Event__c = ' + cm.Date_of_Event__c); eventsToInsert.add( new Event ( DurationInMinutes = 1440, IsAllDayEvent = true, IsPrivate = false, IsRecurrence = false, IsReminderSet = false, OwnerID = usr.Id, ActivityDate = cm.Date_of_Event__c.Date(), StartDateTime = cm.Date_of_Event__c, Subject = cm.Subject__c, //WhatId = cm.CampaignId, WhoID = cm.LeadId ) ); } } catch (NullPointerException e) { system.debug('*** CreateEventforCampaignMember failed'); } // 3. insert the list of events insert eventsToInsert; }
And this is the relevant part of the debug log:
19:41:52.434 (434744296)|EXECUTION_STARTED 19:41:52.434 (434791731)|CODE_UNIT_STARTED|[EXTERNAL]|01qb0000000N42N|CreateEventforCampaignMember on CampaignMember trigger event AfterInsert for [00vb0000007Zq7h] 19:41:52.435 (435824204)|SYSTEM_CONSTRUCTOR_ENTRY|[4]|<init>() 19:41:52.435 (435872133)|SYSTEM_CONSTRUCTOR_EXIT|[4]|<init>() 19:41:52.436 (436283008)|SOQL_EXECUTE_BEGIN|[6]|Aggregations:0|select Id from User where (FirstName = :tmpVar1 and LastName = :tmpVar2 and IsActive = true) limit 1 19:41:52.446 (446302734)|SOQL_EXECUTE_END|[6]|Rows:1 19:41:52.446 (446522638)|SYSTEM_METHOD_ENTRY|[11]|LIST<CampaignMember>.iterator() 19:41:52.446 (446698513)|SYSTEM_METHOD_EXIT|[11]|LIST<CampaignMember>.iterator() 19:41:52.446 (446729142)|SYSTEM_METHOD_ENTRY|[11]|system.ListIterator.hasNext() 19:41:52.446 (446762026)|SYSTEM_METHOD_EXIT|[11]|system.ListIterator.hasNext() 19:41:52.446 (446858980)|SYSTEM_METHOD_ENTRY|[12]|String.valueOf(Object) 19:41:52.446 (446904223)|SYSTEM_METHOD_EXIT|[12]|String.valueOf(Object) 19:41:52.446 (446934115)|SYSTEM_METHOD_ENTRY|[12]|System.debug(ANY) 19:41:52.446 (446949030)|USER_DEBUG|[12]|DEBUG|*** cm.Id 00vb0000007Zq7hAAC 19:41:52.446 (446956406)|SYSTEM_METHOD_EXIT|[12]|System.debug(ANY) 19:41:52.447 (447002590)|SYSTEM_METHOD_ENTRY|[13]|com.salesforce.api.interop.apex.bcl.DatetimeMethods.date() 19:41:52.447 (447092751)|SYSTEM_METHOD_EXIT|[13]|com.salesforce.api.interop.apex.bcl.DatetimeMethods.date() 19:41:52.447 (447136684)|SYSTEM_METHOD_ENTRY|[33]|System.debug(ANY) 19:41:52.447 (447165602)|USER_DEBUG|[33]|DEBUG|*** CreateEventforCampaignMember failed 19:41:52.447 (447173944)|SYSTEM_METHOD_EXIT|[33]|System.debug(ANY)
I don't understand what 'com.salesforce.api.interop.apex.bcl.DatetimeMethods.date()' means - why is it failing?!
Any help would be gratefully received, thanks!
-
- Olivia Cannon
- July 27, 2014
- Like
- 0
- Continue reading or reply
Test class failing: List has no rows for assignment to SObject
Hi,
My test class is failing and I don't understand why - any help would be very gratefully received!
This is the error message:
Error Message: System.QueryException: List has no rows for assignment to SObject
Stack Trace: Class.TestUpdateTutor1onCampaign.TestUpdateTutor1onCampaign: line 37, column 1
This is line 37: cam = [SELECT Id FROM Campaign WHERE Name = 'Test Job'];
This is the test class as a whole:
Thank you!
My test class is failing and I don't understand why - any help would be very gratefully received!
This is the error message:
Error Message: System.QueryException: List has no rows for assignment to SObject
Stack Trace: Class.TestUpdateTutor1onCampaign.TestUpdateTutor1onCampaign: line 37, column 1
This is line 37: cam = [SELECT Id FROM Campaign WHERE Name = 'Test Job'];
This is the test class as a whole:
@isTest public class TestUpdateTutor1onCampaign{ static testMethod void TestUpdateTutor1onCampaign() { // create an Account, a Tutor, a Job and a Job Member Profile p = [SELECT Id FROM Profile WHERE Name='System Administrator']; User u = new User(Alias = 'standt', Email='standarduser@testorg.com', EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US', LocaleSidKey='en_US', ProfileId = p.Id, TimeZoneSidKey='America/Los_Angeles', UserName='4323f1a8-2698-44c4-a234-dfcf80fa6a6c@testorg.com'); test.StartTest(); insert u; u = [SELECT Id FROM User WHERE Alias = 'standt' AND Email='standarduser@testorg.com']; Account acc = new Account(Name = 'Test Account'); insert acc; acc = [SELECT Id FROM Account WHERE Name = 'Test Account']; //Get the Contact record types List<RecordType> listRecordTypes = [Select Name, Id From RecordType where sObjectType='Contact' and isActive=true]; Map<String,String> mapRecordTypes = new Map<String,String>(); for(RecordType rt: listRecordTypes) { mapRecordTypes.put(rt.Name,rt.Id); } Contact c = new Contact(AccountID = acc.Id, FirstName = 'Test', LastName = 'Contact', Main_Profile__c = 'www.google.com', RecordTypeId = mapRecordTypes.Get('Tutor') ); insert c; c = [SELECT Id FROM Contact WHERE FirstName = 'Test']; Campaign cam = new Campaign(Name = 'Test Job', Tutor_1__c = null); insert cam; cam = [SELECT Id FROM Campaign WHERE Name = 'Test Job']; // insert a Campaign Member CampaignMember cm = new CampaignMember(CampaignId = cam.Id, ContactId = c.Id, Send_tutor_details_to_client__c = 'First'); insert cm; cm = [SELECT Id FROM CampaignMember WHERE ContactId =: c.Id AND Send_tutor_details_to_client__c = 'First' ]; system.assertEquals(cam.Tutor_1__c, cm.Tutor_details_for_email__c); List<Campaign> camtest = [SELECT Id FROM Campaign WHERE Id =: cam.Id ]; system.assertEquals(cam.Tutor_1__c, cm.Tutor_details_for_email__c); test.StopTest(); } }
Thank you!
-
- Olivia Cannon
- July 09, 2014
- Like
- 0
- Continue reading or reply
Test class error: Invalid initial expression type for field
Hi,
I'm writing a trigger which copies data from the Campaign Member to its Campaign (as cross object workflows don't work from Campaign Members).
I've hit a problem with my test class that I can't get around:
Invalid initial expression type for field Campaign, expecting: SOBJECT:Campaign (or single row query result of that type)
The error is on Line 40, which says:
CampaignMember cm = new CampaignMember(Campaign = cam.Id, Contact = c.Id, Send_tutor_details_to_client__c = 'First');
This is the whole of the test class:
Any help would be greatly appreciated!
I'm writing a trigger which copies data from the Campaign Member to its Campaign (as cross object workflows don't work from Campaign Members).
I've hit a problem with my test class that I can't get around:
Invalid initial expression type for field Campaign, expecting: SOBJECT:Campaign (or single row query result of that type)
The error is on Line 40, which says:
CampaignMember cm = new CampaignMember(Campaign = cam.Id, Contact = c.Id, Send_tutor_details_to_client__c = 'First');
This is the whole of the test class:
@isTest public class TestUpdateTutor1onCampaign{ static testMethod void TestUpdateTutor1onCampaign() { // create an Account, a Tutor, a Job and a Job Member Profile p = [SELECT Id FROM Profile WHERE Name='System Administrator']; User u = new User(Alias = 'standt', Email='standarduser@testorg.com', EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US', LocaleSidKey='en_US', ProfileId = p.Id, TimeZoneSidKey='America/Los_Angeles', UserName='4323f1a8-2698-44c4-a234-dfcf80fa6a6c@testorg.com'); test.StartTest(); insert u; u = [SELECT Id FROM User WHERE Alias = 'standt' AND Email='standarduser@testorg.com']; Account acc = new Account(Name = 'Test Account'); insert acc; acc = [SELECT Id FROM Account WHERE Name = 'Test Account']; //Get the Contact record types List<RecordType> listRecordTypes = [Select Name, Id From RecordType where sObjectType='Contact' and isActive=true]; Map<String,String> mapRecordTypes = new Map<String,String>(); for(RecordType rt: listRecordTypes) { mapRecordTypes.put(rt.Name,rt.Id); } Contact c = new Contact(AccountID = acc.Id, FirstName = 'Test', LastName = 'Contact', Main_Profile__c = 'www.google.com', RecordTypeId = mapRecordTypes.Get('Tutor') ); insert c; c = [SELECT Id FROM Contact WHERE FirstName = 'Test']; Campaign cam = new Campaign(Name = 'Test Job'); insert cam; cam = [SELECT Id FROM Campaign WHERE Name = 'Test Job']; // insert a Campaign Member CampaignMember cm = new CampaignMember(Campaign = cam.Id, Contact = c.Id, Send_tutor_details_to_client__c = 'First'); insert cm; cm = [SELECT Id FROM CampaignMember WHERE Contact =: c.Id AND Send_tutor_details_to_client__c = 'First' ]; system.assertEquals(cam.Tutor_1__c, cm.Tutor_details_for_email__c); List<Campaign> camtest = [SELECT Id FROM Campaign WHERE Tutor_1__c =: cm.Tutor_details_for_email__c]; system.assertEquals(1, camtest.size()); test.StopTest(); } }
Any help would be greatly appreciated!
-
- Olivia Cannon
- July 05, 2014
- Like
- 0
- Continue reading or reply
Trigger to update field on Campaign from Campaign Member failing
Hi,
I'm trying to mimic a workflow field update from the Campaign Member to the Campaign (as it cannot be done via a workflow). What I want is when a picklist (Send_tutor_details_to_client__c) is updated to 'First', the contents of another field on the Campaign Member (Tutor_details_for_email__c) are copied to a corresponding field on the Campaign (Tutor_1__c).
I'm getting an error about sObjects, however, that I don't understand.
This is the trigger:
And this is the error:
sObject type 'Interview_Date_Time_Confirmed__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.
Any help would be very welcome, thanks!
I'm trying to mimic a workflow field update from the Campaign Member to the Campaign (as it cannot be done via a workflow). What I want is when a picklist (Send_tutor_details_to_client__c) is updated to 'First', the contents of another field on the Campaign Member (Tutor_details_for_email__c) are copied to a corresponding field on the Campaign (Tutor_1__c).
I'm getting an error about sObjects, however, that I don't understand.
This is the trigger:
trigger UpdateTutor1onCampaign on CampaignMember (after insert, after update) { Map<ID, Campaign> parentCams = new Map<ID, Campaign>(); List<Id> listIds = new List<Id>(); for (CampaignMember childObj : Trigger.new) { listIds.add(childObj.Campaign); } parentCams = new Map<Id, Campaign>([SELECT id, Tutor_1__c Name,(SELECT ID, Send_tutor_details_to_client__c FROM CampaignMember) FROM Campaign WHERE ID IN :listIds]); for (CampaignMember childObj: Trigger:new){ Campaign myParentCams = parentCams.get(childObj.Campaign); myParentCams.Tutor_1__c = childObj.Send_tutor_details_to_client__c; } update parentCams.values(); }
And this is the error:
sObject type 'Interview_Date_Time_Confirmed__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.
Any help would be very welcome, thanks!
-
- Olivia Cannon
- June 29, 2014
- Like
- 0
- Continue reading or reply
Help with: Invalid initial expression type for field Event.ActivityDate Error
Hi,
I'm writing a trigger to create an event whenever a campaign member is created, but I've hit an issue I don't understand.
This is the trigger:
This is the error I get when I try to save the trigger:
Error: Compile Error: Invalid initial expression type for field Event.ActivityDate, expecting: Date at line 18 column 60
Any help would be very much appreciated!
I'm writing a trigger to create an event whenever a campaign member is created, but I've hit an issue I don't understand.
This is the trigger:
trigger CreateEventforCampaignMember on CampaignMember (after insert) { // 1. create a list of events List <Event> eventsToInsert = new List <Event>(); User usr = [SELECT Id FROM User WHERE FirstName =: 'Mark' AND LastName =: 'Alger' AND IsActive = TRUE LIMIT 1]; // This is to ensure that all events belong to Mark. // 2. for every campaign member being inserted, add to the list of events (this is so that the trigger can handle bulk inserts) for (CampaignMember cm : trigger.new) { eventsToInsert.add( new Event ( EndDateTime = cm.End_Date_of_Event__c, IsPrivate = false, IsRecurrence = false, IsReminderSet = false, OwnerID = usr.Id, ActivityDate = cm.Date_of_Event__c, StartDateTime = cm.Date_of_Event__c, Subject = cm.Subject__c, WhoID = cm.LeadId ) ); } // 3. insert the list of events insert eventsToInsert; }
This is the error I get when I try to save the trigger:
Error: Compile Error: Invalid initial expression type for field Event.ActivityDate, expecting: Date at line 18 column 60
Any help would be very much appreciated!
-
- Olivia Cannon
- June 23, 2014
- Like
- 0
- Continue reading or reply
Unknown DatetimeMethod line in debug log
Hi,
I've written a trigger to create an Event when a Campaign Member is created but it's not actually working and I don't understand what the debug log is telling me.
This is the trigger:
And this is the relevant part of the debug log:
I don't understand what 'com.salesforce.api.interop.apex.bcl.DatetimeMethods.date()' means - why is it failing?!
Any help would be gratefully received, thanks!
I've written a trigger to create an Event when a Campaign Member is created but it's not actually working and I don't understand what the debug log is telling me.
This is the trigger:
trigger CreateEventforCampaignMember on CampaignMember (after insert) { // 1. create a list of events List <Event> eventsToInsert = new List <Event>(); User usr = [SELECT Id FROM User WHERE FirstName =: 'Mark' AND LastName =: 'Alger' AND IsActive = TRUE LIMIT 1]; // This is to ensure that all events belong to Mark. try { // 2. for every campaign member being inserted, add to the list of events (this is so that the trigger can handle bulk inserts) for (CampaignMember cm : trigger.new) { system.debug('*** cm.Id ' + cm.Id); system.debug('*** cm.Date_of_Event__c.Date() = ' + cm.Date_of_Event__c.Date()); system.debug('*** cm.Date_of_Event__c = ' + cm.Date_of_Event__c); eventsToInsert.add( new Event ( DurationInMinutes = 1440, IsAllDayEvent = true, IsPrivate = false, IsRecurrence = false, IsReminderSet = false, OwnerID = usr.Id, ActivityDate = cm.Date_of_Event__c.Date(), StartDateTime = cm.Date_of_Event__c, Subject = cm.Subject__c, //WhatId = cm.CampaignId, WhoID = cm.LeadId ) ); } } catch (NullPointerException e) { system.debug('*** CreateEventforCampaignMember failed'); } // 3. insert the list of events insert eventsToInsert; }
And this is the relevant part of the debug log:
19:41:52.434 (434744296)|EXECUTION_STARTED 19:41:52.434 (434791731)|CODE_UNIT_STARTED|[EXTERNAL]|01qb0000000N42N|CreateEventforCampaignMember on CampaignMember trigger event AfterInsert for [00vb0000007Zq7h] 19:41:52.435 (435824204)|SYSTEM_CONSTRUCTOR_ENTRY|[4]|<init>() 19:41:52.435 (435872133)|SYSTEM_CONSTRUCTOR_EXIT|[4]|<init>() 19:41:52.436 (436283008)|SOQL_EXECUTE_BEGIN|[6]|Aggregations:0|select Id from User where (FirstName = :tmpVar1 and LastName = :tmpVar2 and IsActive = true) limit 1 19:41:52.446 (446302734)|SOQL_EXECUTE_END|[6]|Rows:1 19:41:52.446 (446522638)|SYSTEM_METHOD_ENTRY|[11]|LIST<CampaignMember>.iterator() 19:41:52.446 (446698513)|SYSTEM_METHOD_EXIT|[11]|LIST<CampaignMember>.iterator() 19:41:52.446 (446729142)|SYSTEM_METHOD_ENTRY|[11]|system.ListIterator.hasNext() 19:41:52.446 (446762026)|SYSTEM_METHOD_EXIT|[11]|system.ListIterator.hasNext() 19:41:52.446 (446858980)|SYSTEM_METHOD_ENTRY|[12]|String.valueOf(Object) 19:41:52.446 (446904223)|SYSTEM_METHOD_EXIT|[12]|String.valueOf(Object) 19:41:52.446 (446934115)|SYSTEM_METHOD_ENTRY|[12]|System.debug(ANY) 19:41:52.446 (446949030)|USER_DEBUG|[12]|DEBUG|*** cm.Id 00vb0000007Zq7hAAC 19:41:52.446 (446956406)|SYSTEM_METHOD_EXIT|[12]|System.debug(ANY) 19:41:52.447 (447002590)|SYSTEM_METHOD_ENTRY|[13]|com.salesforce.api.interop.apex.bcl.DatetimeMethods.date() 19:41:52.447 (447092751)|SYSTEM_METHOD_EXIT|[13]|com.salesforce.api.interop.apex.bcl.DatetimeMethods.date() 19:41:52.447 (447136684)|SYSTEM_METHOD_ENTRY|[33]|System.debug(ANY) 19:41:52.447 (447165602)|USER_DEBUG|[33]|DEBUG|*** CreateEventforCampaignMember failed 19:41:52.447 (447173944)|SYSTEM_METHOD_EXIT|[33]|System.debug(ANY)
I don't understand what 'com.salesforce.api.interop.apex.bcl.DatetimeMethods.date()' means - why is it failing?!
Any help would be gratefully received, thanks!
- Olivia Cannon
- July 27, 2014
- Like
- 0
- Continue reading or reply
Test class failing: List has no rows for assignment to SObject
Hi,
My test class is failing and I don't understand why - any help would be very gratefully received!
This is the error message:
Error Message: System.QueryException: List has no rows for assignment to SObject
Stack Trace: Class.TestUpdateTutor1onCampaign.TestUpdateTutor1onCampaign: line 37, column 1
This is line 37: cam = [SELECT Id FROM Campaign WHERE Name = 'Test Job'];
This is the test class as a whole:
Thank you!
My test class is failing and I don't understand why - any help would be very gratefully received!
This is the error message:
Error Message: System.QueryException: List has no rows for assignment to SObject
Stack Trace: Class.TestUpdateTutor1onCampaign.TestUpdateTutor1onCampaign: line 37, column 1
This is line 37: cam = [SELECT Id FROM Campaign WHERE Name = 'Test Job'];
This is the test class as a whole:
@isTest public class TestUpdateTutor1onCampaign{ static testMethod void TestUpdateTutor1onCampaign() { // create an Account, a Tutor, a Job and a Job Member Profile p = [SELECT Id FROM Profile WHERE Name='System Administrator']; User u = new User(Alias = 'standt', Email='standarduser@testorg.com', EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US', LocaleSidKey='en_US', ProfileId = p.Id, TimeZoneSidKey='America/Los_Angeles', UserName='4323f1a8-2698-44c4-a234-dfcf80fa6a6c@testorg.com'); test.StartTest(); insert u; u = [SELECT Id FROM User WHERE Alias = 'standt' AND Email='standarduser@testorg.com']; Account acc = new Account(Name = 'Test Account'); insert acc; acc = [SELECT Id FROM Account WHERE Name = 'Test Account']; //Get the Contact record types List<RecordType> listRecordTypes = [Select Name, Id From RecordType where sObjectType='Contact' and isActive=true]; Map<String,String> mapRecordTypes = new Map<String,String>(); for(RecordType rt: listRecordTypes) { mapRecordTypes.put(rt.Name,rt.Id); } Contact c = new Contact(AccountID = acc.Id, FirstName = 'Test', LastName = 'Contact', Main_Profile__c = 'www.google.com', RecordTypeId = mapRecordTypes.Get('Tutor') ); insert c; c = [SELECT Id FROM Contact WHERE FirstName = 'Test']; Campaign cam = new Campaign(Name = 'Test Job', Tutor_1__c = null); insert cam; cam = [SELECT Id FROM Campaign WHERE Name = 'Test Job']; // insert a Campaign Member CampaignMember cm = new CampaignMember(CampaignId = cam.Id, ContactId = c.Id, Send_tutor_details_to_client__c = 'First'); insert cm; cm = [SELECT Id FROM CampaignMember WHERE ContactId =: c.Id AND Send_tutor_details_to_client__c = 'First' ]; system.assertEquals(cam.Tutor_1__c, cm.Tutor_details_for_email__c); List<Campaign> camtest = [SELECT Id FROM Campaign WHERE Id =: cam.Id ]; system.assertEquals(cam.Tutor_1__c, cm.Tutor_details_for_email__c); test.StopTest(); } }
Thank you!
- Olivia Cannon
- July 09, 2014
- Like
- 0
- Continue reading or reply
Trigger to update field on Campaign from Campaign Member failing
Hi,
I'm trying to mimic a workflow field update from the Campaign Member to the Campaign (as it cannot be done via a workflow). What I want is when a picklist (Send_tutor_details_to_client__c) is updated to 'First', the contents of another field on the Campaign Member (Tutor_details_for_email__c) are copied to a corresponding field on the Campaign (Tutor_1__c).
I'm getting an error about sObjects, however, that I don't understand.
This is the trigger:
And this is the error:
sObject type 'Interview_Date_Time_Confirmed__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.
Any help would be very welcome, thanks!
I'm trying to mimic a workflow field update from the Campaign Member to the Campaign (as it cannot be done via a workflow). What I want is when a picklist (Send_tutor_details_to_client__c) is updated to 'First', the contents of another field on the Campaign Member (Tutor_details_for_email__c) are copied to a corresponding field on the Campaign (Tutor_1__c).
I'm getting an error about sObjects, however, that I don't understand.
This is the trigger:
trigger UpdateTutor1onCampaign on CampaignMember (after insert, after update) { Map<ID, Campaign> parentCams = new Map<ID, Campaign>(); List<Id> listIds = new List<Id>(); for (CampaignMember childObj : Trigger.new) { listIds.add(childObj.Campaign); } parentCams = new Map<Id, Campaign>([SELECT id, Tutor_1__c Name,(SELECT ID, Send_tutor_details_to_client__c FROM CampaignMember) FROM Campaign WHERE ID IN :listIds]); for (CampaignMember childObj: Trigger:new){ Campaign myParentCams = parentCams.get(childObj.Campaign); myParentCams.Tutor_1__c = childObj.Send_tutor_details_to_client__c; } update parentCams.values(); }
And this is the error:
sObject type 'Interview_Date_Time_Confirmed__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.
Any help would be very welcome, thanks!
- Olivia Cannon
- June 29, 2014
- Like
- 0
- Continue reading or reply
Help with: Invalid initial expression type for field Event.ActivityDate Error
Hi,
I'm writing a trigger to create an event whenever a campaign member is created, but I've hit an issue I don't understand.
This is the trigger:
This is the error I get when I try to save the trigger:
Error: Compile Error: Invalid initial expression type for field Event.ActivityDate, expecting: Date at line 18 column 60
Any help would be very much appreciated!
I'm writing a trigger to create an event whenever a campaign member is created, but I've hit an issue I don't understand.
This is the trigger:
trigger CreateEventforCampaignMember on CampaignMember (after insert) { // 1. create a list of events List <Event> eventsToInsert = new List <Event>(); User usr = [SELECT Id FROM User WHERE FirstName =: 'Mark' AND LastName =: 'Alger' AND IsActive = TRUE LIMIT 1]; // This is to ensure that all events belong to Mark. // 2. for every campaign member being inserted, add to the list of events (this is so that the trigger can handle bulk inserts) for (CampaignMember cm : trigger.new) { eventsToInsert.add( new Event ( EndDateTime = cm.End_Date_of_Event__c, IsPrivate = false, IsRecurrence = false, IsReminderSet = false, OwnerID = usr.Id, ActivityDate = cm.Date_of_Event__c, StartDateTime = cm.Date_of_Event__c, Subject = cm.Subject__c, WhoID = cm.LeadId ) ); } // 3. insert the list of events insert eventsToInsert; }
This is the error I get when I try to save the trigger:
Error: Compile Error: Invalid initial expression type for field Event.ActivityDate, expecting: Date at line 18 column 60
Any help would be very much appreciated!
- Olivia Cannon
- June 23, 2014
- Like
- 0
- Continue reading or reply