Showing posts with label Deployment. Show all posts
Showing posts with label Deployment. Show all posts

Monday, July 11, 2016

Sample Package.xml in ANT to Fetch Static Resources in Salesforce

Sample package.xml file to fetch Static Resources from Salesforce

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>Please Type ResourceName</members>        
        <members>Favicon</members>
        <members>JQuery</members>
        <members>MobileMiniUKLtd_Logo</members>
        <name>StaticResource</name>
    </types>
    <version>30.0</version>
</Package>

Thanks for visiting...Enjoy!

Package.xml in ANT to Fetch Standard Objects in Salesforce

Sample package.xml file to fetch Opportunity Object

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>Opportunity</members>
        <name>StandardObject</name>
    </types>
    <version>30.0</version>
</Package>


Thanks for visiting...Enjoy!

Wednesday, June 22, 2016

25 Basic Deployment or Test Classes Issues During Deployment in Salesforce

1.System.DmlException: ConvertLead failed. First exception on row 0; first error: ENTITY_IS_DELETED, entity is deleted: []

2.System.NullPointerException: Argument 1 cannot be null

3.System.LimitException: Too many SOQL queries: 101

4.System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, SampleTrigger: execution of AfterInsert caused by: System.DmlException: Update failed. First exception on row 0 with id a4980000001paQSAAY; first error:

5.first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, SampleTrigger: execution of AfterUpdate caused by: System.NullPointerException: Attempt to de-reference a null object Trigger.SampleTrigger: line 181, column 1: [] Trigger.ChildTrigger: line 85, column 1 Trigger.ChildTrigger: line 50, column 1: []

6.System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, OrderRequest: execution of AfterInsert caused by: System.DmlException: Process failed. First exception on row 0; first error: NO_APPLICABLE_PROCESS, No applicable approval process was found.: [] Trigger.OrderRequest: line 81, column 1: []

7.System.LimitException: Too many query rows: 50001

8.No such column 'Unique_Key__c' on entity 'End_Date_Ruleset__c'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

9.This custom field is referenced elsewhere in salesforce.com. : Field Updates.

10.Field Project_Quarter__c does not exist. Check spelling.

11.In field: field - no CustomField named Job_Profile__c.ID_to_get_cluster_value__c found

12.An object 'Lead-ETS/WMI Lead Page Layout' of type Layout was named in package.xml, but was not found in zipped directory

13.An object 'Lead.IsUKCreatedLead__c' of type CustomField was named in package.xml, but was not found in zipped directory

14.System.DmlException: ConvertLead failed. First exception on row 0; first error: UNKNOWN_EXCEPTION, System.DmlException: Update failed. First exception on row 0 with id 00Q8000001e17G8EAI; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, UpdateAcctShippingAddr: execution of AfterUpdate caused by: System.LimitException: Too many SOQL queries: 101

15.Fatal Error null: The changes you requested require salesforce.com to temporarily lock your organization's administration setup. However, the administration setup has already been locked by another change. Please wait for the previous action to finish, then try again later.

16.Invalid field Billing_Email__c for SObject Account

17.System.QueryException: List has no rows for assignment to SObject

18.Stack Trace: Class.SendEmailQuote.generateEmailBody: line 941, column 1 Class.SendEmailQuote.<init>: line 151, column 1 Class.TestSendEmailQuote.Test1: line 73, column

19.Cannot update a field to a Lookup, MasterDetail, or Hierarchy from something else

20.Apex class 'QuoPDF_US' does not exist

21.Dependent class is invalid and needs recompilation: QuoPDF_US: line 58, column 20: Invalid type: Sales_Cond_Type__c

22.Invalid type: Sales_Type__c

23. new_quote does not exist or is not a valid override for action New.

24. Field is not writeable: Service_Order__c.CreatedById

25. Code Coverage Failure Your code coverage is 74%. You need at least 75% coverage to complete this deployment.


Thanks for visiting...Enjoy!

Monday, June 13, 2016

