You need to sign in to do that
Don't have an account?
k practice
How to move contact related tasks and events to Account?
Hi,
List < Task > listofTaskRelatedtoBusinessAccountContact = [SELECT Id,WhoId,Whatid FROM Task WHERE WhoId = : contactid];
List < Event > listofEventsRelatedtoBusinessAccountContact = [SELECT Id,WhoId,Whatid FROM Event WHERE WhoId = : contactid];
for (Task iterateContactTask: listofTaskRelatedtoBusinessAccountContact) {
iterateContactTask.WhatId = pAccount.id;
}
for (Event iterateContactEvent: listofEventsRelatedtoBusinessAccountContact) {
iterateContactEvent.WhatId = pAccount.id;
}
try {
update listofTaskRelatedtoBusinessAccountContact;
} catch (Exception e) {}
try {
update listofEventsRelatedtoBusinessAccountContact;
} catch (Exception e) {}
How to update Contact related Tasks and events To Personal account?
help me........
List < Task > listofTaskRelatedtoBusinessAccountContact = [SELECT Id,WhoId,Whatid FROM Task WHERE WhoId = : contactid];
List < Event > listofEventsRelatedtoBusinessAccountContact = [SELECT Id,WhoId,Whatid FROM Event WHERE WhoId = : contactid];
for (Task iterateContactTask: listofTaskRelatedtoBusinessAccountContact) {
iterateContactTask.WhatId = pAccount.id;
}
for (Event iterateContactEvent: listofEventsRelatedtoBusinessAccountContact) {
iterateContactEvent.WhatId = pAccount.id;
}
try {
update listofTaskRelatedtoBusinessAccountContact;
} catch (Exception e) {}
try {
update listofEventsRelatedtoBusinessAccountContact;
} catch (Exception e) {}
How to update Contact related Tasks and events To Personal account?
help me........
What do you mean by Move? Do you want to remove them from Contact?
In that case you need to also change the Who Id of Activities with Person Contact Id
How about this? Also check the debug log for errors
Thank you for your reply.I tried like below its working .Please expline why whoid NULL Here.
or (Task iterateContactTask: listofTaskRelatedtoBusinessAccountContact) {
iterateContactTask.Whoid=NULL;
iterateContactTask.WhatId = pAccount.id;
}
for (Event iterateContactEvent: listofEventsRelatedtoBusinessAccountContact) {
iterateContactEvent.Whoid=NULL;
iterateContactEvent.WhatId = pAccount.id;
}
try {
update listofTaskRelatedtoBusinessAccountContact;
} catch (Exception e) {}
try {
update listofEventsRelatedtoBusinessAccountContact;
} catch (Exception e) {}
That was why, we were not able to give WhoId,
I guess my reply should have worked for you, have you tried it?