Tuesday, August 24, 2021

How to install a package in salesforce with package id

This post explains how to install a package in salesforce with package id. 

Steps:

1.) If you want to install the package in Sandbox org, Use this URL:
    https://test.salesforce.com/packaging/installPackage.apexp?p0=P_Id
    For production org, use this URL :
    https://login.salesforce.com/packaging/installPackage.apexp?p0=P_Id

2.) Replace P_Id in the URL with your package id and hit the URL.

3.) Enter valid username and password of the salesforce org.

Login to salesforce

4.) You will see the like :

Install package in salesforce

Select the option for which you want to install the package and click upgrade.

After some seconds the package will be installed on your org.


To verify that package is installed or not perform the following steps on your org:

  • Go to the setup.
  • Search for the package and click Installed Packages.
  • If the package was installed successfully, you will see the package here.

Installed packages in salesforce



Thanks, 
Lovesalesforceyes

Sunday, August 1, 2021

Sample XML metadata file for deploy and retrieve components in salesforce

This post explains the xml meta file structure of salesforce. Almost all the salesforce components names for ant tool are covered in this post. Meta structure of almost all the components of salesforce are covered in this post which can retrieve and deploy successfully without any error. Below is the file:

<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <version>52.0</version>
    <types>
        <members>Test__c.FeedBack_Creation</members>
        <name>WorkflowAlert</name>
    </types>
    <types>
        <members>Campaign__c.Camp_Price</members>
        <name>WebLink</name>
    </types>
    <types>
        <members>https_risk</members>
        <name>CorsWhitelistOrigin</name>
    </types>
    <types>
        <members>Order__c.CompactLayout</members>
        <name>CompactLayout</name>
    </types>
    <types>
        <members>Account.Origin__c</members>
        <name>CustomField</name>
    </types>
    <types>
        <members>Account_Type.Cash_Test</members>
        <name>CustomMetadata</name>
    </types>
    <types>
        <members>Images/T_Logo.jpg</members>
        <name>Document</name>
    </types>
    <types>
        <members>view_en/Escalation_hrs</members>
        <name>EmailTemplate</name>
    </types>
    <types>
        <members>declared_User</members>
        <name>Group</name>
    </types>
    <types>
        <members>Test Dashboards</members>
        <name>HomePageComponent</name>
    </types>
    <types>
        <members>Territory Layout</members>
        <name>HomePageLayout</name>
    </types>
    <types>
        <members>Account.Match_Value</members>
        <name>MatchingRules</name>
    </types>
    <types>
        <members>Test_123 Layout</members>
        <name>Layout</name>
    </types>
    <types>
        <members>Task.Case_Activity</members>
        <name>RecordType</name>
    </types>
    <types>
        <members>VFBlock</members>
        <name>ApexComponent</name>
    </types>
    <types>
        <members>Village__c.Updat_Village</members>
        <name>WorkflowFieldUpdate</name>
    </types>
    <types>
        <members>Case.Case for type</members>
        <name>WorkflowRule</name>
    </types>
    <types>
        <members>Account</members>
        <name>QuickAction</name>
    </types>
    <types>
        <members>DetailClass</members>
        <name>ApexClass</name>
    </types>
    <types>
        <members>Location__c.Share_Manager__c</members>
        <name>SharingReason</name>
    </types>
    <types>
        <members>UTrigger</members>
        <name>ApexTrigger</name>
    </types>
    <types>
        <members>Comm_Config</members>
        <name>CustomApplication</name>
    </types>
    <types>
        <members>Area</members>
        <name>ContentAsset</name>
    </types>
    <types>
        <members>CrCase</members>
        <name>AuraDefinitionBundle</name>
    </types>
    <types>
        <members>Point_India</members>
        <name>AuthProvider</name>
    </types>
    <types>
        <members>Letter_Head</members>
        <name>Letterhead</name>
    </types>
    <types>
        <members>B_Site</members>
        <name>CspTrustedSite</name>
    </types>
    <types>
        <members>Edit_Permission_Inventory</members>
        <name>CustomPermission</name>
    </types>
    <types>
        <members>Account_Hierarchy</members>
        <name>ReportType</name>
    </types>
    <types>
        <members>Adop_Dashboard</members>
        <name>Dashboard</name>
    </types>
    <types>
        <members>Account.Duplicate_Rule</members>
        <name>DuplicateRule</name>
    </types>
    <types>
        <members>Embedded_Service</members>
        <name>EmbeddedServiceConfig</name>
    </types>
    <types>
        <members>B_Test</members>
        <name>ExternalDataSource</name>
    </types>
    <types>
        <members>Account_flow</members>
        <name>Flow</name>
    </types>
    <types>
        <members>Test</members>
        <name>GlobalValueSet</name>
    </types>
    <types>
        <members>Account_Page</members>
        <name>FlexiPage</name>
    </types>
    <types>
        <members>History__c</members>
        <name>CustomObject</name>
    </types>
    <types>
        <members>DetailCmp</members>
        <name>LightningComponentBundle</name>
    </types>
    <types>
        <members>Account.Aqu_Customers</members>
        <name>ListView</name>
    </types>
    <types>
        <members>Account.Match_Value</members>
        <name>MatchingRule</name>
    </types>
    <types>
        <members>Test_data</members>
        <name>NamedCredential</name>
    </types>
    <types>
        <members>Internal_Read_Users</members>
        <name>PermissionSet</name>
    </types>
    <types>
        <members>Escalated_Ch</members>
        <name>Queue</name>
    </types>
    <types>
        <members>amazon</members>
        <name>RemoteSiteSetting</name>
    </types>
    <types>
        <members>L_login</members>
        <name>AnalyticSnapshot</name>
    </types>
    <types>
        <members>Manager_Central</members>
        <name>Role</name>
    </types>
    <types>
        <members>Shipping__c.Shipping_Location</members>
        <name>SharingOwnerRule</name>
    </types>
    <types>
        <members>favicon</members>
        <name>StaticResource</name>
    </types>
    <types>
        <members>Portal_Logs__c</members>
        <name>CustomTab</name>
    </types>
    <types>
        <members>Account.Account_Mob</members>
        <name>ValidationRule</name>
    </types>
    <types>
        <members>StatementDown</members>
        <name>ApexPage</name>
    </types>
    <types>
        <members>Open</members>
        <name>CallCenter</name>
    </types>
    <types>
        <members>Dashboard Report Service</members>
        <name>EmailServicesFunction</name>
    </types>
    <types>
        <members>BusinessEmailService</members>
        <name>ApexClass</name>
    </types>
    <types>
        <members>T_Group</members>
        <name>ActionLinkGroupTemplate</name>
    </types>
    <types>
        <members>T_Bolt</members>
        <name>LightningBolt</name>
    </types>
    <types>
        <members>T_Path</members>
        <name>PathAssistant</name>
    </types>
    <types>
        <members>TestPlatform</members>
        <name>PlatformCachePartition</name>
    </types>
    <types>
        <members>TestDep</members>
        <name>RecordActionDeployment</name>
    </types>
    <types>
        <members>Account.test</members>
        <name>FieldSet</name>
    </types>
    <types>
        <members>Case.Test</members>
        <name>WorkflowOutboundMessage</name>
    </types>
    <types>
        <members>User.Record_sharing</members>
        <name>SharingCriteriaRule</name>
    </types>
    <types>
        <members>History__c.Key_Id__c</members>
        <name>CustomIndex</name>
    </types>
    <types>
        <members>EmailMessage.Test_Action</members>
        <name>WorkflowSend</name>
    </types>
    <types>
        <members>TestingPrompt</members>
        <name>Prompt</name>
    </types>
    <types>
        <members>Standard</members>
        <name>Profile</name>
    </types>
    <types>
        <members>Test_Group</members>
        <name>PermissionSetGroup</name>
    </types>
    <types>
        <members>P_Portal/Panel_Signature</members>