Sample package.xml Manifest Files for all types in Salesforce Ant

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>*</members>
        <name>AccountCriteriaBasedSharingRule</name>
    </types>
    <types>
        <members>*</members>
        <name>AccountOwnerSharingRule</name>
    </types>
    <types>
        <members>*</members>
        <name>CustomApplication</name>
    </types>
    <types>
        <members>*</members>
        <name>AppMenu</name>
    </types>
    <types>
        <members>*</members>
        <name>ApprovalProcess</name>
    </types>
    <types>
        <members>*</members>
        <name>AssignmentRule</name>
    </types>
    <types>
        <members>*</members>
        <name>AuthProvider</name>
    </types>
    <types>
        <members>*</members>
        <name>CallCenter</name>
    </types>
    <types>
        <members>*</members>
        <name>CampaignCriteriaBasedSharingRule</name>
    </types>
    <types>
        <members>*</members>
        <name>CampaignOwnerSharingRule</name>
    </types>
    <types>
        <members>*</members>
        <name>CaseCriteriaBasedSharingRule</name>
    </types>
    <types>
        <members>*</members>
        <name>CaseOwnerSharingRule</name>
    </types>
    <types>
        <members>*</members>
        <name>ApexClass</name>
    </types>
    <types>
        <members>*</members>
        <name>Community</name>
    </types>
    <types>
        <members>*</members>
        <name>ApexComponent</name>
    </types>
    <types>
        <members>*</members>
        <name>ConnectedApp</name>
    </types>
    <types>
        <members>*</members>
        <name>ContactCriteriaBasedSharingRule</name>
    </types>
    <types>
        <members>*</members>
        <name>ContactOwnerSharingRule</name>
    </types>
    <types>
        <members>*</members>
        <name>CustomApplicationComponent</name>
    </types>
    <types>
        <members>*</members>
        <name>CustomObjectCriteriaBasedSharingRule</name>
    </types>
    <types>
        <members>*</members>
        <name>CustomObjectOwnerSharingRule</name>
    </types>
    <types>
        <members>*</members>
        <name>CustomPermission</name>
    </types>
    <types>
        <members>*</members>
        <name>Dashboard</name>
    </types>
    <types>
        <members>*</members>
        <name>DataCategoryGroup</name>
    </types>
    <types>
        <members>*</members>
        <name>Document</name>
    </types>
    <types>
        <members>*</members>
        <name>EmailTemplate</name>
    </types>
    <types>
        <members>*</members>
        <name>EscalationRule</name>
    </types>
    <types>
        <members>*</members>
        <name>FlexiPage</name>
    </types>
    <types>
        <members>*</members>
        <name>Flow</name>
    </types>
    <types>
        <members>*</members>
        <name>Group</name>
    </types>
    <types>
        <members>*</members>
        <name>HomePageComponent</name>
    </types>
    <types>
        <members>*</members>
        <name>HomePageLayout</name>
    </types>
    <types>
        <members>*</members>
        <name>CustomLabels</name>
    </types>
    <types>
        <members>*</members>
        <name>Layout</name>
    </types>
    <types>
        <members>*</members>
        <name>LeadCriteriaBasedSharingRule</name>
    </types>
    <types>
        <members>*</members>
        <name>LeadOwnerSharingRule</name>
    </types>
    <types>
        <members>*</members>
        <name>Letterhead</name>
    </types>
    <types>
        <members>*</members>
        <name>Network</name>
    </types>
    <types>
        <members>*</members>
        <name>CustomObject</name>
    </types>
    <types>
        <members>*</members>
        <name>CustomObjectTranslation</name>
    </types>
    <types>
        <members>*</members>
        <name>OpportunityCriteriaBasedSharingRule</name>
    </types>
    <types>
        <members>*</members>
        <name>OpportunityOwnerSharingRule</name>
    </types>
    <types>
        <members>*</members>
        <name>ApexPage</name>
    </types>
    <types>
        <members>*</members>
        <name>PermissionSet</name>
    </types>
    <types>
        <members>*</members>
        <name>Portal</name>
    </types>
    <types>
        <members>*</members>
        <name>PostTemplate</name>
    </types>
    <types>
        <members>*</members>
        <name>Profile</name>
    </types>
    <types>
        <members>*</members>
        <name>Queue</name>
    </types>
    <types>
        <members>*</members>
        <name>QuickAction</name>
    </types>
    <types>
        <members>*</members>
        <name>RemoteSiteSetting</name>
    </types>
    <types>
        <members>*</members>
        <name>Report</name>
    </types>
    <types>
        <members>*</members>
        <name>ReportType</name>
    </types>
    <types>
        <members>*</members>
        <name>Role</name>
    </types>
    <types>
        <members>*</members>
        <name>Scontrol</name>
    </types>
    <types>
        <members>*</members>
        <name>Settings</name>
    </types>
    <types>
        <members>*</members>
        <name>SharingSet</name>
    </types>
    <types>
        <members>*</members>
        <name>SiteDotCom</name>
    </types>
    <types>
        <members>*</members>
        <name>CustomSite</name>
    </types>
    <types>
        <members>*</members>
        <name>StaticResource</name>
    </types>
    <types>
        <members>*</members>
        <name>CustomTab</name>
    </types>
    <types>
        <members>*</members>
        <name>ApexTrigger</name>
    </types>
    <types>
        <members>*</members>
        <name>UserCriteriaBasedSharingRule</name>
    </types>
    <types>
        <members>*</members>
        <name>UserMembershipSharingRule</name>
    </types>
    <types>
        <members>*</members>
        <name>CustomPageWebLink</name>
    </types>
    <types>
        <members>*</members>
        <name>Workflow</name>
    </types>
    <version>31.0</version>
