Parul
IndividualForum Replies Created
-
Parul
MemberSeptember 21, 2018 at 4:07 am in reply to: How to add Javascript Remoting to a Visualforce Page in Salesforce?Notice the following about this markup:
The JavaScript uses the explicit invokeAction remoting call, and takes advantage of the $RemoteAction global to resolve the correct namespace for the remote action method.
The event.status variable is true only if the call was successful. The error handling illustrated by the example is deliberately simple and prints the error message and stack trace from the event.message and event.where values, respectively. You’re encouraged to implement more robust alternative logic for requests where your method call doesn’t succeed.
The result variable represents the object returned from the Apex getAccount method.
Accessing the DOM ID of a plain HTML element is simple, just use the ID of the item.
DOM IDs of Visualforce components are dynamically generated in order to ensure IDs are unique. The code above uses the technique illustrated in Using $Component to Reference Components from JavaScript to retrieve the component’s ID by accessing it via the $Component global variable.Thanks
-
Parul
MemberSeptember 21, 2018 at 4:02 am in reply to: How to create many to many relationships between two Salesforce Objects?Salesforce supports 2 kinds of relationships like Master Detail and Lookup. They are both one-to-many relationship, and they are both defined from the many-to-one side, that is from a child to a parent. They can be made one-to-one relationship by adding validation rules, or maybe triggers to enforce the one-to-one nature, i.e. only one child is allowed.
Junction objects are used to create many to many relationships between objects. If you take the Recruiting application example, you can see that a Position can be linked to many Candidates, and a Candidate can apply for different Positions. To create this data model you need a third object "Job Application" that links the 2.
So you'd create a lookup field for both Position and Candidate object on the "Job Application" object. This will establish many to many relationship between Position and Candidate via the "Job Application" object known as the junction object.
Fore more information, read some article
-
Parul
MemberSeptember 21, 2018 at 4:00 am in reply to: How many custom tabs can be created in a salesforce dev org?But I think delete the previous custom tabs which are not in use and then use according to that because the tabs not more than 100 provides.
-
Parul
MemberSeptember 21, 2018 at 3:57 am in reply to: How to get all the field names of an object using SOQL?Adding more point:
You not only get the sobject name, fields but also its properties. You can use properties in your logic.
-
Parul
MemberSeptember 21, 2018 at 3:56 am in reply to: How to execute Apex from Custom button or Javascript?Hi,
Refer the above example to execute Apex using Javascript and custom button. It provide you solution
Thanks
-
Parul
MemberSeptember 21, 2018 at 3:52 am in reply to: What reduce(function) will do in component.find() in Salesforce Lightning?How to use in Lightnign coe snippet:
// If there are more than 1 fields
if(contactFields.length!=undefined) {
// Iterating all the fields
var allValid = contactFields.reduce(function (validSoFar, inputCmp) {
// Show help message if single field is invalid
inputCmp.showHelpMessageIfInvalid();
// return whether all fields are valid or not
return validSoFar && inputCmp.get('v.validity').valid;
}, true);Thanks
-
Parul
MemberSeptember 21, 2018 at 3:48 am in reply to: How To Get All The Required Fields Of Sobject Dynamically?Correct use can use metadat Api
Here is the ex:
public static Map<String, Schema.DescribeFieldResult> getFieldMetaData( Schema.DescribeSObjectResult dsor, Set<String> fields) { // the map to be returned with the final data Map<String,Schema.DescribeFieldResult> finalMap = new Map<String, Schema.DescribeFieldResult>(); // map of all fields in the object Map<String, Schema.SObjectField> objectFields = dsor.fields.getMap(); // iterate over the requested fields and get the describe info for each one. // add it to a map with field name as key for(String field : fields){ // skip fields that are not part of the object if (objectFields.containsKey(field)) { Schema.DescribeFieldResult dr = objectFields.get(field).getDescribe(); // add the results to the map to be returned finalMap.put(field, dr); } } return finalMap; }
Thanks
-
Parul
MemberSeptember 21, 2018 at 3:45 am in reply to: What Is Property In Salesforce Apex? Explain With Advantages?Hi,
Apex introduced the new concept of property from language shown below:
publicString name {get; set;}A setter method that assigns the value of this attribute to a class variable in the associated custom component controller. If this attribute is used, getter and setter methods, or a property with get and set values, must be defined.
-
There is some cases more:
If you'd like to remove a value from one of your record's fields so it will appear as blank or NULL using the Data Loader, update your Data Loader settings using the steps below:
Resolution
Include NULL values in an update
1. Open Data Loader.
2. Click Settings.
3. Select Insert Null Values.Example
1. Run Export Data. Make sure to include IDs and Column Fields that should be changed to NULL.
2. Delete data contained in the columns that should be returned as NULL (no values).
3. Save the file as a new .CSV with new name (don't overwrite the Data Export from step 1).
4. Run Data Loader Update using new file with Blank values.Potential Issues
If the field being updated to NULL is referenced by a workflow or trigger, the update might not be successful. (One workaround you can try is to lower the batch size to 1, then proceed with the update or insert again).
If the field is Required in your organization, you will not be able to use this method to insert a NULL value.Thanks
-
Hi Shariq, Here is the example of Controller Extension:
<apex:page standardController=”Account” extensions=”myControllerExtension”>
{!greeting} <p/>
<apex:form>
<apex:inputField value=”{!account.name}”/> <p/>
<apex:commandButton value=”Save” action=”{!save}”/>
</apex:form>
</apex:page>public class myControllerExtension {
private final Account acct;
// The extension constructor initializes the private member
// variable acct by using the getRecord method from the standard
// controller.
public myControllerExtension(ApexPages.StandardController stdController) {
this.acct = (Account)stdController.getRecord();
}public String getGreeting() {
return ‘Hello ‘ + acct.name + ‘ (‘ + acct.id + ‘)’;
}
}Thanks
-
Parul
MemberSeptember 21, 2018 at 3:30 am in reply to: Explain The Need Or Importance Of The Controller Extension in Salesforce?Hi Shariq, Here is the example of Controller Extension:
<apex:page standardController="Account" extensions="myControllerExtension">
{!greeting} <p/>
<apex:form>
<apex:inputField value="{!account.name}"/> <p/>
<apex:commandButton value="Save" action="{!save}"/>
</apex:form>
</apex:page>public class myControllerExtension {
private final Account acct;
// The extension constructor initializes the private member
// variable acct by using the getRecord method from the standard
// controller.
public myControllerExtension(ApexPages.StandardController stdController) {
this.acct = (Account)stdController.getRecord();
}public String getGreeting() {
return 'Hello ' + acct.name + ' (' + acct.id + ')';
}
}Thanks
-
Parul
MemberSeptember 21, 2018 at 3:28 am in reply to: How To Read The Parameter Value From The Url In Apex?Code snippet
public PageReference openSheet(){
if (!strday.isNumeric()){
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'Pleaseenter a correct day value.'));
return null;
}
if (!strmonth.isNumeric()){
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'Please enter a correct month value.'));
return null;
}
if (!stryear.isNumeric()){
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'Please enter a correct year value.'));
return null;
}PageReference newPage = page.crew_sheet;
strday.leftPad(2,'0');
strmonth.leftPad(2,'0');
newPage.getParameters().put('day', strday);
newPage.getParameters().put('month', strmonth);
newPage.getParameters().put('year', stryear);
newPage.setRedirect(true);
return newPage;}
The Visualforce page that opens also has a custom controller and it uses the following code (snippet):Page 2 Controller
public with sharing class CrewSheet {
Public String day;
Public String month;
Public String year;
Public Datetime specificDate;functionalY fy = new functionalYUtilities ();
Public List<Object__c> listAlpha1{get;set;}
Set<String> gwRounds = new Set<String>();
Public List<WorkOrder> listAlpha1Results{get;set;}Public List<Object__c> listAlpha2{get;set;}
Set<String> pcRounds = new Set<String>();
Public List<WorkOrder> listAlpha2Results{get;set;}Public List<Object__c> listAlpha3{get;set;}
Set<String> gbRounds = new Set<String>();
Public List<WorkOrder> listAlpha3Results{get;set;}Public List<Object__c> listAlpha4{get;set;}
Set<String> rRounds = new Set<String>();
Public List<WorkOrder> listAlpha4Results{get;set;}Public CrewSheet(){
//get the parameters from the page
day = apexpages.currentPage().getParameters().get('day');
month = apexpages.currentPage().getParameters().get('month');
year = apexpages.currentPage().getParameters().get('year');
//the following if statements were added in as the test class isn't passing the parameters
Datetime missingdate = system.now();
if(day == ''){
day = string.valueof(missingdate.day());
}
if(month == ''){
month = string.valueof(missingdate.month());
}
if(year == ''){
year = string.valueof(missingdate.year());
}
String specificDate = day + '/' + month + '/' + year + ' 09:00';
Datetime specificDateformatted = datetime.parse(specificDate);
String nextDayText = specificDateformatted.format('EEEE');// At this point we use the dates/strings in queries ultimately displayed on the vf page...i've cut them out for make it easier to read.
}Thanks
-
Parul
MemberSeptember 21, 2018 at 3:25 am in reply to: Is There Any Way To Control The Sequence Of Execution Of These Triggers?Note:
The order of execution isn’t guaranteed when having multiple triggers for the same object due to the same event. For example, if you have two before insert triggers for Case, and a new Case record is inserted that fires the two triggers, the order in which these triggers fire isn’t guaranteed.
Thnks
-
Parul
MemberSeptember 21, 2018 at 3:23 am in reply to: What Are Global Variables Explain With Examples?Refer this ex:
<apex:page controller="RecentlyViewedController">
<apex:pageBlock><apex:pageBlockTable data="{!RecentlyViewed}" var="rv">
<apex:column headerValue="{!$ObjectType.RecentlyViewed.fields.Name.Label}">
<apex:outputLink value="{!URLFOR($Action[rv.Type].View,rv.Id)}">
<apex:outputText value="{!rv.Name}" />
</apex:outputLink>
</apex:column>
</apex:pageBlockTable></apex:pageBlock>
</apex:page> -
Parul
MemberSeptember 20, 2018 at 7:41 pm in reply to: How to check more the 2048 records in Salesforce Reports?I think it's not possible because it exceeds the governor limit. You can contact to salesforce support.
Thanks
-
Parul
MemberSeptember 20, 2018 at 7:22 pm in reply to: What are wrapper class? How to use when working with different objects on Visualforce page?Hi,
A wrapper or container class is a class 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.
-
Hi
Service Cloud allows users to automate service processes, streamline workflows and find key articles, topics and experts to support the agent. The purpose is to foster one-to-one marketing relationships with every customer, across multiple channels and on any device.
Service cloud can "listen" and respond to customers across a variety of social platforms and automatically route cases to the appropriate agent. Social customer service is integrated with the Salesforce Customer Success Platform, which allows the social team to gather a comprehensive picture of the customer to inform responses.
-
Parul
MemberSeptember 20, 2018 at 7:18 pm in reply to: How to enable Orders object in SDFC? Can we add custom fields in Orders object?Hi,
follow the steps
Go to setup---->Order Settings” ------>check the Enable Orders.
-
Parul
MemberSeptember 20, 2018 at 7:17 pm in reply to: How to add Quote function to a Salesforce Opportunity object?Hi
Please follow the steps
]Go to Setup--->Write “Quote Setting” in quick find box--->click on “Quote Settings”---->Check “Enable Quotes”--->Click Save
-
Parul
MemberSeptember 20, 2018 at 7:12 pm in reply to: How to enable Quote object and sync with Pricebook object to create a Quotation?Hi,
Please follow the steps
Please follow below steps to do so.
Go to Setup -----> Write “Quote Setting” in quick find box------->click on “Quote Settings”----->Check “Enable Quotes”---->Click Save
-
Parul
MemberSeptember 20, 2018 at 7:11 pm in reply to: How to add error message in a Salesforce Apex Trigger?Adding some points:
If you want to print error message on particular field . you can use the following syntax
FieldName.addError('Write error message');
Display error message on visual force page include <apex:pageMessages /> tag in vf pageThanks
-
Parul
MemberSeptember 20, 2018 at 7:10 pm in reply to: Is there a limit for data.com records? How much can I use for free? -
Parul
MemberSeptember 20, 2018 at 7:08 pm in reply to: How to display names of Contact & Opportunity related to an Account in a Visualforce Page?Adding some points:
<apex:page standardController="Account">
Name : <apex:outputField value="{!Account.Name}"/> <br/>
Phone : <apex:OutputField value="{!Account.Phone}" /><br/>
<br/>
<b>Contact List</b><br/>
<apex:dataTable value="{!Account.Contacts}" var="con">
<apex:column value="{!con.Name}"/>
</apex:dataTable><br/><br/>
<b>Opportunity List</b><br/>
<apex:dataTable value="{!Account.Opportunities}" var="opty">
<apex:column value="{!opty.Name}"/>
</apex:dataTable>
</apex:page>Thanks
-
Parul
MemberSeptember 20, 2018 at 7:05 pm in reply to: How can i add the ability to upload image using richtext in inputTextArea?Adding some points:
WARNING If you add a custom rich text area field in Salesforce Classic and edit it in Lightning Experience, you can also expect the formatting differences. Saving your changes in Lightning Experience overwrites the original formatting you had in Salesforce Classic and conversely. Alternatively, you can fix some of the formatting using the toolbar or switch to Salesforce Classic to perform your edits.
Thanks
-
Parul
MemberSeptember 20, 2018 at 7:02 pm in reply to: How to prevent a user from creating a new account in Salesforce?Adding some steps:
use this steps may be help you:
Step 1:- Remove the Create permission on the Lead object
Step 2:- Create the Checkbox field on the Lead object (Default=Checked) & Create the checkbox field on the Account object (Default=Unchecked)
Step 3:- Set up the Field mapping between Lead & Account field
Step 4:- Make the Field read only or hide it from the pagelayout
Step 5:- Create the validation rule on Account to block the User to create the Account from scratch or any other source, only exception is for Accounts that getting created from Lead conversion something like this:-
AND(
$Profile.name<>"System Administrator",
Checkbox=False,
ISNEW())Let me know if you need any help.
Thanks