• Ken Koellner 7
  • NEWBIE
  • 35 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 62
    Questions
  • 64
    Replies

I want to start prototyping a Lightning Web Component to create AND edit a record in a custom object.  All the examples I found have one component for Edit and one Component for Create.  

Anyone have an example of a component that does BOTH edit AND create?

 

I have some Apex code that inserts Events and EventRelation records and I'm doing a bit of work on it.  It is coded to insert multiple EventRelation records and the relationId field on those records may point to various Leads.  I set IsInvitee on the records to false.  But when I read those records back, the Isinvitee field is being change to true.  I have't found anything on the behavior in the documentation. The documentation appears to state that only one Lead may be associated with the Event but that seems incorrect.  I created an Event with the Lightning UI, and we easily able to start for multiple Leads and add them.  An image is shown below and the records are shown below.

I want to do the same thing in Apex but leave IsInvitee as false.  Anyone know if there's a way to force that? 

 

Both Bertha Boxer and Phyllis Cotton are LEads.
User-added image

Note that both records have 00Q in RelationId indicating a Lead.

AccountId	EventId	Id	IsInvitee	IsParent	IsWhat	RelationId	Status
1		00U2M00000QFPxZUAX	0RE2M00000MrGQQWA3	true	false	false	00Q4100000JQczNEAT	New
2		00U2M00000QFPxZUAX	0RE2M00000MrGQPWA3	true	false	false	00Q4100000JQczOEAT	New

 

I'm working with Change Date Capture and have a trigger EventChangeEvent (after insert) so I can handle the change in Apex.

My test method works fine with "insert Event".  The change is delivered and the trigger is fired and all downstream processing in Apex (including a subsequent Queueable) works fine.

My test method for delete isn't working.  The Change Event is never delivered to the trigger.  The @setup method sets up the data I want to delete in the test.  The logic is --

Event myEvent = [ SOQL query to get Event that was inserted in @setup];

Test.enableChangeDataCapture();
Test.startTest();

delete sfEvent;

Test.getEventBus().deliver();

Test.stopTest();

The reason there is both a deliver() and a stopTest() is that the deliver should cause the Change record to be delivered.  The stopTest() will fire a Queueable.   I used that exact pattern in my insert test and it works fine.