</Package>


Thanks for visiting...Enjoy!

Tuesday, April 19, 2016

First error: NO_APPLICABLE_PROCESS, No applicable approval process was found

When your trying to make any kind of deployment on Production by default all the test classes will be run .To make smother deployment we need to have at least 75% code coverage .Recently when I'm making deployment to production I end up with the below error.

Deployment /Test Class Error:

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, ORequestTrigger: execution of AfterInsert caused by: System.DmlException: Process failed. First exception on row 0; first error: NO_APPLICABLE_PROCESS, No applicable approval process was found.: [] Trigger.ORequestTrigger: line 81, column 1: []

Reason for the Issue:

If you running any Test class that in turn causes a Main class or Trigger to submit the Test record for an Approval Process (through Apex coding) and If that particular record is failing to meet at least one of the Approval Processes Entry Criteria then it will fail with above error.

Work Around Solution:

Modify the test record data as per the entry criteria of any one of required Approval Process.


Thanks for visiting...Enjoy


Thursday, February 4, 2016

myRule_4_A3 (Action Call) - We can't find an action with the name and action type that you specified

This type error will occurs whenever your performing any deployment activities.This error mainly related to the Process Builder processes or Any Flows that are the part of the deployment package. 

The sample error message looks like below.

Update Oppty-17 Flow Version 0 0 myRule_4_A3 (Action Call) - We can't find an action with the name and action type that you specified.

This error message says that action (Email alert,Field update,task etc) related to this Process Update Oppty-17   is missing as part of the deployment package or not in the targeting instance.

Work Around :

1. Please include that action as part of the deployment package
                                               (or)
2.Make sure that action is available in target instance before your making a deployment

Enjoy....!!

Tuesday, January 19, 2016

Error: entity is not org-accessible?

Basically we will be getting this error because of the many reasons among them here I'm listing few scenarios where we will be getting this one.

1. While deployment if your getting this means some features are enabled in source org and same has not been enabled in target org.
 
    Example: Enabled the Territories in Source Org and not in Target Org
    Solution : Enable Territories in Target Org also

2. While saving any Apex class/Trigger if your getting means you are using some feature which is not enabled currently in your org.

    Example : If your using OpportunityTeamMember object in Opportunity Trigger but in your organisation you haven't enabled the Opportunity Teams you will be receiving same error.
    Solution  : Enable Opportunity Team feature in your org first.

3. Any Spelling mistakes in API Names also causes same.

Enjoy.......!


