Play Games

Search This Blog

Wednesday, July 20, 2022

How to align label and value to appear in same line(single line) in standard lightning record page salesforce - SalesforceGlobe4U

Solution: If you set the Density settings as compact, the label and value in record page will appear in same line

Go to Setup --> User Interface --> Density Settings -->Compact


The alignment of field label and value will look like this


If you want to display label on top and value below in record page, set the Density setting as Comfy




Tuesday, July 19, 2022

Code Builder Salesforce - Salesforce Globe For You

Code Builder is a salesforce IDE(Integrated Development Environment) which can be accessed directly from web browser itself.

We can use this Salesforce Code Builder IDE to do salesforce development similar to Visual studio code.

Setup of Code Builder: 

Step 1: Go to the Code Builder(Beta) in the app exchange or click the link below

https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3u00000Qsdi5EAB and install the package in your org.

Step 2: To give access to code builder for a specific user, code builder permission set needs to be assigned to that user.


Step 3: To access Code Builder IDE, go to the Code Builder (Beta) app from the app manager as shown in the image below


Step 4: connect to the org and start exploring the code Builder.

Note: Code Builder is in Open Beta as of now.

How to load currency exchange rates in salesforce - Salesforce Globe For You

Solution: load the currency exchange rates records into DatedConversionRate object using Data loader.


Step 1: Prepare the CSV file as shown in the image 

insert the data using data loader

Output: The currency exchange rates are loaded as shown below



Monday, July 11, 2022

Convert list into map in salesforce - Salesforce Globe For You

Solution: In order to convert list into map in salesforce, iterate the list and use the map.get() and map.put() to prepare the map

Example: In this example we will create map with AccountId as key and value as list of contacts by iterating the list of contacts

Map<String,List<contact>> mapAccountWithContacts = new Map<String,List<Contact>>();

for(contact objContact :[Select id,name,accountId from contact where accountId != null]) {

if(mapAccountWithContacts.containsKey(objContact.accountId)) {

mapAccountWithContacts.get(objContact.accountId).add(objContact);

} else {

mapAccountWithContacts.put(objContact.accountId,new List<Contact>{objContact});

}

}

system.debug('Map :'+mapAccountWithContacts);

Output:



Thursday, July 7, 2022

How to change the datatype of standard name field in a custom object to auto number in salesforce - Salesforce Globe For You

Solution: In order to convert name field's datatype  to datatype auto number in salesforce, Go to the name field and click on Edit. In this example we are going to change the datatype of name field of Award__c custom object


change the data type to auto number, enter format, starting number as shown in the image below and save it.


That's it.

Output:



Assign permission sets to multiple users quickly in salesforce - Salesforce Globe For You

Solution: In order to assign permission sets to multiple users in salesforce, One of the solution is to use Data Loader to assign permission sets to users.

Below are the 2 permission sets to be assigned to users

Rating with id 0PS90000001oCOX

Testing with id 0PS900000018xJ7




PermissionSetAssignment is the standard salesforce object which represents the relationship between a user and a permissionset.

https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_permissionsetassignment.htm

Create a csv file as shown below


If 3 permissionsets needs to be assigned to a user,then 3 rows to be inserted for 1 user with 1 permissionset in each row.

Using Dataloader ,insert the data into the PermissionSetAssignment object.

Output:



Wednesday, July 6, 2022

Monday, July 4, 2022

Access the static resource images in Lightning Web Component salesforce - Salesforce Globe For You

Solution: In order to access the static resource image in lightning component, import the static resource file using '@salesforce/resourceUrl/staticresourcename' and then refer it in the code.

Example:

Created a static resource zip file of 3 images as shown in image below


LWC Component:

displayStaticResourceImagesInLWC.html

<template>

    <lightning-card title="Show Images from Static Resource">

        <template for:each={imagesToDisplay} for:item="img" >

            <div key={img.image}>

                <img src={img.image}  width="150" height="75"/>

            </div> <br key={img.image}/>

        </template>

    </lightning-card>

</template>

displayStaticResourceImagesInLWC.js

import { LightningElement,api } from 'lwc';

import ImagesZip from '@salesforce/resourceUrl/memorypics';

export default class DisplayStaticResourceImagesInLWC extends LightningElement {

    @api imagesToDisplay =[

        {

            image :`${ImagesZip}/images/image1.jpg`

        },

        {

            image :`${ImagesZip}/images/image2.jpg`

        },

        {

            image :`${ImagesZip}/images/image3.jpg`

        }

    ]

}

displayStaticResourceImagesInLWC.js-meta.xml

<?xml version="1.0" encoding="UTF-8"?>

<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">

    <apiVersion>55.0</apiVersion>

    <isExposed>true</isExposed>

    <targets>

        <target>lightning__RecordPage</target>

        <target>lightning__AppPage</target>

        <target>lightning__HomePage</target>

    </targets>

</LightningComponentBundle>

Output: