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

  • Chatter
    Feed
  • 7
    Best Answers
  • 3
    Likes Received
  • 0
    Likes Given
  • 33
    Questions
  • 72
    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 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 have a user who regularly gets a salesforce internal error when navigating to recor detail pages in lightning:
Looks like there's a problem.
An internal server error has occurred Error ID: 275320530-4767 (-683249219)

He's clicking a link on a list of records and the link simply goes to the native record detail page for the record. Usually just refreshing the page will eliminate the error and the record will be displayed. 

I've seen the same error and attempted to grab debug logs, but they always look fine. The only difference I see is that when I get this error it appears that maybe two requests are being bundled, but they both succeed (no errors in the logs at all -- just a simple soql query that returns results). Again, refreshing the page often works, and then I see the requests coming through on separate logs.
I need to access sforce.one in javascript inside a visualforce page that I'm including in a lightning component via iframe.

If I use the native "VisualForce" component then sforce.one is defined for me. But I'm short on vertical space and don't want to waste any on an extraneous title line and also I need to control the iframe height dynamically. So I created a simple component that includes the VF page in my own iframe, but sforce.one is NOT defined when I do it that way.

 
We have a trigger to provide certain validations that were difficult as validation rules (and need to be enforced even when created by pushing through an approval process). 

We're also in the process of moving to lightning. So I've placed our VF page in a lightning component, but when the "Submit for Approval" button on the approval related list is used and the result violates the rule in the trigger, we just get a gray screen that looks like a Chrome connection error with the message: 
     "... salesforce.com refused to connect" 

I found that if I postpone the error until the next step in the approval process, then trying to submit the record works and the error is correctly displayed when trying to approve the next step. I suspect this is an issue of using the "Submit for approval" button on a VisualForce page embedded in a lightning VF component.

The custom error message is also handled correctly when using the native lightning submit button.
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. 
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: []
 
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'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 need to access sforce.one in javascript inside a visualforce page that I'm including in a lightning component via iframe.

If I use the native "VisualForce" component then sforce.one is defined for me. But I'm short on vertical space and don't want to waste any on an extraneous title line and also I need to control the iframe height dynamically. So I created a simple component that includes the VF page in my own iframe, but sforce.one is NOT defined when I do it that way.

 
I have a record edit form that works for me, but "rarely" works for another user (I'm logging in as that user to test this) -- but here's the kicker -- *until* they go do other stuff and come back later.

The lightning component consists of a lightning:recordEditForm that has several fields including about 4 lookup fields (Account, Contact, managed obj Vehicle Inventory and managed obj Location). One of the lookups is to a custom object, and gets a default value based on the user's settings. When creating a new record, the default value shows up properly. The record is saved and that location lookup value is in the record -- it's visible in the "Recent items" related list.  But when this user re-opens the record that value isn't there anymore. 

When the value will NOT display on-screen I'm seeing an error 4 times in my Chrome consols: "Cannot read property 'color' of undefined.'  This error occurs *between* the completion of my "init" handler and the start of the RecordEditForm's onload method. The "setDefaultLocation" routine runs correctly when initiating a new record, but does not run (and shouldn't) when displaying an existing record with the value specified.

I've verified that the user has read & edit authority on all fields in the object and can read the target object of the lookup field. And again, if I log off as this user, then log in as this user again (or just go on to other things and come back later), then the lookup field is properly displayed.

I think the full code is too much for the forum, but here are some snippets:

<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId,force:appHostable,lightning:actionOverride"
    controller="RentalAgreementLex">
...
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
...
<lightning:recordEditForm recordId="{!v.recordId}" objectApiName="dealer__Rental_Agreements__c"
    aura:id="newrecordform" onsuccess="{!c.recordSaved}" onerror="{!c.recordSaveError}"
    onload="{!c.pageload}">
...
            <lightning:inputField fieldName="Location__c" disabled="{!v.alreadyposted}" aura:id="location"
                required="true" readonly="{!v.alreadyposted}" class="mw_required"/>


Some of the controller code:
/* general page initializations */
    doInit : function(component, event, helper) {
        console.log('doInit');
        // initialize that we're not in the process of posting
        component.set("v.posting", false);
...
        console.log('doInit complete');
    },
    /* initializations when recordeditform is loaded */
    pageload: function(component, event, helper) {
        console.log('pageload');
        let id = component.get("v.recordId");
        console.log(id);
        let sts = (id==null) ? null : component.find("agreement_status").get("v.value");
        if (id==null) {
            sts = 'Open';   // default value
            let stscmp = component.find("agreement_status");
            if (stscmp!=null) stscmp.set("v.value", sts);
            component.set("v.status", sts); // also init record data status
            component.find("deposit_amount").set("v.value",0.00);   // default value
            component.find("excess_miles_charge").set("v.value",0.00);  // default value
            component.set("v.title","New Rental Agreement");
            component.find("totalperdiemtax").set("v.value",0.00);  // default value
            component.find("sales_tax").set("v.value",0.00);    // default value
            component.find("countysalestax").set("v.value",0.00);   // default value
            component.find("citysalestax").set("v.value",0.00); // default value
            component.find("thirdtierrentaltax").set("v.value",0.00);   // default value
        }
        // in doInit: component.set("v.title", name);
        let isopen = sts!='Paid';
        let posting = component.get("v.posting");
        console.log('isopen = ' + isopen);
        // enable/disable buttons based on rental status
        if (!posting && isopen) component.find("submitbutton").set("v.disabled", false);
        if (!posting && id!=null && isopen) component.find("postbutton").set("v.disabled",false);
        let fromaccount = component.get("v.fromaccount");
        if (fromaccount!==null) {
            component.find("account").set("v.value",fromaccount);
            helper.rtvPersonContactId(component, event);
        }
        let fromcontact = component.get("v.fromcontact");
        if (fromcontact!==null) {
            component.find("contact").set("v.value",fromcontact);
            helper.rtvContactsAccountId(component, event);
        }
        if (isopen) component.set("v.alreadyposted", false);
        else component.set("v.alreadyposted", true);
        // set default location
        let c_location = component.find("location");
        let location = null;
        if (c_location!=null) location = c_location.get("v.value");
        if (id==null && location==null) helper.rtvUserDefaultLocation(component, event);
        // initialize running totals
        helper.recalcTotals(component, event);
        console.log('pageLoad complete');
    },
 
One of our users has created a list view for her activities that was too vague and it is returning too many results, which is resulting in her Activities tab timing out and makes it unable to load the page at all. (Note: this is not just for one list view on activities page, but the whole Acitivites page itself)

I've had experience with this before, but I was always able to load the main landing page for Activities and resolve using this article <https://help.salesforce.com/articleView?id=How-do-I-fix-an-activity-list-view-that-is-timing-out-1327365102712&language=en_US&type=1>. However, since I am unable to even open her Activities tab, I cannot use this method. 

The error I get: "Time limit exceeded Your request exceeded the time limit for processing" 

I had opened a case up with SFDC support, but they won't help me because it is a visual force page. 

Thank you, and please let me know if I can provide you with any other helpful info. 

-Annemarie
Part of this is me struggling with the syntax and the other part is me not knowing what system method to use. A decimal method, math method?

Code:
Decimal parentlistPrice = 9995.00
Decimal svcPercent = .17
Decimal discount = .88
//oli.quantity = 2.0
        
oli.TotalPrice = ((parentListPrice * svcPercent) * discount) * oli.Quantity;

oli.TotalPrice  will equal 2990.504 but I would like to round this to only two decimal places so the value is 2990.50
 

  • September 05, 2008
  • Like
  • 0