Skip to main content

Posts

How to prevent the changes to the field in Salesforce after it has been saved?

If the requirement is to prevent the changes to a field after it has been saved initially, there can many ways to do it but the best approach would be from the Validation rules. Its quite simple in Validation rule than doing the same in triggers with apex code. Lets take an example, In the Orders Object you have custom field 'Initial_Payment_Made__c" and once this field has been saved, we should not be able to edit or prevent any changes to this field. We can create a validation rule for this as below. AND(    ISCHANGED( Initial_Payment_Made__c ),    NOT( ISNEW() ) )

Salesforce Dashboards : Points to Remember

A dashboard is a visual display of key metrics and trends for records in your org. The relationship between a dashboard component and report is 1:1; for each dashboard component, there is a single underlying report. However, you can use the same report in multiple dashboard components on a single dashboard (e.g., use the same report in both a bar chart and pie chart). Multiple dashboard components can be shown together on a single dashboard page layout, creating a powerful visual display and a way to consume multiple reports that often have a common theme, like sales performance, customer support, etc. Points to Remember: Each dashboard component has Data sources with source report and components which are visual format like graph, chart or gauge To create a dashboard component, drag the report from Data sources into Dashboards area and Drag the visual component to the same area.  Visualforce pages can also be added to the Dashboards to show custom interfaces Dashboar...

Deploying Metadata Migration Failed

While Deploying Metadata in your Org thru ANT tool fails with below error, even though you have enter the right username and password with security token and URL.  BUILD FAILED D:\Salesforce Migration Tool\salesforce_ant_38.0\sample\build.xml:60: Invalid username, password, security token; or user locked out. In this case, its quite possible that, you are deploying Apex classes to production environment, and total test coverage is not greater than 75% or all the Classes or not covered with test classes.  In case you are deploying to another sandbox or dev environment then you don't need to test your classes.

Multiple active sessions of API connection with external system

Sometimes, when an API connects with an external system, it cannot use same session and hence will be requesting new session (previous session will still be active) each time it connects with Salesforce. In such scenarios many questions arise as below.  - What happens to previous sessions? - Do they expire automatically after 120 minutes? - At a given time, how many active sessions there can be? - What are the implications of multiple open sessions at given point in time?  Depending on how they are created, your session responds accordingly. For example, if you are using the SOAP API to call login () with the same credentials from a single device, you will likely get the same session Id back. Beware of calling logout () here, as you will end both (being the same session). Expiry time will be controlled by the configuration. Default is 120 minutes after last activity, but this can be changed. The limiting factor in terms of usage will be the Concurrent API...

How to add Related List to the Opportunity page Layout?

In order to add Related List to the Opportunity Page Layout, follow below steps.  ·          One of the requirements is that the respective Custom Object should have a relationship (Master Detail or Lookup) with the standard Opportunity object. You can accomplish this by creating a custom field of type Master Detail or Lookup on your Custom Object where Opportunity is the parent . ·          Next step would be navigate to  Setup > Opportunity in Quick Find within Side Panel > Page Layouts > Edit > Related Lists from the top panel > Drag and drop the appropriate related list from the top panel to the page layout > Save.

Finding and Deleting Duplicate Records in Salesforce

Let’s suppose you have duplicate records in an entity, say Opportunities with some custom field Opportunity Number being same for multiple records. These are redundant records which may not be useful and you want to get rid of it.  In order to delete these records, you may think of making this field as unique but, this is not allowed without removing duplicates in this field.  One of the ideal option is to go to developer console (Setup > Developer Console) and run below query.  1 select   id,name,Oppty_Number__C from   opportunity order   by   Oppty_Number__C   With this you can not only see the opportunity records but also edit and delete the unwanted ones.  Also, not in the above query you can user "Group By" clause, but if you use this you cannot edit the resulting records. 

Updating All Parent Accounts when Child Account is updated

There are many ways you can achieve this as below.  1.      Process Builder   1.      System Administrators can do it easily 2.      Irrespective of Master Detail or Lookup, should work 2.      Apex Trigger 1.      This is helpful if you have advanced processing logic that is needed. 2.      If you go with this option, remember to make a custom setting to that you can use it to turn a trigger on or off without deactivating it through a code deployment.  3.      Cross Object Formula 1.      If you have a reference to the child account on the parent account, you can use a formula (checkbox) to do this. 2.      Provided your object relationship is Master Detail all the way in the hierarchy