<name>Document</name>
    </types>
    <types>
        <members>Channel_Deployment</members>
        <name>EmbeddedServiceMenuSettings</name>
    </types>
    <types>
        <members>en_US</members>
        <name>Translations</name>
    </types>
    <types>
        <members>T_Notification</members>
        <name>CustomNotificationType</name>
    </types>
</Package>



After creating the correct meta file, you can deploy and retreive data with the help of workbench.

meta retrieval and deployment in salesforce

Retrieve : For the data retrieval you have to upload the correct meta xml or give package name.
Deploy : For the data deployment you have to upload the zip file which contains a meta xml file with the corresponding data folders. If you want to deploy the data in a package, then you have to add the <fullname> tag in the xml file as well.



Thanks, 
Lovesalesforceyes

How to get single email message limit with apex code in salesforce

This post explains how to get daily single email message(total and remaining) limits with apex code in salesforce. For that you have to hit the rest api end url(/services/data/v51.0/limits) that will return all the salesforce limits. From that you can only get the email limits and use it. Below are the two apex classes for that. SingleEmailDailyLimit class hit the endpoint with the required headers and generated the json response . SingleEmailDailyLimitWrapper class parses the json response and gives the result in required format. Below is both the apex classes:

SingleEmailDailyLimit.cls :


public class SingleEmailDailyLimit {
    public static void mailLimit(){
Http h=new http();
        HttpRequest req = new HttpRequest();
        req.setEndpoint('https://lovesalesforce-dev-ed.my.salesforce.com/services/data/v51.0/limits');
        req.setHeader('Authorization', 'Bearer '+userinfo.getSessionId());
        req.setHeader('Content-Type', 'application/json');
        req.setMethod('GET');
        HttpResponse res = h.send(req);
        SingleEmailDailyLimitWrapper result = new SingleEmailDailyLimitWrapper();
        result = SingleEmailDailyLimitWrapper.parse(res.getBody());
        system.debug('Total daily email limit of your org is : '+result.SingleEmail.Max);
        system.debug('Remaining daily email limit of your org is : '+result.SingleEmail.Remaining);
    }
    
}


SingleEmailDailyLimitWrapper.cls :


public class SingleEmailDailyLimitWrapper {
    
    public SingleEmail SingleEmail;
    public class SingleEmail {
        public Integer Max;
        public Integer Remaining;
    }
    public static SingleEmailDailyLimitWrapper parse(String json) {
        return (SingleEmailDailyLimitWrapper) System.JSON.deserialize(json, SingleEmailDailyLimitWrapper.class);
    }
}


Output :


Single email message limit in salesforce

Thanks, 
Lovesalesforceyes


Get selected radio button value in LWC

This post explains how to get selected radio button in LWC. Below is demo of output : To use the radio button in LWC you have to use the  li...