• Bryan Leaman 6
  • NEWBIE
  • 315 Points
  • Member since 2015

  • Chatter
    Feed
  • 7
    Best Answers
  • 3
    Likes Received
  • 0
    Likes Given
  • 36
    Questions
  • 80
    Replies
Hi Guys,
I have a Test Class issue can anyone tell me the mistake. I have custom filed "ClinicCode" in the Lead object. I am not passing the code in the test class but the lead is stored under the "leadsWithClinicsList" list. It should be in "leadsWithOutClinicsList"
User-added imageUser-added image
Here's my email handler
global class DSSEmailHandler implements Messaging.InboundEmailHandler {
      global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email, Messaging.InboundEnvelope envelope) {
   
    
      Messaging.InboundEmailResult result = new Messaging.InboundEmailresult();
      if(email.subject.contains('ref'))
      {
            try
            {
                 Case c = new Case();
                  c.ContactId = email.fromAddress;
                  c.recordTypeId = '0121O000001WL0u';
                  c.OwnerId = '00G1O000004lFB4';
                  c.Description = email.plainTextbody;
                  c.Subject = email.subject;
                  insert c;
                  //to save attachment to case
                  for(Messaging.Inboundemail.BinaryAttachment bAttachment:
                  email.binaryAttachments) {
                      Attachment attachment = new Attachment();
                      attachment.Name = bAttachment.fileName;
                      attachment.Body = bAttachment.body;
                      attachment.ParentId = c.Id;
                      insert attachment;
                  }               
                
                  result.success = true;
            }catch (Exception e){
                  result.success = false;
                  result.message = 'Oops, I failed.' + e.getMessage();
            }
              return result;
      }
      return null;
 
  }
  }
Here's the test code
@isTest
private class DSSEmailHandlerTest
{
public static Blob createAttachmentBody(){
        String body = 'XXXXXXXXXXXXX';
        return Blob.valueof(body);
    }
    public static testMethod void testmyHandlerTest() 
    {
        Case c = new Case();
        insert c;
        
        //String cName = [SELECT Name FROM Case WHERE Id = :c.Id LIMIT 1].Name;
        
        Messaging.InboundEmail email = new Messaging.InboundEmail();
        Messaging.InboundEnvelope env = new Messaging.InboundEnvelope();
        email.subject = 'ref';
        email.plainTextBody = 'test body';  
        DSSEmailHandler m = new DSSEmailHandler();
        m.handleInboundEmail(email,env);   
        
       // attachment insert
  
        Attachment att = new Attachment(Name = 'XXXXXXXX', Body = Blob.valueof('XXXXXXXXXXXXXX'), ParentId = c.Id);
        insert att;
        

                     
    }
}

I can't get this part covered, I'm at 70% without it
Attachment attachment = new Attachment();
                      attachment.Name = bAttachment.fileName;
                      attachment.Body = bAttachment.body;
                      attachment.ParentId = c.Id;
                      insert attachment;
                  }               
                
                  result.success = true;


 
  • February 16, 2022
  • Like
  • 0
I need to send Asynchronous requests to some 3rd party API and that call method should be @future. 
On the other hand, we also want to call this method from Batch class. But Salesforce doesn't allow us to send future method from a batch class?

Any ideas?
 
