shariq
IndividualForum Replies Created
-
Hi,
I think there is no standard functionality in salesforce to do it.
Hope this helps.
-
shariq
MemberSeptember 20, 2018 at 6:46 PM in reply to: What is Service Cloud Console in Salesforce and how do I enable it on my Salesforce?Hi,
Adding some points -
Service clouds also has agents that are available in the footer (if licensed) as well as it can be programmed to give messages to these agents such as system being down etc. Another notable feature is that it has keyboard shortcuts so that power users are able to save time switching between tabs and saving information. The most notable feature of SCC is that it is very easy to plug in custom Visualforce pages within the console and the ability to build custom integrations directly into the console making it very extendible. Another cool feature is the ability to have an interaction log which allows you to quickly create tasks whilst you are on the phone with customers.
Hope this helps.
-
shariq
MemberSeptember 20, 2018 at 6:43 PM in reply to: Can anyone please explain me how to hide record id(e.g. LeadId) in email template body?Hi,
Put the above code in section like div and through css hide it.
Hope this helps.
-
shariq
MemberSeptember 20, 2018 at 6:42 PM in reply to: How to query recently viewed records of a particular Salesforce sobject?Hi,
Try this -
SELECT Id,
FROM RecentlyViewed
WHERE Type = ‘sobject__c’
ORDER BY LastViewedDate DESC Limit 50000Hope this helps.
-
shariq
MemberSeptember 20, 2018 at 6:40 PM in reply to: How to query data through Standard API in Salesforce?Hi,
Try this -
API url - https://yourInstance.salesforce.com/services/data/v20.0/query/?q=SELECT+field__c+from+sobject__c
Header - “Authorization: Bearer token”
Hope this helps/
-
shariq
MemberSeptember 20, 2018 at 6:38 PM in reply to: How can I manipulate records with DML in Salesforce?Hi,
Manipulate Records with DML
Use DML to insert, update, and delete records.
Perform DML statements in bulk.
Use upsert to either insert or update a record.
Catch a DML Exception.
Use a Database method to insert new records with the partial success option and process the results.
Know when to use DML statements and when to use Database methods.Hope this helps.
-
shariq
MemberSeptember 20, 2018 at 6:37 PM in reply to: Activity is not creating in salesforce when sending email through Messaging class?Hi,
Just make setSaveAsActivity true for your single email messaging class.
Hope this helps.
-
shariq
MemberSeptember 20, 2018 at 3:14 PM in reply to: What Is Visualforce View State? And What Are Best Practices To Reduce The View State Size?Hi,
Visualforce pages that contain a form component also contain an encrypted, hidden form field that encapsulates the view state of the page. This view state is automatically created, and as its name suggests, it holds the state of the page – state that includes the components, field values and controller state.
Best Practices to reduce the view state size:
Minimize number of form on a page. Use apex:actionRegion instead of using 2 or more forms.
Refine your SOQL to only retrieve the data needed by the page.
All public and private data members present in Standard, Custom and Controller extensions are saved.
Mark any Apex variables that are not necessary to the view state as Transient. (The transient variables are not passed to view state and therefore not stored in View State)
Create wizards with as few pages as possible
Use outputLink components instead of commandLink or commandButton components where possible as they don’t need to be nested in a form.Thanks
-
shariq
MemberSeptember 20, 2018 at 3:14 PM in reply to: How To Display Error Message On Visualforce Page?Hi,
In the Visualforce page add the tag:
<apex:pageMessages />
In the controller class add the error message where required
if ( requiredFieldName == null){
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Please enter a value in the Required Field'));
}
Thanks
-
shariq
MemberSeptember 20, 2018 at 3:14 PM in reply to: Will Visual Force Still Supports The Merge Fields Usage Like S-control?Hi,
Just like S-Controls, Visualforce Pages support embedded merge fields, like the {!$User.FirstName} used in the example.
Thanks
-
shariq
MemberSeptember 20, 2018 at 3:13 PM in reply to: How To Create Many To Many Relationships Between Object?Hi,
Creating Many to Many relationship in salesforce is little tricky. You cannot create this type of relationship directly. Follow below steps to create this type of relationship.
Create both objects which should be interlinked.
Create one custom object (also called as junction object), which should have auto number as unique identification and create two master relationships for both objects, no need create tab for this object.
Now on both objects, add this field as related list.Thanks
-
shariq
MemberSeptember 20, 2018 at 3:12 PM in reply to: What Are Global Variables Explain With Examples?Hi,
Global variables are the variables used to reference the general information about the current user or your organization on a page.
Example:
Global variables must be referenced using Visualforce expression syntax to be evaluated, for example, {!$User.Name}.
List of available global variables are as below:
1. $Action
2. $Api
3. $Component
4. $ComponentLabel
5. $CurrentPage
6. $Label
7. $Label.Site
8. $ObjectType
9. $Organization
10. $Page
11. $Profile
12. $Resource
13. $SControl
14. $Setup
15. $Site
16. $User
17. $UserRole
18. $System.OriginDateTime
19. $ User.UITheme and $User.UIThemeDisplayedThanks
-
shariq
MemberSeptember 20, 2018 at 3:12 PM in reply to: How To Restrict Any Trigger To Fire Only Once?Hi,
Triggers can fire twice, once before workflows and once after workflows.
“The before and after triggers fire one more time only if something needs to be updated, If the fields have already been set to a value, the triggers are not fired again.”
Workaround:
public class HelperClass {
public static boolean firstRun = true;
}
trigger affectedTrigger on Account (before delete, after delete, after undelete) {
if(Trigger.isBefore){
if(Trigger.isDelete){
if(HelperClass.firstRun){
Trigger.old[0].addError('Before Account Delete Error');
HelperClass.firstRun=false;
}
}
}
}Thanks
-
shariq
MemberSeptember 20, 2018 at 3:11 PM in reply to: Is There Any Way To Control The Sequence Of Execution Of These Triggers?Hi,
Salesforce.com has documented that trigger sequence cannot be predefined. As a best practice create one trigger per object and use comment blocks to separate different logic blocks. By having all logic in one trigger you may also be able to optimize on your SOQL queries.
Thanks
-
shariq
MemberSeptember 20, 2018 at 3:11 PM in reply to: How To Read The Parameter Value From The Url In Apex?Hi,
Consider that the parameter name is “RecordType”.
String recordType = Apexpages.currentPage().getParameters().get('RecordType');
Thanks
-
shariq
MemberSeptember 20, 2018 at 3:11 PM in reply to: Explain The Need Or Importance Of The Controller Extension in Salesforce?Hi,
Controller Extension is very useful and important concept introduced by the salesforce recently. It gives the power to the programmer to extend the functionality of existing custom controller or standard controller.
A Visualforce can have a single Custom controller or standard controller but many controller extensions.
We can say that the custom extension is the supporter of custom or standard controller.
Consider one example: If there is one controller written and used by the multiple Visualforce pages and one of them needs some extra logic. Then instead of writing that logic to controller class (Which is used by many Visualforce pages) we can create a controller extension and apply to that page only.
Thanks
-
Hi,
Any apex class having a public constructor with Custom Controller or Standard Controller object as a single argument is known as controller extension.
Thanks
-
shariq
MemberSeptember 20, 2018 at 3:10 PM in reply to: How To Get All The Required Fields Of Sobject Dynamically?Hi,
There is no direct property available in Apex dynamic API to represent the required field. However there is another way to know about it.
If any fields have below three properties then it is mandatory field.
If it is Creatable
If it is not nillable and
If it does not have any default value
Map<String, Schema.SObjectType> m = Schema.getGlobalDescribe() ;Schema.SObjectType s = m.get(so.apiName) ;
Schema.DescribeSObjectResult r = s.getDescribe() ;
Map<String,Schema.SObjectField> fields = r.fields.getMap() ;
for(String f : fields.keyset())
{
Schema.DescribeFieldResult desribeResult = fields.get(f).getDescribe();
if( desribeResult.isCreateable() && !desribeResult.isNillable() && !desribeResult.isDefaultedOnCreate() )
{
//This is mandatory / required field
}
}
Thanks
-
shariq
MemberSeptember 20, 2018 at 3:09 PM in reply to: What Is Property In Salesforce Apex? Explain With Advantages?Hi,
Apex mainly consists of the syntax from the well known programming language Java. As a practice of encapsulation in java we declare any variable as private and then create the setters and getters for that variable.
private String name;
public void setName(String n)
{
name = n;
}
public String getName()
{
return name;
}
However, the Apex introduced the new concept of property from language C# as shown below:
public String name {get; set;}
As we can see how simple the code is and instead of using nearly 8 to 11 lines all done in 1 line only. It will be very useful when lots of member is declared in Apex class. It has another advantage in “number of lines of code” limit by salesforce which will drastically reduced.
Thanks
-
shariq
MemberSeptember 20, 2018 at 3:08 PM in reply to: If You Are In Situation That You Don’t Know Which Sobject Is Going To Be Instantiated?Hi,
public SObject getNewSobject(String t){
// Call global describe to get the map of string to token.
Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();
// Get the token for the sobject based on the type.
Schema.SObjectType st = gd.get(t);
// Instantiate the sobject from the token.
Sobject s = st.newSobject();
return s;
}
Thanks
-
shariq
MemberSeptember 20, 2018 at 3:07 PM in reply to: How To Get The List Of All Available Sobject In Salesforce Database Using Apex (dynamic Apex)?Hi,
Map<String, Schema.SObjectType> m = Schema.getGlobalDescribe();
Thanks
-
shariq
MemberSeptember 20, 2018 at 3:07 PM in reply to: What Is Difference In Render, Rerender And Renderas Attributes Of Visualforce?Hi,
render – It works like “display” property of CSS. Used to show or hide element.
rerender – After Ajax which component should be refreshed – available on commandlink, commandbutton, actionsupport etc.
renderas – render page as pdf, doc and excel.
Thanks
-
shariq
MemberSeptember 20, 2018 at 3:06 PM in reply to: What Happens If Child Have Two Master Records And One Is Deleted?Hi,
Child record will be deleted.
Thanks
-
shariq
MemberSeptember 20, 2018 at 3:04 PM in reply to: How Validation Rules Executed? Is It Page Layout / Visualforce Dependent?Hi,
The validation rules run at the data model level, so they are not affected by the UI. Any record that is saved in Salesforce will run through the validation rules.
Thanks
-
shariq
MemberSeptember 20, 2018 at 3:03 PM in reply to: How Many Controllers Can Be Used On Single Vf Page?Hi,
Only one controller can be used salesforce. Other than them, Controller extension can be used.
There may be more than one Controller extension.
Example:
<apex:page standardController="Account"
extensions="ExtOne,ExtTwo" showHeader="false">
<apex:outputText value="{!foo}" />
</apex:page>
if ExtOne and ExtTwo, both have the method getFoo() then the method of ExtOne will be executed.
A controller extension is any Apex class that contains a constructor that takes a single argument of typeApexPages.StandardController or CustomControllerName, where CustomControllerName is the name of a custom controller that you want to extend.
Thanks
-
This reply was modified 7 years, 6 months ago by
shariq.
-
This reply was modified 7 years, 6 months ago by