My insert test has logic like shown below and it works fine.  First the change event is delivered to the trigger and then the queueble runs.  (If I don't put in the deliver() call, things run out of order and the result is incorrect.)

Test.enableChangeDataCapture();
Test.startTest();

Event sfEvent = new Event (fill in fields in Event);
insert sfEvent;

Test.getEventBus().deliver();

Test.stopTest();

This isn't so much a question as an observation, unless someone knows a work around.

It's nice the Apex debug logs now show an explanation of the query plan for SOQL as shown below --
 

10:00:09.343 (6541134992)|SOQL_EXECUTE_EXPLAIN|[150]|Index on Event : [Meeting__c], cardinality: 1, sobjectCardinality: 12760, relativeCost 0.001


However, it only does that for static SOQL.  For dynamic SOQL, it doesn't show a query plan--

10:00:09.343 (6677301225)|SOQL_EXECUTE_EXPLAIN|[312]|No explain plan is available

There are some cases where I wanted to check that a generated query was efficient so I had to extract the SOQL generated, then run it manually in Dev Console to check it.

It would be nice if debug also showed query plans for Dynamic SOQL.
<ui:inputText click="{!c.onfocus}" updateOn="keyup" keyup="{!c.keyPressController}" class="slds-lookup__search-input slds-input leftPaddingClass" value="{!v.searchTerm}" placeholder="search..."/>
Support for the ui: tags is supposed to be ending.  What I don't see in the lightning: tags is an equivelent to ui:inputText.  I have the tag above and am wondering what the best thing to replace it with is and if the same options will be available.  I haven't found anything that exactly matches and so I'm researching what to do to get the equivelent functionality.
 
Question on when the next release hits the prerelease nodes.  I have a prerelease org I've been using for a while.  In Summer '21, the SLDS styles with "--" are supposed to be removed and the styles with "_" must be used instead.  I loaded a VF page in one of my orgs running on a prerelease node.  I see items like ".slds-tabs--default" in the sheet in addition to items like ".slds-tabs_default".  I would think that indicates either Summer '21 as not fully hit this prerelease node or that the change is not exactly as was documented; this change was announced for Summer '21 back in the Winter '21 release notes.
We're noticed in one org that has 12 Process Builder flows that do field updates on fields on Events, that everytime the record is updated, the trigger filres 13 times.  Anyone know is that is new behavior in Spring '21 or if it always was that way?

Yes, I know it would be much bette to use before-save flows but this isn't our org so we can't change it.
I'm experimenting with Change Event Apex Triggers to subscribe to Change Data Capture.  My simple tests just to inspect the payloads work fine.  The documentation says the batch size can be up to 2000 records.  The use case I'm considering involves a fair amount of work doing callouts and would likely fail with a batch that large.  What I'd like to do is limit the batch size.  I know there is a way to do that with triggers on Platform Events.  But, I do not know if that can be done on Change Event Triggers.  Does anyone know if batch size can be limited specifically on Change Event Triggers?  If so, how to do it?



I know everyone wants to be as helpful as possible but please read the question carefully.  It won't help to answer a different question.
We have an existing testing utility that uses the Tooling API.  It is written using the SOAP version, not the REST version.  I know I can query for the latest log for the user.  I know there is a REST API to get the debug log body.  But, I'd rather not have to recode using REST or mix REST/SOAP if I don't have to. 

I tried the example below.  The getDebuggingInfo() call returns null.  If I got that back, I could call getDebugLog() on that to get the body.  The comments at the end are simply notes of where I would start if I wanted to mix in REST.
com.sforce.soap.tooling.LogInfo[] logList = new com.sforce.soap.tooling.LogInfo[1];
        logList[0] = new com.sforce.soap.tooling.LogInfo();
        logList[0].setCategory(com.sforce.soap.tooling.LogCategory.Apex_code);
        logList[0].setLevel(com.sforce.soap.tooling.LogCategoryLevel.Fine);        
        ExecuteAnonymousResult apexResult = conn.executeAnonymous ("System.debug('Hello.');");
        System.out.println(apexResult);
        com.sforce.soap.tooling.DebuggingInfo_element debuggingInfo = conn.getDebuggingInfo();
        System.out.println(debuggingInfo);
        com.sforce.soap.tooling.GetUserInfoResult userResult = conn.getUserInfo();
        String userId = userResult.getUserId();
        System.out.println(userId);
        // SELECT Id FROM ApexLog WHERE LogUserId = userId ORDER BY LastModifiedDate DESC LIMIT 1
        // /services/data/v49.0/sobjects/ApexLog/07L4p00000FU34uEAD/Body

Below is the output --
[ExecuteAnonymousResult  column='-1'
 compileProblem='null'
 compiled='true'
 exceptionMessage='null'
 exceptionStackTrace='null'
 line='-1'
 success='true'
]

null
005460000010bMfAA

Anyone know a way to get the Debug Log body with SOAP?  Or am I going to have to mix in a REST request?  Or maybe the flags aren't set properly to get the log and that's why getDebuggingInfo is returning null?
 
I know that when a Lead and an open Event are both ownere by user "A" and the Lead owner is updated to user "B" then the Event owner is automatically updated to have Owner "B".  I'd like to prevent that, or at least detect it so that I can do something down stream.

When I put debug on and update the Lead, I do not see Event udpate triggers fire.  Even the the Event is updated, the owner changes, and the Last Modified Date changes, it's as if no update DML happened.  I suspect that I can't do any work with an Update Trigger on Event to handle this situtation.

I suppose I could put an update trigger on Lead, then in that trigger do a query for open Events owned by the Lead, but I really don't want to get in the game of implementation another trigger.  I already have a trigger on Event that handles when the Owner may be updated and any other activity associated with the Event Owner change.
This release note https://releasenotes.docs.salesforce.com/en-us/winter21/release-notes/rn_slds_bem_deprecate.htm?edition=&impact= (https://releasenotes.docs.salesforce.com/en-us/winter21/release-notes/rn_slds_bem_deprecate.htm?edition=&impact=) says that versions 2.13.0 and newer of SLDS will change so that "--" will be replaced with "_".  We use SLDS in Visualforce via the <apex:slds/> tag.  Is there anyway to tell what version of SLDS is injected into the page?  I would think if it's a version 2.13.0 or newer then we will have to change any references with the old "--" to "_" which means change some VF code.  Anyone have any other thoughts on the impact of that notice and VF pages that use SLDS?
The Auth. Provider setup page allows entering a Customer Key and Consumer Secret.  We would like it to work so that after an admin has entered the secret, it cannot be viewed on the setup page, much like the way a password can work.  You can enter into the field but once saved, it become masked with stars and you can never view it again.  This setup page has a Reveal button that will show it.  Is there any way to disable that?



Please do not respond with an answer to a different but related question or a link to the documentation page [I have already read https://help.salesforce.com/articleView?err=1&id=sso_provider_global_auth.htm&type=5] and then ask for me to vote your answer best answer.  I will instantly vote your answer as best answer if it really answers this specific question.
I have a program that connects via the Parnter API does queries and DMLs.  I've set Debug Logging on for the User which the program uses to log in.  But, I'm not seeing any Debug Logs appear.  Could that be because the program is not sending debug headers in the request?  I can't modify the program.  I'm wondering if there is anything I can do to force SF to generate a debug log each time it makes a request.  I need to analyze some of the work it does.
Does anyone know if there are any standard fields that are dependent picklists?

I want to write some tests for a piece of functionality that makes use of dependent picklists that will run in any org without manual setup or additional data definition.  If there are none, then I'll need a setup script to create some in each org.  But it would be easier if I could make use of at least one that is always there.  In fact, all I need is one.
 
I've turned on Einstein Activity Capture in a dev environment and connected to an Outlook 365 mailbox.  When I create an Event in Outlook, I see it twice.  It replicates and there is an Event in SF on under My Calendar.  I also have a Calendar named Microsoft Office 365.  I see it there also.  (The formers shows up in a SOQL query result and the later does not.)

I appears that EAC is both giving me a view into my Office 365 calendar AND replicating Events.  That's rather confusing so I'm wondering if it's working correctly of if maybe something should be turned off.

Perhaps that is corrrect and users to select on one of the two calendars to view and work only off that calendar.  But I want to check and see what is the correct way to use the product.
We have a legacy VisualForce page that overrides the standard Edit button.  So, in Classic or Lightning, when you press the Edit button on the record Detail page, the VF page comes up.  There is one glitch when in  Lightning Experience. When you save from the Edit page, you end up back on the Lightning Detail page but the old data (which must be in the Lightning cache somewhere) is still shown.  You have to manually refresh to get the latest data.

I'm wondering if there's any kind of trick when leaving the VF page to go back to Lightning and force it to reload.  I can't find any way to do it by passing back any sort of PageReference, with or without redirect.

Maybe there's some kinda of trick where it can go back to the VF page and the VF page could have an onComplete script that would somehow force lightning to reload the record.
I'd like to put up a list of items such that all are always visible, not like a combo box / dropdown.  One is preselected and the user may leave it or select a different one.  I can do it with a single tag with lightning:radioGroup.  But radioGroup only always the label to be text.  I'd like to have a litlte block with an icon and a name.  I'd like something like the example "Tiles in a List" on lightning-tile where one item may be selected.

Any idea of a tag, combination of tags, are styles to do that, preferable a snippet of code as an example.
I'm working on a lightning component that will run on both a quick action and in a VF page.  I know toast doesn't work when the component is in VF.  It appears showNotice() doesn't either.

Is there a prefered way to put up an error message when the component is run both from LEX and via VF?

The use case is the component does a call to an Apex aura controller and certain conditions can't be fulfilled, it returns a message.  The messasge instructs the user on what they have to fix before they resubmit.  

I considered just putting a message on a field for this specific error but it concerns a lightning:select and, unlike lighting:input, lightning:select won't let you put a custom error on it.  
I've noticed in Apex test methods, when emial is sent via singleemailmessage, the email message is inserted in EmailMessage.  (That is assuming the org as EmailMessage turned on.)  It's really useful for checking correct functionality in test methods to query EmailMessage and check the email.

But for email sent to Users, I don't see records being created in EmailMessge.  Anyone know if there's a way to get them?  Or some other way to check the sent email that goes to Users during test methods?

I'd like to add some more asserts to my test methods to check email to Users but haven't found a way to do it.
Data Protection and Privacy, Contact Point Email, does it do anything beside simply let you record information?


To learn the Contact Point feature, I turned on Data Protection and Privacy, added the Individual field to a Contact page layout, created a few Individuals off of Contacts, and added a few Contact Point Email and Contact Point Phone records.

Does this feature do anything beyond that?  For all SF features like Email off a record, does it still just use the regular Email field on Contact and Lead?


So far, all I can tell is that it let's you store that information, and of course the other values like the consent records.  I do so any place where SF uses those records.  Am I missing something or is that all there is?
I'd like to get the Sites domain that configured for an org via Apex in order to automate some setup work.  I haven't found a way to do that.  It's probably not there but just in case I missed it in the documentation I figured I'd ask if anyone knows if there's any kind of metadata call to get it.

This is not specific to any one site and VF is not in place so anything that only exists in the context of an executing Site will not work.
I have a VF page that uses Lightning Design System (SLDS) to get a Lightning look-and-feel.  It works fine in Classic and it's also totally fine that it looks like Lightning in Classic.  But I have an issue with an apex:inputField tag for an sObect field that is lookup(Account).  When in Classic, the lookup icon appears next to the field and it works fine.  But when in Lightning, the icon doesn't appear and the field just acts like a text entry field and doesn't work correctly.

Anyone know if there's a way to get the regular lookup dialog from an apex:inputField tag in a VF page using SLDS when in Lighting?

I did some searching and found some public code with examples for doing lookups (and also native Lightning aura code which I do not need).  But I'd had to take what could be a single tag in Classic and have to replace it with 150 lines of custom code to get it to work in Lightning.

Anyone know the easiest solution to get it to work?

 

I want to start prototyping a Lightning Web Component to create AND edit a record in a custom object.  All the examples I found have one component for Edit and one Component for Create.  

Anyone have an example of a component that does BOTH edit AND create?

 

This isn't so much a question as an observation, unless someone knows a work around.

It's nice the Apex debug logs now show an explanation of the query plan for SOQL as shown below --
 

10:00:09.343 (6541134992)|SOQL_EXECUTE_EXPLAIN|[150]|Index on Event : [Meeting__c], cardinality: 1, sobjectCardinality: 12760, relativeCost 0.001


However, it only does that for static SOQL.  For dynamic SOQL, it doesn't show a query plan--

10:00:09.343 (6677301225)|SOQL_EXECUTE_EXPLAIN|[312]|No explain plan is available

There are some cases where I wanted to check that a generated query was efficient so I had to extract the SOQL generated, then run it manually in Dev Console to check it.

It would be nice if debug also showed query plans for Dynamic SOQL.
<ui:inputText click="{!c.onfocus}" updateOn="keyup" keyup="{!c.keyPressController}" class="slds-lookup__search-input slds-input leftPaddingClass" value="{!v.searchTerm}" placeholder="search..."/>
Support for the ui: tags is supposed to be ending.  What I don't see in the lightning: tags is an equivelent to ui:inputText.  I have the tag above and am wondering what the best thing to replace it with is and if the same options will be available.  I haven't found anything that exactly matches and so I'm researching what to do to get the equivelent functionality.
 
I'm experimenting with Change Event Apex Triggers to subscribe to Change Data Capture.  My simple tests just to inspect the payloads work fine.  The documentation says the batch size can be up to 2000 records.  The use case I'm considering involves a fair amount of work doing callouts and would likely fail with a batch that large.  What I'd like to do is limit the batch size.  I know there is a way to do that with triggers on Platform Events.  But, I do not know if that can be done on Change Event Triggers.  Does anyone know if batch size can be limited specifically on Change Event Triggers?  If so, how to do it?



I know everyone wants to be as helpful as possible but please read the question carefully.  It won't help to answer a different question.
We have an existing testing utility that uses the Tooling API.  It is written using the SOAP version, not the REST version.  I know I can query for the latest log for the user.  I know there is a REST API to get the debug log body.  But, I'd rather not have to recode using REST or mix REST/SOAP if I don't have to. 

I tried the example below.  The getDebuggingInfo() call returns null.  If I got that back, I could call getDebugLog() on that to get the body.  The comments at the end are simply notes of where I would start if I wanted to mix in REST.
com.sforce.soap.tooling.LogInfo[] logList = new com.sforce.soap.tooling.LogInfo[1];
        logList[0] = new com.sforce.soap.tooling.LogInfo();
        logList[0].setCategory(com.sforce.soap.tooling.LogCategory.Apex_code);
        logList[0].setLevel(com.sforce.soap.tooling.LogCategoryLevel.Fine);        
        ExecuteAnonymousResult apexResult = conn.executeAnonymous ("System.debug('Hello.');");
        System.out.println(apexResult);
        com.sforce.soap.tooling.DebuggingInfo_element debuggingInfo = conn.getDebuggingInfo();
        System.out.println(debuggingInfo);
        com.sforce.soap.tooling.GetUserInfoResult userResult = conn.getUserInfo();
        String userId = userResult.getUserId();
        System.out.println(userId);
        // SELECT Id FROM ApexLog WHERE LogUserId = userId ORDER BY LastModifiedDate DESC LIMIT 1
        // /services/data/v49.0/sobjects/ApexLog/07L4p00000FU34uEAD/Body

Below is the output --
[ExecuteAnonymousResult  column='-1'
 compileProblem='null'
 compiled='true'
 exceptionMessage='null'
 exceptionStackTrace='null'
 line='-1'
 success='true'
]

null
005460000010bMfAA

Anyone know a way to get the Debug Log body with SOAP?  Or am I going to have to mix in a REST request?  Or maybe the flags aren't set properly to get the log and that's why getDebuggingInfo is returning null?
 
I know that when a Lead and an open Event are both ownere by user "A" and the Lead owner is updated to user "B" then the Event owner is automatically updated to have Owner "B".  I'd like to prevent that, or at least detect it so that I can do something down stream.

When I put debug on and update the Lead, I do not see Event udpate triggers fire.  Even the the Event is updated, the owner changes, and the Last Modified Date changes, it's as if no update DML happened.  I suspect that I can't do any work with an Update Trigger on Event to handle this situtation.

I suppose I could put an update trigger on Lead, then in that trigger do a query for open Events owned by the Lead, but I really don't want to get in the game of implementation another trigger.  I already have a trigger on Event that handles when the Owner may be updated and any other activity associated with the Event Owner change.
This release note https://releasenotes.docs.salesforce.com/en-us/winter21/release-notes/rn_slds_bem_deprecate.htm?edition=&impact= (https://releasenotes.docs.salesforce.com/en-us/winter21/release-notes/rn_slds_bem_deprecate.htm?edition=&impact=) says that versions 2.13.0 and newer of SLDS will change so that "--" will be replaced with "_".  We use SLDS in Visualforce via the <apex:slds/> tag.  Is there anyway to tell what version of SLDS is injected into the page?  I would think if it's a version 2.13.0 or newer then we will have to change any references with the old "--" to "_" which means change some VF code.  Anyone have any other thoughts on the impact of that notice and VF pages that use SLDS?
Does anyone know if there are any standard fields that are dependent picklists?

I want to write some tests for a piece of functionality that makes use of dependent picklists that will run in any org without manual setup or additional data definition.  If there are none, then I'll need a setup script to create some in each org.  But it would be easier if I could make use of at least one that is always there.  In fact, all I need is one.
 
We have a legacy VisualForce page that overrides the standard Edit button.  So, in Classic or Lightning, when you press the Edit button on the record Detail page, the VF page comes up.  There is one glitch when in  Lightning Experience. When you save from the Edit page, you end up back on the Lightning Detail page but the old data (which must be in the Lightning cache somewhere) is still shown.  You have to manually refresh to get the latest data.

I'm wondering if there's any kind of trick when leaving the VF page to go back to Lightning and force it to reload.  I can't find any way to do it by passing back any sort of PageReference, with or without redirect.

Maybe there's some kinda of trick where it can go back to the VF page and the VF page could have an onComplete script that would somehow force lightning to reload the record.
Hi team, 

When I code something and deploy to a sandbox, something it fails if I made a mistake or something doesn't work with the configuration of the sandbox.   When it fails, it used to give a details reason such as:
row 3 col 5 illegal assignment of String in Number field 

However, for some reason it stopped giving reasons but just the outcome
Now it just says DeployFailed: Deploy Failed

I am not sure if something change in CLI or I made a wrong setting. 
Can anyone please help?

Thanks!!
We needs to use Schema and DesscribeSObjectResult classes to get all SObject in the user's organization. But we noticed performance problem after upgraded to API v44.
The following code could reproduce the issue:
Visualforce Page Code:
<apex:page controller="TestSchemaTimeController">
    <script type="text/javascript">
        function perform() {
            var args = [];
            var start = new Date().valueOf();
            args.push("{!$RemoteAction.TestSchemaTimeController.QuerySchema}");
            args.push(function(result, event) { var output = document.getElementById("output"); output.value += "Count:" + result + " Time:" + (new Date().valueOf() - start) + "ms\r\n"; });
            args.push({ buffer: false, escape: false, timeout: 120000 }); 
            window.Visualforce.remoting.Manager.invokeAction.apply(window.Visualforce.remoting.Manager, args);
        }
        function clearOutput() {
            var output = document.getElementById("output");
            output.value = "";
        }
    </script>
    <h1>Test Schema Time</h1>
    <div>
        <button onclick="perform()">Click</button>
        <button onclick="clearOutput()">Clear</button>
    </div>
    <div>
        <TextArea id="output" style="width:800px;height:600px"></TextArea>
    </div>
</apex:page>
Apex Code 
public class TestSchemaTimeController {
    @RemoteAction
    public static Integer QuerySchema() {
        Map<String, Schema.SObjectType> typeMap = Schema.getGlobalDescribe();
        for (Schema.SObjectType sot : typeMap.values()) {
            System.debug(sot);
            Schema.DescribeSObjectResult dsr = sot.getDescribe();
            //String name = dsr.getName();
            //Boolean acc = dsr.isAccessible();
        }
        return typeMap.values().size();
    }
}
By the demo code above, it cost about 250~300ms via API version 43, but cost about 1000~1600ms via API version 44. You could modify the API version of the Apex Class to verify the result.
API v45 preview in sandbox also have the performance issue.
We have no idea why this Apex method is slow down after API version 44. And we have to keep on using API version 43 now to make sure our customer not face the performane issue.
Anyone else meet the same problem?
  • January 28, 2019
  • Like
  • 0
Hello,

A third party application wants to read data from Salesforce.
So i will expose the salesforce.

They plan to read the data with POST.

How can i give the swagger to them ?
URL and sample JSON

Thank you in advance for suggestions
I'm seeking more info on lightning:input for use in a Lightning Component.

What I want to do is have the input text field submit when the user presses the Enter key. However, the Enter key seems to be ignored by lightning:input. Also, I can't even retrieve the keycode with my handler.

component markup:
                  <lightning:input aura:id="body"
                                         label=""
                                         name="Body"
                                         placeholder="Enter message..."
                                         value="{!v.Message.Body__c}"
                                         onchange="{!c.keyCheck}"/>

                    </lightning:layoutItem>
And my keyCheck handler:
keyCheck: function(component, event, helper){
        console.log(event.getParams('keyCode')); 
        }
The handler is getting called, but the value is undefined. I think it's undefined because the event that is happening is NOT the keypress/keyDown/keyUp, but rather the input field is changing. But lightning:input chokes (won't compile) if I try to add a keyDown event in its parameters in the markup.

BTW, I've tried doing this with ui:inputText as well, and that doesn't work either.

Help please?

 
Hello, is there any documentation that helps testing external web services endpoints using ZAP and Burp scanners?? I have searched everywhere in Google does not find a one. We are consuming web services from SAP. i.e., making callouts from Salesforce to SAP. Also, we are about to submit scan reports for the security review. This became a roadblock that we have difficulty to find right articles to start with. Please suggest. Would appreciate your help. Thanks a lot
I'm writing an IDE plugin and I prefer using the REST API.  For the Execute Anonymous resource:

http://domain/services/data/vXX.X/tooling/executeAnonymous/?anonymousBody=System.debug('Hello World');

The response is:

{"exceptionMessage":null,"compileProblem":null,"compiled":true,"exceptionStackTrace":null,"column":-1,"line":-1,"success":true}

How do I get access to the output/debug log?

Hello,

 

I am wrote this really simple trigger to stop the changing of the ownership of open activities.  Whenever account owner changes in SF, it changes all of the open activitiy owners of tasks to the new owner of the account.   We don't want that to happen.  Here's my code:

 

 

trigger StopTaskOwnerChange on Task (before update) {

    List<Task> updateTask = new List<Task>();
    
        for(Task t : trigger.new){
            if(t.ownerId != t.CreatedById)
                updateTask.add(t);
        }
        
        for(Task t : updateTask){
        t.ownerId = t.CreatedById;
        }

 


I am thinking this problem with this is probably has to do with timing of the execution of the trigger.  I know salesforce automatically changes all of the activity ownership automatically, and I am wondering if I'm firing my trigger before salesforce automatically changes the Owners so it looks the owner is not changing.