Hi Friends from the Salesforce Forum,
I was asked this interview question (I am new to Salesforce hence I fubbed the Interview :-( , heres the question, can I request for help so I can be better prepared next time over. Thank you in advance.

-- Findout Issues in this code, Bad practices in this Method
*********************************************************************************
Private Map<ID,String> updateAccounts(List<Account>(accList){
Map<Id, Account> updatedAccs = new Map<Id,Account>(accList);
Set<String> validAccTypes = new Set<String>{'Prospect', 'Customer'};
try{ 
Map<Id, String> errorMap = new Map<Id, String> ();
 If(accList == null || accList.size() ==0)
Return errorMap;
For(Account acc:accList){
if(acc.DunsNumber.Lenght >9){
errorMap.put(acc.Id, 'Duns Number more than 9 Characters';
updatedAccs.remove(acc.Id);
}
} else If(acc.AccountNumber.Lenght >40){
   errorMap.put(acc.Id, 'Account has more than 40 Characters');
   updatedAccs.remove(acc.Id);
} else If(validAccTypes.contains(acc.Type)){
  errorMap.put(acc.Id, 'Account Type is not Valid');
  updatedAccs.remove(acc.Id);
}
Update updatedAccs;
} catch(Exception ex)
  System.debug(ex.getMessage()0;
}
Return errorMap;

 
I have a custom object called Renovation and a child object called Renovation Element. I want to create a ListView on the Renovation Lightning Page with inline editing enabled that has a list of the Renovation Elements. The Renovation Element custom object is not available to be chosen in the Object Drop Down List when creating the list view. Why is that? How do I create a New List View of Renovation Elements that are related to the Renovation? FYI, I have Inline Editing enabled and also enhanced lists enabled in the org.
Hi All,
I want to update some task ownerid in my task trigger handler code. I have tried a piece of code which is not bulkified. Can you please help me with the bulkification of the same.
Thanks in Advance.
 
List<task> taskWithoutClosedCases = new List<Task>();
//Some logic to add tasks in the above List
if(mapId_Case!= null){
	for(task objTask : taskWithoutClosedCases){
		if(isInsert){
			if(objTask.Override_Default_Assigned_To__c == false && objTask.IsClosed == false){
				List<Mapping__c> mappingRecord = [SELECT ID, Assigned_To__c FROM Mapping__c where Business_Unit__c=:objTask.Contact_Center_BU__c 
												  AND Task_Type__c=:objTask.Task_Type__c AND Type__c = 'Task Type - Assigned To'];
				if(mappingRecord.size() > 0){
					if(mappingRecord.get(0).Assigned_To__c != null){
						objTask.OwnerId = mappingRecord.get(0).Assigned_To__c;
					}else if(mappingRecord.get(0).Assigned_To__c == null && mappingRecord.get(0).Id != null){
						objTask.OwnerId = UserInfo.getUserId();
					}
				}
			}
		}
	}
}

 

Trying to return only the numbers from a phone number and remove extraneous data, works just fine, I removes brackets, lines, all clean code but when I run tests on my code I get back System.NullPointerException: Attempt to de-reference a null object.

 

 




     

String udp_billing_contact_number = serviceOrder[0].Billing_Contact_Phone_Number__c;
String udp_contact_number = udp_billing_contact_number.replaceAll('[^0-9]', '');

 
I've been unable to force a refresh of a child component in lwc.
Basically, I have something like:
<template>
   <c-child-lwc-component userid={selectedUserId}></c-child-lwc-component>

  <lightning-button  label="Do Something" 
	onclick={handleDoSomething}></lightning-button>
</template>
When the button is hit, I'm calling Apex to do something with the user id and when it's done, the childLwcComponent, if it re-renders properly, will show different results. But after calling the apex function, I cannot get the child component to re-render fully.
 
@track selectedUserId;
import invokeMyApexMethod from '@salesforce/apex'MyClass.myApexMethod';

handleDoSomething() {
		invokeMyApexMethod({
			userId: this.selectedUserId
		})
		.then(result => {
			this.trackedfield = result;
			this.trackederror = undefined;
// Need to re-load child component here!
		}).catch(error => {
			console.log(error);
			this.trackederror = error;
			this.trackedvalue = undefined;
		});
}
I have tried using refreshApex referencing this.selectedUserId. I've  also tried adding a dummy, tracked parameter to my child lwc component so that I can change that value every time my apex method has completed. but it still will not re-load the child component.
 
We have a third-party integration with our salesforce org. I believe they're using SOAP api calls at API version 41.0.  The calls are creating data in our org and those record inserts and updates fire custom triggers. However, when I add a user trace for the API user, I don't get any logs of the activity. 

I haven't coded SOAP apis into salesforce, but I see there are debug headers that are available. But I don't want debugging turned on for every call, just when I initiate a trace on the user.  

Would adding debug headers to the API calls *always* generate logs? Or would it only generate logs when I define a user trace for the API user?
Is there any way to report or check which app a user is using or to track usage of apps?
I leveraged the new-ish feature of picklists that lets me have a value that is displayed and a code that is stored in the object record and they're different.   However, now I'd like to show the picklist value (not the code) on a related object, but the only thing I can find is to do TEXT(object__r.picklistfield__c), which always returns the code, not the value.

For example, if my picklist (Customer_class__c) had values defined as:
Value                              API Name
Enterprise Customer      CC1
Business Customer        CC2

Then from a related record, a formula TEXT(Account.Customer_class__c) will show "CC1" and I want to show "Enterprise Customer".

Any ideas?  So far all I've come up with is to put a case statement in the formula:
CASE(TEXT(Account.Customer_class__c),
'CC1', 'Enterprise Customer',
'CC2', 'Business Customer',
... etc...
'Unrecognized code')
I've developed some code using Salesforce REST APIs to perform simple queries from external systems. I've created a Connected App definition in my sandbox and connect to it using https://{sandbox-host-name}.my.salesforce.com with grant_type=password, our client_id, client_secret, username & password+api key and it works great.

The strange behavior is that I can use the same Consumer_Key and Consumer_Secret with our production org host with a production username, password and API key and it ALSO works great. But I haven't moved the connected app definition to production yet!

How does this meet the definition of security? Am I missing something?
We have some approval processes that control the flow of a document through a series of stages. To accomplish this we have field updates upon approval & rejection to set the new stage.

A challange with this approach is how to handle optional approval steps. For example, if a product sale requires customization, it enters a "Production" step and we want the document to reflect a status of "In Production". But if there's nothing to do it can move automatically to a "Delivery" step.   However, I cannot find a way to determine during the triggerd field update that the Production approval step is being skipped due to conditional logic in the approval process.  

I *have* found a way to see the currently pending approval step name, but during approval it still shows the step being approved, not the next applicable step. So after approval, if a step was skipped, any *new* update to the record would reveal it's at the Delivery step instead of "Production," but I cannot find a way to determine this at the time the prior step is being approved. So what we've had to do is duplicate the logic in code that we have in the approval process so our trigger can determine if the next step is being skipped or not. Very clunky!

Does anybody have a better way? It'd be great if we could just designate that skipped steps also update fields, or if approval processes could perform field updates upon entry to a step instead of just approval or rejection of a step.

Any thoughts?
I love how we can filter lightning components on standard permissions rather than looking for specific profile name or creating custom permissions. For example, instead of someting like  Profile > Name = 'System Administrator' I can show a component based on "Permissions > Standard Permissions > Modify All Data = true".

But I'm unable to find a way to make this same kind of determination in Apex. My use-case is that I'd like to condition editability of some data based on the status of the record *AND* whether the user has been granted a custom permission *or* they are a system admin (so I don't have to keep adding all custom permissions to our system administrators). But I've been unable to find a way to check for "Modify All Data" authority on the running user.
I tried implementing a new lookup field with a filter on a picklist field in the same object. When using the native record layout screen it works properly -- if I change the picklist, I get a different set of records in the lookup search screen. But when I try presenting the fields in a lwc using lightning-record-form the lookup filter is stuck on the already-saved picklist value rather than whatever I've changed it to.

Has anyone else had this issue and maybe reported it to Salesforce? We don't have development support, so they don't help me out with bugs that can only be discovered by writingcode. :( 
We have a trigger that changes a user's role based on changes made to the User.Division field, but as of Winter 2022 it is no longer working.  

I've added debug statements and I see that the code is assigning a new role id to the user record in a before update trigger context on the user object, but that change is no longer being saved to the user record.

Can anyone else confirm this? I haven't found an open issue yet and salesforce support doesn't help us at all when custom code is involved.
When I try to use Async SOQL I'm getting an error that I have insufficient access to query this object ... with Async SOQL.  The Id provided in the error starts with "01I" and I cannot determine what this is. I'm a full system admin.  

I found posts from 2017 & 2018 that Async SOQL was a pilot program that needed to be enabled in the org.  We're halfway through 2021 -- is this still only a pilot program feature???
I'm trying to use the Approval.unlock and Approval.lock methods to allow specific updates to locked records, but I'm getting an error indicating my user is not authorized to delete records from EntityLock. How do I give someone access to delete EntityLock records? I don't see it in object authorities.

Op:Delete|Type:EntityLock|Rows:1
Delete failed. First exception on row 0 with id 04Z7e000000NUov; first error: INSUFFICIENT_ACCESS_OR_READONLY, insufficient access rights on object id: []
 
Starting yesterday my authorization token became invalid, but when I tried to re-authorize my org the process just hangs at "waiting for localhost" in the browser. I'm using Windows 10 and the latest vscode and the latest sfdx and both were last updated several days ago and had been running fine.

I tried re-authorizing from my personal PC (running linux and month-or-so old versions of vscode and sfdx) and that failed as well. 

I've just uninstalled and re-installed vscode and I still cannot authorize to any of my orgs.
I'd love to be able to create a component like Accordion that is basically a layout component to create columns like the general page layout does.

My use-case is a record page that really needs to be full-width. We use the tabs component to place related lists in one tab and other specialty functionality in other tabs. But now I'd like to add an activities side-bar to one of the tabs rather than to the page as a whole, but I can't find any "columns" components that would allow other components to be placed in them.

Am I missing seeing something obvious? I guess I could see if the accordion component is open-source and adapt that to various column configurations if I have to.
I'm adding a tab to an object's lightning page where I want to provide a way to edit fields on a related record. I am able to select the update action for my related record and set the layout with the fields I want, but they are not editable.

Did I take too long a leap of faith? It seems intuitive that if I need to provide an "Update record" action for the related record component to use, that I'd be able to update the record.
I've scheduled a handful of Apex classes to run daily functions after normal business hours. They have been running just fine for over a year. But recently (last month or so), sometimes the first job in the sequence doesn't run.  It shows that it was submitted on the scheduled job list, but never appears in the list of Apex jobs that started and ran.

This is NOT an issue of the job failing or aborting. Even if that happens, there's an entry in the list of Apex jobs showing that status. In my case, it seems that once or twice a week the Scheduled job list will show that the job was submitted, but it never shows up in batch and does not run.

Any thoughts? I tried calling salesforce support because it sounds like a platform issue in the scheduler, but we have to have developer support for them to look into why their job scheduler is failing. And developer support is too expensive. I've tried adjusting the start time, but so far that hasn't helped.

Scheduler says it started

Did not start
 
I've noticed issues with the lightning framework when multiple requests are combined. I'm working on a new quickAction lightning aura component and I'm issuing 2 calls to my controller for 2 different pieces of information. When the lightning framework combines the requests into a single call to the server I can see both responses in the return payload (using Chrome developer tools), but only 1 of my method calls' callback functions gets invoked. The other does not, so I cannot access the returned data.

I've had to cascade my method calls so the second one is invoked when the first one completes. Then when the second one completes I can access its return data.

Note, I'm using aura because (as far as I can tell) lightningQuickAction isn't available in lwc yet.

(As a side note: I've noticed incomplete native components like today's tasks or list views on my home page don't always get filled in if the requests get combined as well.)
For better control over the frame size, I've implmeneted a lightning component that displays a visual force screen in an iframe rather than using the build-in visualforce lightning component. 

It was working fine, but now that we've enabled communities, I'm getting a full set of classic page headers in my iframe that I never used to have. Also, links to record pages are not working properly.  How can I pull in the visualforce page and NOT include headings?
We're getting ready to turn on the ability of our users to send salesforce email (email from an account, etc) via Outlook 365. But what we *really* want to do is to FORCE them to do it this way. We want to ensure Outlook 365 has a record of the outbound emails. 

However, I see no way to set this preference for everyone other than to log in as each user and choose the setting for them. With over 1000 users, that's a bit ridiculous.

Does anyone know a better way to enforce and administer this?
--Bryan
I have a simple SOQL query that I can run using developer console or workbench and it runs fine. But when I copy/paste it into anonymous apex it complains the the field I'm requesting does not exist.  How can that be?  I am running this as a system admin and I *do* have authority to the field. 

Here's a screenshot showing the query in developer workbench side-by-side with anonymous apex and the results.

SOQL Query vs Apex soql query
 
I've had a user today who has received an "Insufficient Priviledges" error when trying to export report details. He has authority to export reports. He created the report and can export the printable view. When I log in as this user I can pull up the report and export details with no problem. After rebooting his computer he was able to export the report again, but later got the same error on a different report. Again, *I* can export it when I log in as him, so it seems a very persistent glitch.  There has not been any change today to the user record or the profile assigned to him.
I'm constantly unable to complete tests because of this error in our sandboxes. If I keep running them over and over they usually complete normally eventually, but it can waste a half hour of my time to get them to complete so I have an accurate test coverage percentage on the class in question.

This has been a problem for over a year, but has been getting worse in the last few months.
When I first started developing a year ago (and I forget which version I was using at the time), I seem to recall that I'd get a warning if the server code was newer than the copy I was working with. This is no longer happening.  We have multiple developers working in our sandbox and recently discovered that when I save my apex code, VF pages, etc., the Force.com IDE is simply saving overtop of whatever is on the server without any warning that the server code changed since I last refreshed my local copy.

I upgraded my Force.com IDE to Winter'16 (v35) hoping it would resolve the issue, but it doesn't.

Please, there *has* to be a way to fix this! Even if I use the "Synchronize with server" to update my local copy, til I go through a dozen changes or so and then save the results to the server, someone else could've have already uploaded another change. If the IDE is going to go through a lengthy "Synchronize check against server" it should at least work properly.

At the moment, all I can figure to do is bring up a list of the classes/pages I'm about to upload and make sure I'm the last one to have updated them before I save to server. 
trigger addCase on Account (After update) {
   List<Account> allAccounts = new List<Account>([Select id,Fuzion_Status__c,(select id from cases where status in('New','Open')) from account where id in :Trigger.new]);
   List<Case> newCases = new List<Case>();
    
    for(Account myAccount :allAccounts){
    Account oldAccount = trigger.oldMap.get(myAccount.id);
    if(oldAccount.Fuzion_Status__c == 'Initial Phone call' && myAccount.Fuzion_Status__c != 'Initial Phone call'){
        if(myAccount.cases !=null){
            Case c = new Case();
            c.Accountid = myAccount.Id;
            c.Type = 'ICM';
            c.Origin = 'WEB';
            c.Division__c = 'Case Management';
            c.Status = 'New';
            c.RecordTypeId = '01236000000OJLq';
            newCases.add(c); 
        }
     }
        
    }
    if(!NewCases.isEmpty()){
        insert newCases;
    }
 
}
This is my code to create a case and I have just create an object called fuzion status but why it still shows variable does not exist?User-added imageUser-added image
We have a third-party integration with our salesforce org. I believe they're using SOAP api calls at API version 41.0.  The calls are creating data in our org and those record inserts and updates fire custom triggers. However, when I add a user trace for the API user, I don't get any logs of the activity. 

I haven't coded SOAP apis into salesforce, but I see there are debug headers that are available. But I don't want debugging turned on for every call, just when I initiate a trace on the user.  

Would adding debug headers to the API calls *always* generate logs? Or would it only generate logs when I define a user trace for the API user?
Hi Everyone, I have a requirement where we need to make more than 100 API calls in real time. As we all know that will hit governor limits.
We can't use Batch to call the API's . What is the best way to handle such situation ?
Hi Guys

How to check whether the user have edit access on opportunity before editing the opportunity using apex code. How can this be implemented using CRUD operation.
Is there any way to report or check which app a user is using or to track usage of apps?
I leveraged the new-ish feature of picklists that lets me have a value that is displayed and a code that is stored in the object record and they're different.   However, now I'd like to show the picklist value (not the code) on a related object, but the only thing I can find is to do TEXT(object__r.picklistfield__c), which always returns the code, not the value.

For example, if my picklist (Customer_class__c) had values defined as:
Value                              API Name
Enterprise Customer      CC1
Business Customer        CC2

Then from a related record, a formula TEXT(Account.Customer_class__c) will show "CC1" and I want to show "Enterprise Customer".

Any ideas?  So far all I've come up with is to put a case statement in the formula:
CASE(TEXT(Account.Customer_class__c),
'CC1', 'Enterprise Customer',
'CC2', 'Business Customer',
... etc...
'Unrecognized code')
Hi Guys,
I have a Test Class issue can anyone tell me the mistake. I have custom filed "ClinicCode" in the Lead object. I am not passing the code in the test class but the lead is stored under the "leadsWithClinicsList" list. It should be in "leadsWithOutClinicsList"
User-added imageUser-added image
I've developed some code using Salesforce REST APIs to perform simple queries from external systems. I've created a Connected App definition in my sandbox and connect to it using https://{sandbox-host-name}.my.salesforce.com with grant_type=password, our client_id, client_secret, username & password+api key and it works great.

The strange behavior is that I can use the same Consumer_Key and Consumer_Secret with our production org host with a production username, password and API key and it ALSO works great. But I haven't moved the connected app definition to production yet!

How does this meet the definition of security? Am I missing something?
We have some approval processes that control the flow of a document through a series of stages. To accomplish this we have field updates upon approval & rejection to set the new stage.

A challange with this approach is how to handle optional approval steps. For example, if a product sale requires customization, it enters a "Production" step and we want the document to reflect a status of "In Production". But if there's nothing to do it can move automatically to a "Delivery" step.   However, I cannot find a way to determine during the triggerd field update that the Production approval step is being skipped due to conditional logic in the approval process.  

I *have* found a way to see the currently pending approval step name, but during approval it still shows the step being approved, not the next applicable step. So after approval, if a step was skipped, any *new* update to the record would reveal it's at the Delivery step instead of "Production," but I cannot find a way to determine this at the time the prior step is being approved. So what we've had to do is duplicate the logic in code that we have in the approval process so our trigger can determine if the next step is being skipped or not. Very clunky!

Does anybody have a better way? It'd be great if we could just designate that skipped steps also update fields, or if approval processes could perform field updates upon entry to a step instead of just approval or rejection of a step.

Any thoughts?
Here's my email handler
global class DSSEmailHandler implements Messaging.InboundEmailHandler {
      global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email, Messaging.InboundEnvelope envelope) {
   
    
      Messaging.InboundEmailResult result = new Messaging.InboundEmailresult();
      if(email.subject.contains('ref'))
      {
            try
            {
                 Case c = new Case();
                  c.ContactId = email.fromAddress;
                  c.recordTypeId = '0121O000001WL0u';
                  c.OwnerId = '00G1O000004lFB4';
                  c.Description = email.plainTextbody;
                  c.Subject = email.subject;
                  insert c;
                  //to save attachment to case
                  for(Messaging.Inboundemail.BinaryAttachment bAttachment:
                  email.binaryAttachments) {
                      Attachment attachment = new Attachment();
                      attachment.Name = bAttachment.fileName;
                      attachment.Body = bAttachment.body;
                      attachment.ParentId = c.Id;
                      insert attachment;
                  }               
                
                  result.success = true;
            }catch (Exception e){
                  result.success = false;
                  result.message = 'Oops, I failed.' + e.getMessage();
            }
              return result;
      }
      return null;
 
  }
  }
Here's the test code
@isTest
private class DSSEmailHandlerTest
{
public static Blob createAttachmentBody(){
        String body = 'XXXXXXXXXXXXX';
        return Blob.valueof(body);
    }
    public static testMethod void testmyHandlerTest() 
    {
        Case c = new Case();
        insert c;
        
        //String cName = [SELECT Name FROM Case WHERE Id = :c.Id LIMIT 1].Name;
        
        Messaging.InboundEmail email = new Messaging.InboundEmail();
        Messaging.InboundEnvelope env = new Messaging.InboundEnvelope();
        email.subject = 'ref';
        email.plainTextBody = 'test body';  
        DSSEmailHandler m = new DSSEmailHandler();
        m.handleInboundEmail(email,env);   
        
       // attachment insert
  
        Attachment att = new Attachment(Name = 'XXXXXXXX', Body = Blob.valueof('XXXXXXXXXXXXXX'), ParentId = c.Id);
        insert att;
        

                     
    }
}

I can't get this part covered, I'm at 70% without it
Attachment attachment = new Attachment();
                      attachment.Name = bAttachment.fileName;
                      attachment.Body = bAttachment.body;
                      attachment.ParentId = c.Id;
                      insert attachment;
                  }               
                
                  result.success = true;


 
  • February 16, 2022
  • Like
  • 0
I love how we can filter lightning components on standard permissions rather than looking for specific profile name or creating custom permissions. For example, instead of someting like  Profile > Name = 'System Administrator' I can show a component based on "Permissions > Standard Permissions > Modify All Data = true".

But I'm unable to find a way to make this same kind of determination in Apex. My use-case is that I'd like to condition editability of some data based on the status of the record *AND* whether the user has been granted a custom permission *or* they are a system admin (so I don't have to keep adding all custom permissions to our system administrators). But I've been unable to find a way to check for "Modify All Data" authority on the running user.
Hello,

I'm getting the following data :
SELECT 
  Id,
  Contact.Id,
  Contact.Name,
  Contact.AccountId,
  Contact.Account.Name 
FROM CampaignMember
WHERE Campaign.Type = 'Programme Application'
Now for each row I would like the count of each contact in the account with a CampaignMember.
SELECT 
  COUNT()  
FROM CampaignMember
WHERE Contact.AccountId = $$CURRENT_CONTACT_ACCOUNT$$
I tried the following but it doesn't works :
SELECT 
  Id,
  Contact.Id,
  Contact.Name,
  Contact.AccountId,
  Contact.Account.Name,
  (SELECT 
       COUNT()  
   FROM CampaignMember cm2
   WHERE cm2.Contact.AccountId = cm.Contact.AccountId) as countMDC  
FROM CampaignMember cm
WHERE Campaign.Type = 'Programme Application'
With APEX i tried to parse every row of the first query to run the second query, but i can't access the Contact.AccountId value of each row. The returned object is a CampaignMember with only ContacId, CampaignMemberID and CampaignId.
for(SObject currentContact : [SELECT 
	                          Id,
							  Contact.Id,
							  Contact.Name,
							  Contact.AccountId,
							  Contact.Account.Name 
							  FROM CampaignMember
							  WHERE Campaign.Type = 'Programme Application']){
			System.debug(currentContact);
}
The foreach result
Have you any idea how to do it ? It looks very simple problem but i'm stuck since few hours now ... oO'
We have a trigger that changes a user's role based on changes made to the User.Division field, but as of Winter 2022 it is no longer working.  

I've added debug statements and I see that the code is assigning a new role id to the user record in a before update trigger context on the user object, but that change is no longer being saved to the user record.

Can anyone else confirm this? I haven't found an open issue yet and salesforce support doesn't help us at all when custom code is involved.
When I try to use Async SOQL I'm getting an error that I have insufficient access to query this object ... with Async SOQL.  The Id provided in the error starts with "01I" and I cannot determine what this is. I'm a full system admin.  

I found posts from 2017 & 2018 that Async SOQL was a pilot program that needed to be enabled in the org.  We're halfway through 2021 -- is this still only a pilot program feature???
I'm trying to use the Approval.unlock and Approval.lock methods to allow specific updates to locked records, but I'm getting an error indicating my user is not authorized to delete records from EntityLock. How do I give someone access to delete EntityLock records? I don't see it in object authorities.

Op:Delete|Type:EntityLock|Rows:1
Delete failed. First exception on row 0 with id 04Z7e000000NUov; first error: INSUFFICIENT_ACCESS_OR_READONLY, insufficient access rights on object id: []