Shubham Singhal
IndividualForum Replies Created
-
Shubham
MemberSeptember 4, 2017 at 5:54 am in reply to: How to show error message on the detail page of Salesforce sobject through before delete trigger?Hi RadaKrishna
How it is Work now,can you explain please
Actually now It is also navigate to the other page on delete of a selected account in case of 'before delete' trigger is active
-
Hello Uday
****In Controller****
This is our getter and setter method(getImage and setImage) ,Here we First get value of our Image. Then in setter method we set this value to our declared variable(String selectedImage).
****InVF Page****
There is an attribute disabled in "button" through this we enable or disable our button according o given condition.Condition is defined in If Block inside the disabled attribute.
If selectedImage is empty then button is disable,Otherwise it is enable.
-
Hello Uday
****Controller****
public class sampleCon {
public String selectedImage{get;set;}public sampleCon(){
selectedImage = '';
}
public PageReference test() {
return null;
}public List<SelectOption> getItems() {
List<SelectOption> Images = new List<SelectOption>();
Images.add(new SelectOption('hyd','hyd'));
Images.add(new SelectOption('che','che'));
Images.add(new SelectOption('bng','bng'));
return Images;
}public String getImage() {
return selectedImage;
}public void setImage(String selectedImage) {
this.selectedImage = selectedImage;
}
}****VisualForcePage****
<apex:page controller="sampleCon">
<apex:form>
<apex:selectList value="{!selectedImage}" multiselect="true">
<apex:selectOptions value="{!Items}"/>
</apex:selectList><p/>
<apex:commandButton value="Test" action="{!test}" rerender="out" status="status"/>
</apex:form>
<apex:outputPanel id="out">
<apex:actionstatus id="status" startText="testing...">
<apex:facet name="stop">
<apex:form>
<apex:commandButton value="Submit" disabled="{!If(selectedImage == '',True,False)}"/>
</apex:form>
</apex:facet>
</apex:actionstatus>
</apex:outputPanel></apex:page>
-
Please Go to the setup You find Object Manager (with low arrow Option) Click that arrow.Then you find New (+ New Object) through this you create your Object.Here Expense and Camping Item are Custom Object.
After creating any Object you find Field and Relationship options on left side.Click it then create field whatever you want.
-
Hello Anish
Please Follow the below link
This is the trailhead module for your questions. As you start the Lightning Concepts So firstly you must set up your org setting.In given module it is step by step process to solve your problem.
-
Shubham
MemberAugust 23, 2017 at 9:38 am in reply to: why salesforce introduced without sharing keyword,but apex class run on the system mode?Hello Uday
If a class is call by(or call) another class which enforce sharing rule(with sharing) then its automatically enforced sharing rule.In this situation if we want that our class don't acquire sharing then we use 'without sharing' Keyword.
E.g.
****Sharing Class****
public with sharing class sharing{
}
****Class Call(or Call by) Sharing Class****
public without sharing class notsharing{
}
-
Shubham
MemberAugust 23, 2017 at 8:17 am in reply to: what is difference between static methods and non static methods in Salesforce?hello Uday
****Static Method****
Static methods can be used without instantiating a new instance of the class.
public class Utils {
public static String getHelloWorld() {
return 'Hello World';
}
}These methods can be called directly
String salutation = Utils.getHelloWorld();
****Non-Static Method****
Non-static method must have a new instance of the class instantiated in order to be used. Typically these rely on data inside the class that then is referred to inside the classpublic class Utils {
public String getHelloWorld() {
return 'Hola Mundo';
}This version of the method requires us to create a new instance
Utils a = new Utils();
String require =a.getHelloWorld();
-
Shubham
MemberAugust 22, 2017 at 9:30 am in reply to: How i can delete selected list value on button click in Salesforce?hello Shaharyar
Please Try below Code,Its for Contact you may use for other Object
*****Controller****
public class deleteContactController
{
public List<wrapContact> listWrapContact {get; set;}
public class wrapContact
{
public Contact con {get; set;}
public Boolean selected {get; set;}
public wrapContact(Contact c)
{
con = c;
selected = false;
}
}public deleteContactController()
{
listWrapContact = new List<wrapContact>();list<Contact> con = [select id,lastname, (select id from cases) from Contact];
for(Contact c : con)
{
if(c.cases.size() == 0){
listWrapContact.add(new wrapContact(c));
}}
}public void processSelected() {
List<Contact> lstconToDelete = new List<Contact>();
for(wrapContact wcon: listWrapContact)
{
if(wcon.selected == true)
{
lstconToDelete.add(wcon.con);
}
}if(lstconToDelete.size() > 0 )
{
Delete lstconToDelete;
}}
}****Vf Page****
<apex:page Controller = "deleteContactController">
<apex:form >
<apex:pageBlock Title="Contacts">
<apex:commandButton value="Delete Selected" action="{!processSelected}"/>
<apex:pageBlockSection >
<apex:pageBlockTable value="{!listWrapContact}" var="a">
<apex:column >
<apex:inputCheckbox value="{!a.selected}"/>
</apex:column>
<apex:column value="{!a.con.id}"/>
<apex:column value="{!a.con.lastname}"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page> -
Shubham
MemberAugust 22, 2017 at 5:35 am in reply to: What is Service Cloud Console in Salesforce and how do I enable it on my Salesforce?hello Aman
Please refer the link below.
Its gives you idea about what is Service Cloud Console and how enable the Service Cloud Console.
-
Shubham
MemberAugust 21, 2017 at 1:33 pm in reply to: How we can make a button of expand and collapse in Salesforce?Thanks Shariq
Please give Vf Page
-
Shubham
MemberAugust 21, 2017 at 1:00 pm in reply to: How to show related contacts under account in a Salesforce Visualforce page?Hello RadhaKrishna
Please Try below Code
Controller -
public class actocons
{
public list<account> acct{set;get;}
public actocons()
{
acct=[select id,name,(select id,lastname from contacts)from account limit 5];
}
}VisualForce Page -
<apex:page controller="actocons" tabStyle="Account">
<apex:pageBlock >
<apex:repeat value="{!acct}" var="a">
<apex:pageBlockSection id="section1" title="{!a.name}" onclick="document.getElementById('{!$Component.section1}').childNodes[0].childNodes[0].click();">
<script>twistSection(document.getElementById("{!$Component.section1}").childNodes[0].childNodes[0]);document.getElementById("{!$Component.section1}").childNodes[0].style.cssText = "cursor:pointer;" </script>
<apex:outputField value="{!a.Name}"/>
<apex:pageBlockTable value="{!a.Contacts}" var="c" id="j1">
<apex:column value="{!c.id}" />
<apex:column value="{!c.lastname}"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:repeat>
</apex:pageBlock>
<script>
twistSection = (function() {
var cached_function = twistSection;return function(twisty, sectionId) {
cached_function.apply(this, arguments); // use .apply() to call the original twistSection function provided by Salesforce
if (event.stopPropagation) {
event.stopPropagation();
} else {
event.cancelBubble = true;
}
};
}());</script>
</apex:page> -
Shubham
MemberAugust 21, 2017 at 10:15 am in reply to: How to retrieve related List of Objects which exist in Salesforce?Hi Shaharyar
Please Try This Query
//
Select Id,(Select id From Contacts),(select id from cases),(select id from opportunities) from Account
//
You may use different field according to your need
-
Hello Uday -
There are two type of Life Cycle i.e. if we use Production Organistaion or if we use SandBox
Develop in a Production Organization
Life Cycle -
1.Plan functional requirements.
2.Develop using Salesforce Web tools, using profiles to hide your changes until they’re ready to deploy.
3.Update profiles to reveal your changes to the appropriate users.
4.Notify end users of changes.Develop with Sandbox
Life Cycle -
1.Create a development environment.
2.Develop using Salesforce Web and local tools.
3.Test within the development environment.
4.Replicate production changes in the development environment.
5.Deploy what you’ve developed to your production organization. -
Shubham
MemberAugust 17, 2017 at 12:06 pm in reply to: What is the difference Between enterprise WSDL and partner WSDL in Salesforce?Hi Aman
Enterprise WSDL
The enterprise WSDL is optimized for a single Salesforce org. It’s strongly typed, and it reflects your org’s specific configuration, meaning that two enterprise WSDL files generated from two different orgs contain different information.
Partner WSDL
The partner WSDL is optimized for use with many Salesforce orgs. It’s loosely typed, and it doesn’t change based on an org’s specific configuration.
Use Case -
Typically, if you’re writing an integration for a single Salesforce org, use the enterprise WSDL. For several orgs, use the partner WSDL.
-
Shubham
MemberAugust 17, 2017 at 7:45 am in reply to: What is the Order of execution of actions in Salesforce Workflow?Hello Shaharyar
The order in which individual actions and types of actions are executed is not guaranteed. However, field update actions are executed first, followed by other actions.
Let If you create four actions
1 New Task
2 New Email
3 New Field Update
4 New Outbound MessageThen Field Update must execute first.
-
Shubham
MemberAugust 17, 2017 at 7:26 am in reply to: How to create unique contacts in Salesforce depending on the value of number of location field in account object?Hello Shaharyar
Try this,
trigger numberOfLocations on Account (After Update) {
Set<contact> setContact = new Set<contact>();
map<id,decimal> mapAcc=new map<id,decimal>();
List<Contact> listContact = new List<Contact>();
for(Account acc:trigger.new){
mapAcc.put(acc.id,acc.NumberofLocations__c);
}
if(mapAcc.size()>0 && mapAcc!=null){
for(Id accId:mapAcc.keyset()){
for(integer i=0;i<mapAcc.get(accId);i++){
contact newContact=new contact(AccountId=accId,LastName='MyContact');
setContact.add(newContact);
}
}
}
listContact.addAll(setContact);
insert listContact;
System.debug('Contact = ' + listContact);}
-
Shubham
MemberAugust 3, 2017 at 10:47 am in reply to: Can we use two fields in order by clause in Salesforce?Hi shariq
You may use two field in Order By clause
But it sort according to first field
e.g.
Select id ,name from Contact Order By name,Phone
Here it Order according to name
- This reply was modified 7 years, 3 months ago by Shubham.
-
Shubham
MemberAugust 2, 2017 at 1:14 pm in reply to: What is the difference between deactivate a user and freeze a user in Salesforce?Hi Shariq
In some cases, you can’t immediately deactivate an account, such as when a user is selected in a custom hierarchy field. To prevent users from logging in to your organization while you perform the steps to deactivate them, you can freeze user accounts.
Deactivate:
You can’t delete a user, but you can deactivate an account so a user can no longer log in to Salesforce.
-
Hi Shariq
Generally, all Apex code runs in system mode, where the permissions and record sharing of the current user are not taken into account. The system method runAs enables you to write test methods that change the user context to an existing user or a new user so that the user’s record sharing is enforced. The runAs method doesn’t enforce user permissions or field-level permissions, only record sharing.
You can use runAs only in test methods. The original system context is started again after all runAs test methods complete.
The runAs method ignores user license limits. You can create new users with runAs even if your organization has no additional user licenses.
In the following example, a new test user is created, then code is run as that user, with that user's record sharing access:
@isTest
private class TestRunAs {
public static testMethod void testRunAs() {
// Setup test data
// This code runs as the system user
Profile p = [SELECT Id FROM Profile WHERE Name='Standard User'];
User u = new User(Alias = 'standt', Email='[email protected]',
EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US',
LocaleSidKey='en_US', ProfileId = p.Id,
TimeZoneSidKey='America/Los_Angeles', UserName='[email protected]');System.runAs(u) {
// The following code runs as user 'u'
System.debug('Current User: ' + UserInfo.getUserName());
System.debug('Current Profile: ' + UserInfo.getProfileId());
}
} -
Hi Shariq
A wrapper or container class is a class, a data structure, or an abstract data type which contains different objects or collection of objects as its members.
A wrapper class is a custom object defined by programmer wherein he defines the wrapper class properties. Consider a custom object in salesforce, what do you have in it? fields right? different fields of different data types. Similarly wrapper class is a custom class which has different data types or properties as per requirement. We can wrap different objects types or any other types in a wrapper class.In the Visualforce most important use case is to display a table of records with a check box and then process only the records that are selected.
In the example below, we are displaying list of accounts with checkbox. End user can select account and then click on Show Selected accounts button. Then selected account will be displayed in table.
-
Hi Shariq
S-controls provide a flexible, open means of extending the Salesforce user interface, including the ability to create and display your own custom data forms.
It is Available in salesforce Classic.
Organizations that haven’t previously used s-controls can’t create them. Existing s-controls are unaffected, and can still be edited.
An s-control can contain any type of content that you can display or run in a browser, for example, a Java applet, an ActiveX control, an Excel file, or a custom HTML Web form.
-
Shubham
MemberJuly 24, 2017 at 10:18 am in reply to: Difference between Compact Layout and Page Layout ?Hi Saloni -
Page Layout -
1-Control which fields, lists of related records, and custom links users see
2-Customize the order that the fields appear in the page details
3-Determine whether fields are visible, read only, or required
4-Control which standard and custom buttons appear on records and related lists
5-Control which quick actions appear on the pageCompact Layout-
Compact layouts help make your team more productive by presenting them with the key record information so they can easily manage their work. For example, show phone numbers and regions on an account. Or, show stages, amounts, and ownership fields on an opportunity. With compact layouts, you can highlight whatever your users need to see at a glance when they look at a record.
-
Shubham
MemberJuly 21, 2017 at 10:54 am in reply to: how to access the file uploaded to the feed of case?hello Saloni
Use the Following Query
Select id from ContentDocument
It give you id of all file,If u want to access the title of particular file Then Use
Select id,title from ContentDocument where id='Record Id'
-
Shubham
MemberJuly 17, 2017 at 12:22 pm in reply to: What is the Difference between Marketing cloud and pardot?Hi Aman
Marketing Cloud -
Marketing Cloud helps you engage with your customers, or as we call it Business-to-Consumer (B2C), at scale. This means Marketing Cloud can send, push, and analyze a lot of data. Create personalized communications and 1:1 customer journeys to drive engagement throughout the customer lifecycle.
Pardot -
Pardot drives sales through target marketing for businesses who sell to other businesses (B2B). Pardot helps you guide prospects through the whole buying campaign.In B2B We Track sales campaigns, nurture leads, and drive results for sales.
-
Shubham
MemberJuly 17, 2017 at 12:08 pm in reply to: Why future method is void and static in Salesforce?Thanks Aman jain