Skip to main content
New
Stack Overflow Jobs powered by Indeed: A job site that puts thousands of tech jobs at your fingertips (U.S. only). Search jobs
12 votes
Accepted

Trigger not updating field in Test Class

The error is in your Status. In the trigger you've got: if (l.Status =='Open- Not Contacted') (note the n- N), and in your test class you create it as: ld.Status='Open -Not Contacted'; (note the n ...
Novarg's user avatar
  • 5,264
11 votes
Accepted

Apex - Task.What.Type

You don't get cross-object fields in the trigger context. You would need to query for them. However, you can get the SObjectType instead and spare yourself the query. if (T.WhatId != null && ...
Adrian Larson's user avatar
  • 150k
11 votes
Accepted

Formula field is not working as expected

Assuming your formula was copied directly from salesforce.com, the problem has to do with "Smart Quotes." Salesforce formulas don't recognize “ and ” as actual quotation marks. Try using the following:...
sfdcfox's user avatar
  • 494k
8 votes
Accepted

Remove tabs from activities in lightning

For removing the actions in Lightning, Go to Setup->Object Manager then select the object. Go to page layouts and edit the Page layout currently assigned. Under "Salesforce Mobile and Lightning ...
Sanket Mandhare's user avatar
7 votes
Accepted

New Task Action missing in Lightning Experience

When viewing the Activity composer related list, you may notice that some activity actions within the lightning experience do not appear on records even though those actions have been added to the ...
Diksha Goel's user avatar
7 votes

Entity 'Task' is not supported for semi join inner selects

You need to split out a separate query. As the error states, you can't use this join: Id NOT IN (Select WhatId from Task) One possible approach to splitting out the query: Set<Id> ...
Adrian Larson's user avatar
  • 150k
6 votes
Accepted

get all task related to contact in developer console

You will need to SOQL Contact first then feed the Tasks List with those ContactIds to get the related Tasks. Contact SOQL Contact[] cons = [SELECT id from Contact ]; Now, feed these ContactIDs to ...
Mahmood's user avatar
  • 5,944
6 votes
Accepted

How to use an Apex Email Service to store emails on a record EXACTLY as Salesforce does?

From what I understand, You don't need to create a task to insert an EmailMessage. Email message has relatedToId field which you can use to directly link it to any desired record. As relatedToId is ...
Pranay Jaiswal's user avatar
5 votes

Prevent task deletion by anyone other than task creator

You need to write a delete trigger. Validations should happen before delete. You can get the Id of the running user via UserInfo.getUserId(). You can compare the CreatedById to the running user Id. ...
Adrian Larson's user avatar
  • 150k
5 votes

Activities on Leads, Opportunities, and Accounts SOQL

The object you should query is OpenActivity and ActivityHistory So your query should be SELECT Report_Country_L__c, (SELECT Owner.Name,ActivityDate,Status,istask,ActivitySubtype, Subject FROM ...
Vigneshwaran G's user avatar
5 votes
Accepted

No such column 'Type' on entity 'LookedUpFromActivity'

If you look at LookedUpFromActivity object. There is no Type field, instead you can use ActivityType or ActivitySubtype field
Raul's user avatar
  • 18.8k
5 votes
Accepted

SOQL aggregate functions do not work with Task.ActivityDate

I have found a workaround by creating a custom field of type date under the Activity object called ActivityDate__c. Thus we can reformulate the initial query as SELECT WhoID, COUNT(Id), MIN(...
catalandres's user avatar
5 votes
Accepted

Apex trigger not creating task

What is wrong with this specific code, why is it not creating a new task on the donation? You didn't actually call the code that commits data to the database, as in: insert taskList; Which you ...
sfdcfox's user avatar
  • 494k
5 votes
Accepted

What happens when I delete the Task related to an EmailMessage?

Note: Some of the following is conclusions my team reached for which we could not find explicit documentation; Salesforce support eventually confirmed our findings, just this past week. The ...
Jason Clark's user avatar
  • 11.9k
5 votes
Accepted

PrePopulate Task with related data even before creating a Task

Triggers are supposed to work that way. They do not pre-populate data on the screens but only update it during the transaction. Out of the box, you will not be able to pre-populate data. If you can ...
Jayant Das's user avatar
  • 30.6k
5 votes
Accepted

"Variable does not exist: Type" when creating a Task

Usually this problem happens when the FLS is not enabled for the user's profile. First thing to check in such cases is to create the record from Salesforce UI to verify if the field is visible.
Raul's user avatar
  • 18.8k
5 votes
Accepted

Query Task.Who.Owner.Email in SOQL

WhoId and WhatId on the Task SObject are polymorphic relationship fields. They can hold an Id (just one Id) from a variety of different SObjects, so the standard way of querying/accessing parent data ...
Derek F's user avatar
  • 62.1k
4 votes

Cannot query UserRecordAccess for Tasks

Why? The reason why is that activities are expensive to calculating sharing for. While this isn't called out in any manual I could find, I'm certain that's the reason. If you haven't noticed, ...
sfdcfox's user avatar
  • 494k
4 votes

Enabling Editing/Deleting others' Tasks without "Modify All"

There's no general "configuration-only" solution to this problem. You'll need a way to bypass sharing to allow deletion. Here's some choices (some of which are already noted in the comments): Custom ...
sfdcfox's user avatar
  • 494k
4 votes

Task and Event in salesforce

Here, I have tried to show if opportunities are getting closed then it will search for any open tasks exists. If open task exists it will throw the error. Otherwise, you can proceed to call ...
Santanu Boral's user avatar
4 votes
Accepted

Does the "Only" part of the "Due Date Only" label of Task.ActivityDate have some significance?

It seems likely we can attribute it to the linkage of Event and Task as Activities, and the fact that Event has a field called ActivityDateTime in addition to ActivityDate. system.debug(Task....
Adrian Larson's user avatar
  • 150k
4 votes

Trigger not updating field in Test Class

Among the other answers here you will still need to move this line to be after you insert your task. Lead Getleadupdated = [SELECT Status FROM Lead where ID = : createlead.id]; Otherwise the value ...
dBeltowski's user avatar
  • 3,038
4 votes
Accepted

How to stop workflow execution when Task Status is set to "Completed"?

You should include status not equal to Completed in the rule criteria. Refer Will the pending actions in the queue ALWAYS trigger? Time-dependent actions remain in the Workflow Queue until ...
Santanu Boral's user avatar
4 votes

Populating Task Subtype field with Call when a task created

Task.TaskSubtype is createable, but not updateable. This means it's amenable to being populated only at the time of the record's creation, without firing an update DML operations. Practically, that ...
David Reed's user avatar
  • 93.1k
4 votes
Accepted

Activities past due dates are still displaying in Next Steps section in LEX

Yes, you'll notice the dates are highlighted in red, which indicates that they are open tasks that are past due. This same behavior happens in Classic as well on places where you can view open tasks (...
sfdcfox's user avatar
  • 494k
4 votes

Where is metadata for custom list view on Task?

Adding onto @sfdcfox and @DavidReed answers, you could do a direct pull of the list view with: sfdx force:source:retrieve -m ListView:Task.My_Task_List_View -u MyConnectedOrg
Brian Miller's user avatar
  • 5,222
4 votes

How to Assign Enter Key to specific Button in vf page

I do not see any JS code on your page which is outlined in the reference you linked to and said you used so I am not sure how much more help this will be since it is essentially restating what was in ...
Eric's user avatar
  • 54.2k
4 votes
Accepted

SOQL Query To Return Any Open Tasks Assigned To a User

You are retrieving information about the related Account but that doe not mean the Owner of the Task matches the Account Name. SELECT Id, AccountId, Account.Name FROM Task WHERE Owner.Name = 'John ...
TSmith's user avatar
  • 5,032
4 votes
Accepted

How to perform field update before a Validation Rule? (without code)

Combining a declarative field update with a validation rule is a creative idea. Some people would go right for code! You're right about it being impossible though, since custom validation rules run ...
Dean M.'s user avatar
  • 96
4 votes
Accepted

how to update lastmodified field whenever any user updated task

You can't write to LastModifiedById. Even if you could, this line Plan.LastModifiedBy.Id = cop.Tasks.OwnerId wouldn't work for a couple of reasons: Changes to a related object (LastModifiedBy) don'...
David Reed's user avatar
  • 93.1k

Only top scored, non community-wiki answers of a minimum length are eligible