Best Practices for writing Test Class in Salesforce

  • You must have at least 75% of your Apex covered by unit tests to deploy your code to production environments. In addition, all triggers must have some (at least 1%) test coverage.
  • We recommend that you have 100% of your code covered by unit tests, where possible.
  • Calls to System. Debug are not counted as part of Apex code coverage in unit tests.
  • Use Test.loadData () method to load test data from Static resources.
  • Use Test.starttest() and Test.starttest() to reset governor limits.
  • Use test setup methods (methods that are annotated with @testSetup) to create test records once and then access them in any test method in the test class.
  • In the case of conditional logic (including ternary operators), execute each branch of code logic.
  • Make calls to methods using both valid and invalid inputs.
  • Complete successfully without throwing any exceptions, unless those errors are expected and caught in a try…catch block.
  • Use Limits Class to avoid governor limits related issues.
  • Always handle all exceptions that are caught, instead of merely catching the exceptions.
  • Use System.assert methods to prove that code behaves properly.
  • Use the runAs method to test your application in different user contexts.
  • Use the isTest annotation. Classes defined with the isTest annotation do not count against your organization limit of 2 MB for all Apex code. See IsTest Annotation.
  • Exercise bulk trigger functionality—use at least 20 records in your tests.
  • Use the ORDER BY keywords to ensure that the records are returned in the expected order.
  • Not assume that record IDs are in sequential order.
  • Record IDs are not created in ascending order unless you insert multiple records with the same request. For example, if you create an account A, and receive the ID 001D000000IEEmT, then create account B, the ID of account B may or may not be sequentially higher.
  • On the list of Apex classes, there is a Code Coverage column. If you click the coverage percent number, a page displays, highlighting all the lines of code for that class or trigger that are covered by tests in blue, as well as highlighting all the lines of code that are not covered by tests in red. It also lists how many times a particular line in the class or trigger was executed by the test
  • Write comments stating not only what is supposed to be tested, but the assumptions the tester made about the data, the expected outcome, and so on.
  • Test the classes in your application individually. Never test your entire application in a single test.
  • Set up test data:
·         Create the necessary data in test classes, so the tests do not have to rely on data in a particular organization.
·         Create all test data before calling the Test.starttest () method.
·         Since tests don't commit, you won't need to delete any data.
  • If you are running many tests, consider the following:
·         In the Force.com IDE, you may need to increase the Read timeout value for your Apex project. See https://wiki.developerforce.com/index.php/Apex_Toolkit_for_Eclipse for details.
·         In the Salesforce user interface, you may need to test the classes in your organization individually, instead of trying to run all of the tests at the same time using the Run All Tests button.
·         Create Test Suites of Commonly Used Apex Test Classes Available only from Spring 16.

·         Check the disable parallel apex testing when your performing  Run All test

Aside.io for Salesforce

Aside.io is a Salesforce IDE ,up in the cloud ,which is built on top of the different API's like Metadata API and Tooling API .ASIDE is a free and full-featured Salesforce IDE built from the ground up for efficient delivery, design, and testing of Apex and Visualforce code.It's a very good tool to perform the Quick Development of code,Quick deployments,Running Test Classes and Performing the Queries.

Features:

1.CODE EDITOR:

  • Fast Saving the apex code without any dialog.
  • Rich User Interface with Auto complete features and highlighting the invisible characters.
  • Modifying the Static Resources directly in salesforce zip file without downloading.





















  • Run unit tests in three different ways: all at once, by query, or through individual selection.
  • View the Test classes results clearly with help of Stack Trace Parser.
  • Getting the code coverage report for all classes or set of classes.





















3.DEPLOY MANAGER:
  • Retrieving the components without building any package.xml.
  • Drag and Drop feature to Deploy or Retrieve the components from/into the salesforce.
  • Quick generation of the package.xml to share with others.





















4.QUERY TOOL:
  • Fetching the data from Standard Objects,Custom Objects,Custom Settings etc.
  • Export the query result as the form of CSV.
  • Easy way of Sharing the Query Results with others.
  • Quick Creation,Modifying or Deletion of the records.




















In my next post I will share How to use this Aside.io for development and deployments etc.


Keep watching the site for more updates enjoy......!