+ Start a Discussion
Kiran ChodavadiyaKiran Chodavadiya 
Hello,
I am facing this error while creating Test Class on Line No-25
What is solution or reson behind it ?
if anyone know how to solve this error, please share your knowledge.

Thank You.
@isTest
public class TestApexHourTrigger {
        
        @isTest
        Static Void test(){
    	Invoice__c inv = new invoice__c();
        inv.Name = 'Test Invoice';
        insert inv;
        
        Invoice_Line_Up__c invlnup = new Invoice_Line_Up__c();
        invlnup.Name = 'Part 1';
        invlnup.Price__c = 500;
        invlnup.Invoice_Name__c = inv.Id;
        insert invlnup;
        
        Invoice_Line_Up__c invlnup2 = new Invoice_Line_Up__c();
        invlnup2.Name = 'Part 2';
        invlnup2.Price__c = 5000;
        invlnup2.Invoice_Name__c = inv.Id;
        insert invlnup2;
        
        Invoice__c verify = [select Total_Amount__c From Invoice__c where id =:inv.Id];
        
        System.debug('List======>'+verify);
        system.assertEqual(5500,verify.Total_Amount__c);
    }
    
}


 
Best Answer chosen by Kiran Chodavadiya
SwethaSwetha (Salesforce Developers) 
HI Kiran,
Replace system.assertEqual with system.assertEquals and see if it fixes the issue.

See the list of supported "system methods" in salesforce. system.assertEqual does not exist
 https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_system.htm

Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you
Pete Watson 5Pete Watson 5 
Hi All, 

Any help on the below would be much appreciated.

have the below trigger and its working perfectly in the sandbox but after deploying to prod I am getting a CPU time limit exeeded failure... 

