Forum Replies Created

Page 42 of 57
  • Hi,

    You should be using this: {!Account.Name} to get the respective Name value

    Hope this helps.

  • shariq

    Member
    September 16, 2018 at 1:11 PM in reply to: Lead Conversion

    Hi,

    Solution – 

    You could probably add a checkbox field to the Lead page layout and have the user check the checkbox if they get the error.

    Be sure to add that to your process as part of the criteria: ISBLANK(Checkbox_Field__c) that way, anything with a “check” is excluded.

    Hope this helps.

  • shariq

    Member
    September 16, 2018 at 1:11 PM in reply to: Unable to convert Lead that is in use by workflow

    Hi,

    Solution - 

    You could probably add a checkbox field to the Lead page layout and have the user check the checkbox if they get the error.

    Be sure to add that to your process as part of the criteria: ISBLANK(Checkbox_Field__c) that way, anything with a "check" is excluded.

    Hope this helps.

  • shariq

    Member
    September 16, 2018 at 1:08 PM in reply to: What tool can I use to extract Field Level Security information

    Hi,

    FORCE CLI with Sublime Text 3 Method:
    Fetch the profile you would like to edit by doing Right Click > Lightning > Fetch > Metadata then select Profiles, next select the profile you wish to Fetch. Afterwords edit the profiles/Admin.profile file (or whichever one you fetched), and add the field permissions you need.

    <fieldPermissions>
    <field>Custom_Object__c.Custom_Field__c</field>
    <editable>true</editable>
    <readable>true</readable>
    <hidden>false</hidden>
    </fieldPermissions>

    Hope this helps.

  • shariq

    Member
    September 16, 2018 at 1:07 PM in reply to: Transient Keyword in #Salesforce

    Hi,

    Declaring variables as transient reduces view state size. A common use case for the transient keyword is a field on a Visualforce page that is needed only for the duration of a page request, but should not be part of the page's view state and would use too many system resources to be recomputed many times during a request.

    Some Apex objects are automatically considered transient, that is, their value does not get saved as part of the page's view state. These objects include the following:

    • PageReferences
    • XmlStream classes
    • Collections automatically marked as transient only if the type of object that they hold is automatically marked as transient, such as a collection of Savepoints
    • Most of the objects generated by system methods, such as Schema.getGlobalDescribe.
    • JSONParser class instances.

    Hope this helps.

  • Hi,

    I found this online -

    apex:page standardController="Account" recordSetVar="records" id="thePage">
    <apex:form id="theForm">
    <apex:pageBlock id="thePageBlock">
    <apex:pageBlockTable value="{!records}" var="record" id="thePageBlockTable">
    <apex:column >
    <apex:outputField value="{!record.Name}" id="AccountNameDOM" />
    <apex:facet name="header">Name</apex:facet>
    </apex:column>
    <apex:column >
    <apex:outputField value="{!record.Type}" id="AccountTypeDOM" />
    <apex:facet name="header">Type</apex:facet>
    </apex:column>
    <apex:column >
    <apex:outputField value="{!record.Industry}"
    id="AccountIndustryDOM" />
    <apex:facet name="header">Industry</apex:facet>
    </apex:column>
    <apex:inlineEditSupport event="ondblClick"
    showOnEdit="saveButton,cancelButton" hideOnEdit="editButton" />
    </apex:pageBlockTable>
    <apex:pageBlockButtons >
    <apex:commandButton value="Edit" action="{!save}" id="editButton" />
    <apex:commandButton value="Save" action="{!save}" id="saveButton" />
    <apex:commandButton value="Cancel" action="{!cancel}" id="cancelButton" />
    </apex:pageBlockButtons>
    </apex:pageBlock>
    </apex:form>

    Hope this helps.

  • Hi,

    Try this -

    <apex:page id=”pageId”>

    <script src=”/soap/ajax/20.0/connection.js” type=”text/javascript”></script>

    <script>

    function insertAccount(){

    //Getting Session ID.

    sforce.connection.sessionId= “{!$Api.Session_ID}”;

    //Creating New Account Record.

    var account = new sforce.SObject(“Account”);

    //Getting Account Name from inputText.

    account.Name = document.getElementById(“pageId:frm:pb:pbs:pbsi:txtName”).value;

    //Create method

    var result = sforce.connection.create([account]);

    //Getting result

    if(result[0].getBoolean(“success”)) {

    alert(“New Account is created with id ” + result[0].id);

    }

    else{

    alert(“failed to create new Account ” + result[0]);

    }

    }

    </script>

    <apex:form id=”frm”>

    <apex:pageBlock title=”Insert Account” tabStyle=”Account” id=”pb”>

    <apex:pageBlockSection title=”Account Name” columns=”1″ id=”pbs”>

    <apex:pageBlockSectionItem id=”pbsi”>

    <apex:outputLabel value=”Name” />

    <apex:inputText title=”Name” id=”txtName” />

    </apex:pageBlockSectionItem>

    </apex:pageBlockSection>

    <apex:pageBlockButtons>

    <apex:commandButton onclick=”return insertAccount();” value=”Save”/>

    </apex:pageBlockButtons>

    </apex:pageBlock>

    </apex:form>

    </apex:page>

    Hope his helps.

  • Hi,

    To Make it more simple to understand-

    If Opt Out Policy is set in single email then no matter what your recipients will always receive the mail.

    Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
    message.toAddresses = new String[] { 'abc2@gmail.com', 'abc2@gmail.com' };
    message.optOutPolicy = 'FILTER';
    message.subject = 'Subject Test Message';
    message.plainTextBody = 'This is the message body.';
    Messaging.SingleEmailMessage[] messages = new List<Messaging.SingleEmailMessage> {message};
    Messaging.SendEmailResult[] results = Messaging.sendEmail(messages);

    if (results[0].success) {
    System.debug('The email was sent successfully.');
    } else {
    System.debug('The email failed to send: ' + results[0].errors[0].message);
    }

    Hope this helps.

  • Hi,

    Visualforce Immediate Attribute on CommandLinks and CommandButtons Technical Explanation :-

    • When we don’t want the validation rule to be fire during server request we set this attribute Immediate=”true”.
    • Default value of this immediate attribute is false.
    • When we are having functionality of Back to previous page or cancel button, where we don’t our validation rules to be fired. In this case if we didn’t set Immediate=”true” where validation rule will get fired and we end up in a state of unable to return to previous page.To avoid this case we need to set Immediate=”true” like below Visualforce Immediate Attribute on CommandLinks and CommandButtons example.

    <apex:CommandLink action="{!cancelMethod}" value="Cancel Link" styleClass="btn" id="btnCancel" immediate="true">

    <apex:commandButton value="Cancel" immediate="true" action="{!cancelbutton}"/>

    • We usually wire this attribute in cancel button to skip validation rules.

    Hope this helps.

  • shariq

    Member
    September 16, 2018 at 12:51 PM in reply to: How to protect contact information from being seen by the marketing team?

    Hi,

    To get it more simple -

    Salesforce provides a flexible, layered data sharing design that allows you to expose different data sets to different sets of users, so users can do their job without seeing data they don't need to see. Use permission sets and profiles to specify the objects and fields users can access. Use organization-wide sharing settings, user roles, sharing rules to specify the individual records that users can view and edit.

    Object-Level Security (Permission Sets and Profiles)

    Object-level security—or object permissions—provide the bluntest way to control data. Using object permissions you can prevent a user from seeing, creating, editing, or deleting any instance of a particular type of object, such as a lead or opportunity. Object permissions let you hide whole tabs and objects from particular users, so that they don’t even know that type of data exists.You specify object permissions in permission sets and profiles. Permission sets and profiles are collections of settings and permissions that determine what a user can do in the application, similar to a group in a Windows network, where all of the members of the group have the same folder permissions and access to the same software.Profiles are typically defined by a user’s job function (for example, system administrator or sales representative). A profile can be assigned to many users, but a user can be assigned to only one profile. You can use permission sets to grant additional permissions and access settings to users. It’s easy to manage users’ permissions and access with permission sets, because you can assign multiple permission sets to a single user.

    Field-Level Security (Permission Sets and Profiles)

    In some cases, you may want users to have access to an object, but limit their access to individual fields in that object. Field-level security—or field permissions—control whether a user can see, edit, and delete the value for a particular field on an object. They let you protect sensitive fields without having to hide the whole object from users. Field permissions are also controlled in permission sets and profiles.Unlike page layouts, which only control the visibility of fields on detail and edit pages, field permissions control the visibility of fields in any part of the app, including related lists, list views, reports, and search results. To ensure that a user can’t access a particular field, use field permissions. No other settings provide the same level of protection for a field.

    Record-Level Security (Sharing)

    After setting object- and field-level access permissions, you may want to configure access settings for the actual records themselves. Record-level security lets you give users access to some object records, but not others. Every record is owned by a user or a queue. The owner has full access to the record. In a hierarchy, users higher in the hierarchy always have the same access to users below them in the hierarchy. This access applies to records owned by users, as well as records shared with them.To specify record-level security, set your organization-wide sharing settings, define a hierarchy, and create sharing rules.

    • Organization-wide sharing settings—The first step in record-level security is to determine the organization-wide sharing settings for each object. Organization-wide sharing settings specify the default level of access users have to each others’ records.You use organization-wide sharing settings to lock down your data to the most restrictive level, and then use the other record-level security and sharing tools to selectively give access to other users. For example, let’s say users have object-level permissions to read and edit opportunities, and the organization-wide sharing setting is Read-Only. By default, those users can read all opportunity records, but can’t edit any unless they own the record or are granted additional permissions.

     

    • Role hierarchy—Once you’ve specified organization-wide sharing settings, the first way you can give wider access to records is with a role hierarchy. Similar to an organization chart, a role hierarchy represents a level of data access that a user or group of users needs. The role hierarchy ensures that users higher in the hierarchy always have access to the same data as people lower in their hierarchy, regardless of the organization-wide default settings. Role hierarchies don’t have to match your organization chart exactly. Instead, each role in the hierarchy should represent a level of data access that a user or group of users needs.You can also use a territory hierarchy to share access to records. A territory hierarchy grants users access to records based on criteria such as zip code, industry, revenue, or a custom field that is relevant to your business. For example, you could create a territory hierarchy in which a user with the “North America” role has access to different data than users with the “Canada” and “United States” roles.
    • Sharing rules—Sharing rules let you make automatic exceptions to organization-wide sharing settings for particular sets of users, to give them access to records they don’t own or can’t normally see. Sharing rules, like role hierarchies, are only used to give additional users access to records—they can’t be stricter than your organization-wide default settings.
    • Manual sharing—Sometimes it’s impossible to define a consistent group of users who need access to a particular set of records. In those situations, record owners can use manual sharing to give read and edit permissions to users who would not have access to the record any other way. Although manual sharing isn’t automated like organization-wide sharing settings, role hierarchies, or sharing rules, it gives record owners the flexibility to share particular records with users that need to see them.
    • Apex managed sharing—If sharing rules and manual sharing don’t give you the control you need, you can use Apex managed sharing. Apex managed sharing allows developers to programmatically share custom objects. When you use Apex managed sharing to share a custom object, only users with the “Modify All Data” permission can add or change the sharing on the custom object's record, and the sharing access is maintained across record owner changes.

    Hope this helps.

  • shariq

    Member
    September 16, 2018 at 11:05 AM in reply to: How to insert a record in Salesforce using Javascript?

    Hi,

    Try this -

    <apex:page id=”pageId”>

    <script src=”/soap/ajax/20.0/connection.js” type=”text/javascript”></script>

    <script>

    function insertAccount(){

    //Getting Session ID.

    sforce.connection.sessionId= “{!$Api.Session_ID}”;

    //Creating New Account Record.

    var account = new sforce.SObject(“Account”);

    //Getting Account Name from inputText.

    account.Name = document.getElementById(“pageId:frm:pb:pbs:pbsi:txtName”).value;

    //Create method

    var result = sforce.connection.create([account]);

    //Getting result

    if(result[0].getBoolean(“success”)) {

    alert(“New Account is created with id ” + result[0].id);

    }

    else{

    alert(“failed to create new Account ” + result[0]);

    }

    }

    </script>

    <apex:form id=”frm”>

    <apex:pageBlock title=”Insert Account” tabStyle=”Account” id=”pb”>

    <apex:pageBlockSection title=”Account Name” columns=”1″ id=”pbs”>

    <apex:pageBlockSectionItem id=”pbsi”>

    <apex:outputLabel value=”Name” />

    <apex:inputText title=”Name” id=”txtName” />

    </apex:pageBlockSectionItem>

    </apex:pageBlockSection>

    <apex:pageBlockButtons>

    <apex:commandButton onclick=”return insertAccount();” value=”Save”/>

    </apex:pageBlockButtons>

    </apex:pageBlock>

    </apex:form>

    </apex:page>

    Hope this helps.

  • shariq

    Member
    September 16, 2018 at 11:00 AM in reply to: What is Remote Action in Salesforce/What is the use of this action?

    Hi,

    Remote action function in salesforce allows user to access any method from any class through javasrcipt methods, and get the result as a javascript object for further manipulation.The RemoteAction annotation provides support for Apex methods used in Visualforce to be called via JavaScript. This process is often referred to as JavaScript remoting.

    Hope this helps.

  • shariq

    Member
    September 16, 2018 at 10:59 AM in reply to: Why we use remoteaction function in Salesforce?

    Hi,

    JavaScript remoting in Visualforce provides support for some methods in Apex controllers to be called via JavaScript.

    JavaScript remoting has three parts:
    1. The remote method invocation you add to the Visualforce page, written in JavaScript.
    2. The remote method definition in your Apex controller class. This method definition is written in Apex, but there are   few differences from normal action methods.
    3.The response handler callback function you add to or include in your Visualforce page, written in JavaScript.

    Hope this helps.

  • shariq

    Member
    September 16, 2018 at 10:57 AM in reply to: What is the text email template drawback in Salesforce?

    Hi,

    Disadvantages - 

    • You can't count the number that is how many time it opened.
    • You can't use colors to give a visual impact.
    • Scanning is harder in this template

    To add more -

    If you run into formatting issues with HTML Email Templates, you may want to use text emails. You can still use HTML Solutions with this and the email will look the same across all email services.  Frequently HTML emails are interpreted differently by different email services, thus resulting in ugly formatting.  When using Salesforce.com Letterhead email templates, you do not have the ability to use HTML code in the text body, thus resulting in awkward formatting in some email services.  You can fix this problem by either using custom email templates which allow HTML coding throughout the email, but do not allow for on the fly changes when users access the template, or you can use text emails.  Text emails still work with HTML templates when being sent from a Case as long as you use this merge field for the solution description: {!Case.Solution_Description}.

    Text version of Templates are used for Email clients that only accept text emails.

    Hope this helps.

  • shariq

    Member
    September 16, 2018 at 10:49 AM in reply to: What is the governor limit of sendEmail() to sent bulk email?

    Hi,

    Salesforce has different limits depending on how the emails are sent.
    A) If emails are sent via APEX you can only send 10 sendEmail methods in one transaction. These APEX emails are usually sent from behind a Visualforce page or from a trigger. APEX Governor Limits
    B) Of these emails sent via APEX there is a limit of 1000 single emails and 1000 mass emails per day to external addresses. APEX Governor Limits
    C) If emails are sent via Workflow rules, then there is a limit of 1000 emails per day per Standard Salesforce license. So if you have 10 Salesforce licenses you can send out 10,000 emails in one day. Workflow Email Limits
    D) You can send an unlimited number of emails to your internal users. APEX Governor Limits. This is very important to note.

    Hope this helps.

  • Hi,

    It is not possible,checked the Ideas on salesforce and it is not delivered.

    Hope this helps.

  • Hi,

    Main reason what I found is  -

    Master Detail is required field, that's why on existing record it will be empty which is not allowed by salesforce so either delete those or create lookup and change it into master detail after filling the fields in existing records.

    Thanks.

  • shariq

    Member
    September 16, 2018 at 10:32 AM in reply to: Are Salesforce lightning components intended for mobile apps only?

    Hi,

    To add more -

    You can use Lightning Components directly in Lightning Experience, the Salesforce1 Mobile app, template-based communities, and custom standalone apps. Additionally, you can include Lightning components in a Visualforce page, allowing you to use them in Salesforce Classic, Console, and Visualforce-based communities.

    Hope this helps.

  • shariq

    Member
    September 16, 2018 at 10:30 AM in reply to: What are changeset, eclipse & ant in Salesforce?

    Hi,

    Difference Between Change Sets and Eclipse Deployment Methods

     

    1. Via eclipse we can deploy but Eclipse will not keep a track of the Classes and Pages which were deployed earlier . On the Other hand if we use Change Sets then all old deployments will be tracked .

     

    2. Change Sets allow the ability to be cloned where as Eclipse doesn't .

     

    3. A silly difference is Eclipse Uses Security Token as it is an 3rd Party System .

     

    4. A change set can only be moved between a live site and its sandbox. Eclipse can be used to move between any orgs like live site and developer org.

     

    5. When using change sets when it deploys it runs all tests of apex code. If you have low coverage or have code that will break with the new components you will not be able to deploy it will fail every time while with Eclipse you can push code without coverage.

    Hope this helps.

  • Hi,

    In simple terms, packages are generally used to cluster components for migration or distribution. Think of it as an app with other components as a building block.

    A package is a bundle of components that make up an application or piece of functionality that you are building. Packages are typically created so that their components can be clustered in a container for code migration, editing in an IDE, or distribution to other companies in the example of AppExchange packages. Packages are completely private to your salesforce instance, unless uploaded and published to AppExchange.
    Packages come in two forms: unmanaged and managed. Unmanaged packages can be used for a one-time distribution, like a template. These are ideal for sharing or migrating application templates or code samples. The installer receives an independent copy of the components. Managed packages provide intellectual property protection (the source code of many components is not available, in contrast to unmanaged packages), as well as a way for the package creator to offer upgrades to the package. Managed packages are a great way of releasing applications for sale, and also provide support for license enforcement features.

     

    Changesets are a way to move metadata from one org to another (sandbox to sandbox or sandbox to production).

    Use change sets to send customizations from one Salesforce org to another. For example, you can create and test a new object in a sandbox org, then send it to your production org using a change set. Change sets can only contain modifications you can make through the Setup menu.

    Hope this helps.

     

  • shariq

    Member
    September 16, 2018 at 10:25 AM in reply to: Is it possible to edit the process once it is activated in process builder?

    Hi,

    You need to Clone it in order to be able to edit it:

    Once you have cloned it, you will be able to edit it. Just select 'Version of the current process' , when you do 'Save Clone as..'

    Hope this helps.

  • Hi,

    When you describe a Rollup Summary Field, its describe returns null when you call getCalculatedFormula(), unlike a Formula Field.

    system.assertEquals(null, rollupDescribe.getCalculatedFormula());
    system.assertNotEquals(null, formulaDescribe.getCalculatedFormula());

    Hope this helps.

  • Hi Ajay,

    This is the code I have written and it is working fine for me -

    Apex class - 

    public with sharing class AddContactsAccounts1
    {

    // public List <AddCon> customContacts {get; set;}
    public List <Account> accounts ;
    public List <Contact> contacts1{get; set;}
    public Map <Integer,List<Contact>> mapIntVsConList{get; set;}
    public Map <Integer,Account> mapIntVsAcc{get; set;}
    public Integer i ;
    public Integer j ;
    public Account acc {get; set;}
    public Contact con {get; set;}

    public AddContactsAccounts1()
    {
    i=0;j=0;
    accounts = new List<Account>();
    mapIntVsConList = new Map <Integer,List<Contact>>();
    mapIntVsAcc = new Map <Integer,Account>();
    // customAccounts = new List <AddAcc> ();
    //customContacts = new List <AddCon> ();
    contacts1 = new List<Contact>();
    // AddAcc customAccount = new AddAcc();
    // customAccounts.add(customAccount);
    acc = new Account();
    mapIntVsAcc.put(i,acc);
    mapIntVsConList.put(i,contacts1);
    }

    public void addNewAccount()
    {
    i++;
    //customContacts = new List <AddCon> ();
    acc = new Account();
    mapIntVsAcc.put(i,acc);
    contacts1 = new List<contact>();
    mapIntVsConList.put(i,contacts1);

    }
    public void addNewContact()
    {
    con = new Contact();
    contacts1.add(con);
    mapIntVsConList.put(i,contacts1);
    }

    public PageReference insertAccountsContacts()
    {
    //i=0;
    //Map <Id,List<Contact>> mapAccIdVsCon = new Map <Id,List<Contact>>();
    PageReference pageRefer = new PageReference('/apex/AddContactsAccountsPage1');
    /*for (AddAcc customAccount : customAccounts)
    {
    accounts.add(customAccount.acc);
    }*/
    //system.debug('accounts::::'+accounts);
    List<Contact> conList = new List<Contact>();
    for(Integer i : mapIntVsAcc.keySet())
    {
    accounts.add(mapIntVsAcc.get(i));
    }
    insert accounts;
    j = 0;
    for(Account a : accounts)
    {
    //List <Contact> contacts = new List <Contact>();
    for(Contact c : mapIntVsConList.get(j))
    {
    c.accountId = a.Id;
    conList.add(c);
    }
    // mapAccIdVsCon.put(a.Id, contacts);
    j++;
    }
    //system.debug('contacts::::'+contacts);

    /* for(Id ide :mapAccIdVsCon.keySet())
    {
    for(Contact c : mapAccIdVsCon.get(ide))
    {
    conList.add(c);
    }
    }*/
    insert conList;

    pageRefer.setRedirect(True);
    return pageRefer;
    // return Page.AddContactsAccountsPage1;
    }
    }

    Visualforce page - 

    <apex:page controller="AddContactsAccounts1" sidebar="false" >
    <apex:form id="form">
    <apex:pageBlock >
    <apex:pageBlockButtons >
    <apex:commandButton action="{!addNewAccount}" value="Add New Account" rerender="pageId"/>
    <apex:commandButton action="{!addNewContact}" value="Add New Contact" rerender="pageId"/>
    <apex:commandButton action="{!insertAccountsContacts}" value="Insert All" />
    </apex:pageBlockButtons>

    <apex:pageBlockTable var="customAccount" value="{!mapIntVsAcc}" id="pageId">
    <apex:column ><h1>
    Account Name
    </h1> <apex:inputfield value="{!mapIntVsAcc[customAccount].Name}" /></apex:column>
    <apex:column > <apex:pageBlockTable value="{!mapIntVsConList[customAccount]}" var="cont" columns="6" >
    <apex:column ><h1>
    Contact Last Name
    </h1> <apex:inputfield value="{!cont.LastName}" /> </apex:column>
    <apex:column ><h1>
    Gender
    </h1> <apex:inputfield value="{!cont.Gender__c}" /> </apex:column>
    <apex:column > <h1>
    Start Date
    </h1> <apex:inputfield value="{!cont.Start_Date__c}" /> </apex:column>
    <apex:column ><h1>
    End Date
    </h1> <apex:inputfield value="{!cont.End_Date__c}" /> </apex:column>
    </apex:pageBlockTable></apex:column>
    </apex:pageBlockTable>

    </apex:pageBlock>
    </apex:form>
    </apex:page>

    Thanks.

  • Hi Parul,

    Correct answer which I got online -

    public static List<Account> getListAcc(){

    List<Account >accList = new List<Account >();

    //Logic

    return accList;

    }

    Then use ListAcc on VF page.

    Thanks.

  • shariq

    Member
    September 16, 2018 at 9:50 AM in reply to: What is the difference between JSON and JSONP in Salesforce?

    Hi,

    To make it more simple -

    JSONP is JSON with padding, that is, you put a string at the beginning and a pair of parenthesis around it. For example:

    //JSON
    {"helps":"old","age":55}
    //JSONP
    onOff({"helps":"new","age":65});

    Hope this helps.

Page 42 of 57