Monday 29 May 2023

Tackling the Visual Studio Head-Spinning Challenges

Error deploying or retrieving source: The file or directory that you tried to deploy or retrieve isn't in a package directory that's specified in your sfdx-project.json file. Add this location to your "packageDirectories" value, or deploy or retrieve a different file or directory. For details about sfdx-project.json, see: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_ws_config.htm

Solution that Resolved the Issue for Me was mentioned in 1st point:

  1. It appears that something within the project files became corrupted. I recommend obtaining a fresh clone of the entire folder by deleting the existing one. Please ensure you have a backup of any uncommitted files before proceeding.
  2. For some individuals, a simple solution that worked was opening VS Code, going to File, selecting New Window, and then opening the folder path to resolve the issue.
  3. A few individuals found success by downgrading their Salesforce CLI version, resolving the issue they were facing.


If you have successfully created a new branch in Bitbucket but are unable to see it when attempting to check it out from Visual Studio, even after waiting for a few minutes or refreshing the page, you can try the following solution. - git fetch

  1. Ensure that you have properly synchronized your local repository with the remote repository in Bitbucket. You can do this by running a git fetch command in your command-line interface or using the relevant option in your Git GUI tool.

Note : git fetch to get all available branches


Tuesday 9 May 2023

Salesforce - System.HttpResponse[Status=Moved Permanently, StatusCode=301]

As of May 6, 2023 (Summer '23-), The Mock Services included in our project have ceased to function. An error message was received indicating a "System.HttpResponse[Status=Moved Permanently, StatusCode=301]".

Note : My Domain URL Format Changes When You Enable Enhanced Domains

Fix :

1. Verify the Named Credentials URLs & Update the Base URLs with the latest changed URL

    Step : Navigate to Salesforce Classic and Get the Base URL and update 

Ex :  Old   -  https://<CompanyName>--dev.my.salesforce.com

        New  -  https://<CompanyName>--dev.sandbox.my.salesforce.com


2. Auth Providers - Verify the Salesforce Configuration URLs an update according to the latest Base URL, as mentioned above.



Sunday 7 May 2023

Salesforce Standard API vs Custom API

When it comes to integration requirements, it's always a significant question, and external teams often wonder why we should invest time in building a custom API when Salesforce already provides a standard API.

Here are the points that can be used to make a design decision based on the business requirement.

Standard API:

Pros:

  • Readily available for immediate use without any additional setup time or effort required
  • Maintenance-free
  • Optimal performance can be expected as it's a built-in standard feature

Cons:

  • Highly interdependent. If any changes are made to the schema, they must also be reflected in the external system, otherwise it will result in failure (e.g., modifying or removing a field's API name)
  • The absence of error handling adversely impacts investigation and troubleshooting
  • Native support for monitoring and alerting is absent, but custom logic can be added to the object trigger to provide this functionality if necessary
  • "Retrieving nested child object data for a parent requires individual calls to each child object, rather than being able to retrieve it in a single call. As an example, this would apply to Account --> Case and Contact
  • The system only follows the platform's sharing and security rules and does not permit the use of 'with' or 'without' sharing principles flexibly
  • Modifying the response received from the standard API is not possible, even if we need it in a different format. In such cases, a Salesforce case must be raised, but there is no guarantee that the response will be changed according to custom requirements
  • It is not feasible to implement any custom logic such as validations and mapping

Custom API:

Pros:

  • Custom APIs offer a high degree of customization, effectively addressing all the limitations of the standard API mentioned above.
  • There is not a significant variation in performance between custom and standard APIs

Cons:

  • Building a custom API demands development efforts and subsequent ongoing maintenance in accordance with business requirements


Sunday 26 February 2023

LWC - Troubleshooting And Solutions

1. Lightning Web Component is not coming up in the quick options dropdown for selection ? 
1. Verify "is Exposed" Ture 
2. Verify Record Action is added 
3. Verify the Api version, Should be latest --> Ex : If it is 46 it will not come in the selection list, Changed to 52 its coming up.

2. Quick action coming with empty image ?
In the highlight panel select the corresponding icon for the action
Select icons from below
https://www.lightningdesignsystem.com/icons/#action
action:check
standard:case , standard:client

3. LWC component's @wire target property or method threw an error during value provisioning. Original error [<X> is not defined] ?
If you created a method and that is been called part of the @wire method then you might have forgot to add "this".
Ex: callMethod() Instead it should be this.callMethod() in @wire method otherwise it gives you error like above.

Wednesday 18 January 2023

Salesforce Closed Incident History

 1. How to see the current ongoing issues in Salesforce ?

      Go to --> https://status.salesforce.com/ --> Which provides transparency around service availability and performance for Salesforce products.   



 2. How to see the closed incidents history ?

      Go to --> https://status.salesforce.com/







      



      









Salesforce Real Time Interview Questions

 1. In the role hierarchy you have agents in different country  and they are reporting to respective leads of each country  & Organization-Wide Default (OWD) for objects set as private. So agents can't see each other records by default. What about country leads ? Can one country lead see other country agents owned records?


  
No, Even though country leads are at the same level only agents reporting roles can only see the lower level hierarchy records.

2. How to improve the slow running SOQL ?

  • Rearrange the where condition to take the index fields precedence
  • Remove the unnecessary fields in the select query especially if any long text area fields
  • Add additional business filter conditions where ever possible
  • Add Limit on number of returning records. 
  • If the data is very large and required to use non index fields in where condition try to see the possibility of making them as external id which will automatically get indexed.
3. Renaming Field Labels Considerations/ Any ramifications ?

No, In your business logic as best practice always should use the API names instead of Label, In that design no impact because field label is a static text. Only impact could be an email template merge fields, Apart from that all should work fine.

4.  New Mandatory Field Impact on Existing Records ?
Even though you create new field which is mandatory it will not impact any existing records, In case any of the old record is trying to update that time you see the validation as field required for this new mandatory field.


Tuesday 10 January 2023

Salesforce Collections Best Practices

 1. How many number of items can be added into a Salesforce Collection (List/Set/Map)?

     No Limit, Earlier it was 1000 but later it's been removed but keep in mind if you add more number of items it will lead to the Heap Size Error, Means too much data is being stored in memory during processing,6MB for synchronous transactions and 12MB for asynchronous transactions.

Fix have the SOQL query with as many as filter conditions and have the low number on the limit of records to be returned, To add to the list & Have the declaration with in required scope only.