trigger ProfileTrigger on User (before insert, before update) {
    List<Id> userIds = new List<Id>();
    List<Case> cases = new List<Case>();
    List<Case> casesToUpdate = new List<Case>();
    for(User u: Trigger.new) {
        if(u.out_of_office__c==True) {
            userIds.add(u.Id);
        }
        for (case c : (cases = [SELECT id, Status FROM Case where ownerId IN:userIds]))
            IF(c.Status == 'Assigned' || c.Status == 'Working' ||c.Status == 'Escalated'){
            c.Reassign_to_Queue__c=true;
            casesToUpdate.add(c);
        }
        update casesToUpdate;
    }

Many thanks in advance! 
Pete
Best Answer chosen by Pete Watson 5
AnudeepAnudeep (Salesforce Developers) 
Hi Pete, 

I recommend adding Limits.getCpuTime() to check where there is the maximum consumption is
 
Integer cpuStart = Limits.getCpuTime();
System.debug('Before For loop = ' +cpuStart);

    for(User u: Trigger.new) {
        if(u.out_of_office__c==True) {
            userIds.add(u.Id);
 System.debug('CPU time consumed in loop ' + (Limits.getCpuTime() - cpuStart));
        }

// repeat this for the other for loop

// Check CPU time before DML

 cpuStart = Limits.getCpuTime();

 System.debug('Before DML = ' +cpuStart);

 update casesToUpdate;

I suggest comparing the debug logs between your sandbox and production when running this code

Also, review this help article

Anudeep
Michael MMichael M 
Hello, I was wondering if someone can help me write the apex to parse a string like this (changed the details of it, but the concept is still what I need):

https://abc-park-store.facilities.facilities.org/contact-form-block/

From that string, I only want everything between "https://" and ".facilities...". Also, I want to replace the "-" with spaces, and capitalize each word. So from the above string, I would want it to say "Abc Park Store". How can I parse the string as such? Thank you.
Best Answer chosen by Michael M
AnudeepAnudeep (Salesforce Developers) 
Hi Michael, 

Verified in my org. The following code gives the output you are looking for
 
String str = 'https://abc-park-store.facilities.facilities.org/contact-form-block/';
String str2 = str.substringAfter('//').substringBefore('.facilities'); 
System.debug('split string is' + str.substringAfter('//').substringBefore('.facilities')); 
System.debug('string' + str2.substring(0,1).toUpperCase()+str2.substring(1,3)+'-'+str2.substring(4,5).toUpperCase()+str2.substring(5,8)+'-'+str2.substring(9,10).toUpperCase()+str2.substring(10,14));

I referred to the methods available in the string class

Let me know if it helps

Anudeep
Craig WoodmanCraig Woodman 
I had a question, but answered it on my own. So since my search didn't reveal anything, I figured I would post it here in case anyone else is looking.

Does a Before Update flow (or one that is triggered by record create or change, that saves before the record is updated) work with lead creation by web-to-lead?

I had not seen this in any documentation. And searches didn't show anything. So I figured I would do some tests on my own.

I set up a test flow to write text to the Lead Description field on creation, that says "The before update flow worked!!!" I then went to the website, downloaded a catalog, and checked the description field. The text was written, with no delay to the web to lead record.

My use case for this is changing the record type automatically on a web to lead record, which passes in certain values. It works perfectly!

I hope that this helps anyone who is looking for this information!
Best Answer chosen by Craig Woodman
Craig WoodmanCraig Woodman
Thanks Anutej,  While this can be completed with a trigger, I wanted to show the functions of the new before save flow actions, and answer a question that I could not find about these flows.  Hopefully people can see this and see both solutions.
Michael MMichael M 
Hello, we need to give access to a user to login as other users. However, we do not want them to be able to edit meta-data, and preferably we don't want them to be able to login as system administrators. 

 I am trying to use the "delegated administrator" feature, however, I don't see how to give them the ability to login as other users without giving them the "modify all data" permission, but the problem is that gives them access to metadata. Is there any way around this? 
Best Answer chosen by Michael M
ShirishaShirisha (Salesforce Developers) 
Hi Michael,

Greetings!

If you need some other user to login as other user then that user should have the Modify All Data permission which will allow the user to access the Metadata as well.

So,it is not possible to provide the login as user access without having the Modify All Data permission.

Kindly let me know if it helps you and close your query by marking it as best answer so that it can help others in the future.

Warm Regards,
Shirisha Pathuri
Haneesh reddy 13Haneesh reddy 13 
Hi 

With the Salesforce API, is there any way to get the current time on the Salesforce server?

Can any one please help me out.
Best Answer chosen by Haneesh reddy 13
AbhishekAbhishek (Salesforce Developers) 
Yes, you can use the getServerTimestamp() method:

GetServerTimestampResult timestamp = binding.getServerTimestamp();

See Salesforce API Docs: getServerTimestamp() (https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_quickstart_intro.htm)

Thanks.
henry benhenry ben 
Hi,

Iam getting below error while adding products to opportunity.

Error ID:  584898851 - 13966 (- 1775489667)

Do anyone face this error please let me know how to get rid of this error.
Best Answer chosen by henry ben
AbhishekAbhishek (Salesforce Developers) 
Hi,

Based on the error message I suspect that your issue is related to the below-known issue,

https://trailblazer.salesforce.com/issues_view?id=a1p3A000001YonZQAS

If yes please try the workaround.

I hope you find the above information is helpful. If it does, please mark as Best Answer to help others too.

Thanks.
John KeplerJohn Kepler 

Hi,

I am creating a validation rule to restrict user from entering amount less than 10000$ when industry type is Corporate. I am facing an error.

Any help will be appreciated.

Thanks

John 

Best Answer chosen by John Kepler
D srinivas 8734D srinivas 8734
Hi John,
AND(ISPICKVAL( Industry , 'Corporate'),amount > 10000)
 
   
copy above formula and paste in Validation rule ..
For more information please visit below link
https://www.etggs.com/services/salesforce/ (https://www.etggs.com/services/salesforce/" style="color:#0563c1; text-decoration:underline)
chandan daschandan das 
Web experince is not working in salesforce1 Mobile
can any one please help me out.
Best Answer chosen by chandan das
AbhishekAbhishek (Salesforce Developers) 
Hi Das,

We retired the Salesforce mobile web experience with the Summer ’20 release.

Previously you were able to access the “Salesforce mobile app” experience on your device in two ways, by installing the downloadable Salesforce mobile app from Google Play or the App Store or via a supported mobile browser. Salesforce removed access to Salesforce on your browser, i.e., the mobile web experience. Starting with the Summer ’20 release, you need to have the Salesforce mobile app installed on your device or use Lightning Experience on iPad Safari.  

Why is Salesforce making this change?

Salesforce wants to focus development on enhancing the Salesforce mobile app to ensure you have a consistent and quality experience, which led us to the decision to retire the mobile browser version.

For further reference, you can check the below-documented article,

https://help.salesforce.com/articleView?id=000349471&language=en_US&type=1&mode=1

I hope you find the above information is helpful. If it does, please mark as Best Answer to help others too.

Thanks.
 
chandan daschandan das 
Hi,

Web experince is not working in salesforce mobile.
Has any one face this issue??

 
Best Answer chosen by chandan das
AbhishekAbhishek (Salesforce Developers) 
Hi Das,

We retired the Salesforce mobile web experience with the Summer ’20 release.

Previously you were able to access the “Salesforce mobile app” experience on your device in two ways, by installing the downloadable Salesforce mobile app from Google Play or the App Store or via a supported mobile browser. Salesforce removed access to Salesforce on your browser, i.e., the mobile web experience. Starting with the Summer ’20 release, you need to have the Salesforce mobile app installed on your device or use Lightning Experience on iPad Safari.  

Why is Salesforce making this change?

Salesforce wants to focus development on enhancing the Salesforce mobile app to ensure you have a consistent and quality experience, which led us to the decision to retire the mobile browser version.

For further reference, you can check the below-documented article,

https://help.salesforce.com/articleView?id=000349471&language=en_US&type=1&mode=1

I hope you find the above information is helpful. If it does, please mark as Best Answer to help others too.

Thanks.