Forum Replies Created

Page 23 of 57
  • shariq

    Member
    September 20, 2018 at 10:52 PM in reply to: What Is Property In Salesforce Apex? Explain With Advantages?

    Hi,

    Example -

    <apex:page controller="simplegetset">
    <apex:form>
    <apex:outputlabel value="Enter your name here"/>
    <apex:inputtext value="{!userinput}"/>
    </apex:form>
    </apex:page>

    The Apex code for this page would be...

    public class simplegetset
    {
    public String userinput{get; set;}
    }

  • shariq

    Member
    September 20, 2018 at 10:50 PM in reply to: How to insert null values into dataloader?

    Hi,

    Steps sto achieve this -

    Go to the Settings of data loader

    Enable insert null values

    Then try to insert csv with null values in coloumn, this will work for you.

    Hope this helps.

  • shariq

    Member
    September 20, 2018 at 10:47 PM in reply to: What Is The Controller Extension?

    Hi,

    Adding Example -

     

    Code for Visualforce page

    <apex:page Controller="AddmultipleAccountsController">
    <apex:form >
    <apex:pageBlock >
    <apex:pageBlockTable value="{!listAccount}" var="acc">
    <apex:column headerValue="Account Name">
    <apex:inputField value="{!acc.Name}"/>
    </apex:column>
    <apex:column headerValue="Account Number">
    <apex:inputField value="{!acc.AccountNumber}"/>
    </apex:column>
    <apex:column headerValue="Account Type">
    <apex:inputField value="{!acc.Type}"/>
    </apex:column>
    <apex:column headerValue="Industry">
    <apex:inputField value="{!acc.Industry}"/>
    </apex:column>
    </apex:pageBlockTable>
    <apex:pageBlockButtons >
    <apex:commandButton value="Add one more account" action="{!addAccount}"/>
    <apex:commandButton value="Save Accounts" action="{!saveAccount}"/>
    </apex:pageBlockButtons>
    </apex:pageBlock>
    </apex:form>
    </apex:page>
    Code for custom controller:

    public class AddmultipleAccountsController {
    Account account = new Account();
    public list<Account> listAccount{ get; set; }

    public AddmultipleAccountsController()
    {
    listAccount=new list<Account>();
    listAccount.add(account);
    }

    Public void addAccount()
    {
    Account acc = new Account();
    listAccount.add(acc);
    }
    public PageReference saveAccount() {
    for(Integer i=0; i<listAccount.size(); i++)
    {
    insert listAccount;
    }
    return Page.Allaccountssaved;    // I am returning another vf page here.
    }
    }

    Hope this helps.

  • shariq

    Member
    September 20, 2018 at 10:46 PM in reply to: Explain The Need Or Importance Of The Controller Extension in Salesforce?

    Hi,

    Adding Examples -

    Code for Visualforce page

    <apex:page Controller="AddmultipleAccountsController">
    <apex:form >
    <apex:pageBlock >
    <apex:pageBlockTable value="{!listAccount}" var="acc">
    <apex:column headerValue="Account Name">
    <apex:inputField value="{!acc.Name}"/>
    </apex:column>
    <apex:column headerValue="Account Number">
    <apex:inputField value="{!acc.AccountNumber}"/>
    </apex:column>
    <apex:column headerValue="Account Type">
    <apex:inputField value="{!acc.Type}"/>
    </apex:column>
    <apex:column headerValue="Industry">
    <apex:inputField value="{!acc.Industry}"/>
    </apex:column>
    </apex:pageBlockTable>
    <apex:pageBlockButtons >
    <apex:commandButton value="Add one more account" action="{!addAccount}"/>
    <apex:commandButton value="Save Accounts" action="{!saveAccount}"/>
    </apex:pageBlockButtons>
    </apex:pageBlock>
    </apex:form>
    </apex:page>

    Code for custom controller:

    public class AddmultipleAccountsController {
    Account account = new Account();
    public list<Account> listAccount{ get; set; }

    public AddmultipleAccountsController()
    {
    listAccount=new list<Account>();
    listAccount.add(account);
    }

    Public void addAccount()
    {
    Account acc = new Account();
    listAccount.add(acc);
    }
    public PageReference saveAccount() {
    for(Integer i=0; i<listAccount.size(); i++)
    {
    insert listAccount;
    }
    return Page.Allaccountssaved;    // I am returning another vf page here.
    }
    }

     

    Hope this helps.

  • shariq

    Member
    September 20, 2018 at 10:37 PM in reply to: How To Read The Parameter Value From The Url In Apex?

    Hi,

    We can also encode or decode this parameter so that it can't be visible to the users.

    Hope this helps.

  • shariq

    Member
    September 20, 2018 at 10:36 PM in reply to: Is There Any Way To Control The Sequence Of Execution Of These Triggers?

    Hi,
    Trigger example -

    trigger Duplicate Name on Contact (before insert, before update)
    {
    set<String> lastName = new set<String>();
    set<String> setname = new set<String>();
    for(Contact con : Trigger.new)
    {
    lastName.add(con.email);
    }
    for(Contact con : [select lastName from contact where email in : lastName])
    {
    setname.add(con.lastName);
    }
    if(Trigger.isInsert||Trigger.isUpdate)
    for(contact a:trigger.new)
    {
    if(setname.contains(a.lastName))
    {
    a.lastName.adderror('This email already exists');
    }
    }
    }

    Hope this helps.

  • shariq

    Member
    September 20, 2018 at 10:32 PM in reply to: What Are Global Variables Explain With Examples?

    Hi,

    On vf page For example -

    {!Api.Session_ID} - It gives the salesforceUI session id.

    Hope this helps

     

  • Hi,

    Just give the edit access through OWD sharing setting.

    Hope this helps.

    • This reply was modified 7 years, 6 months ago by  shariq.
  • shariq

    Member
    September 20, 2018 at 10:27 PM in reply to: Is there any limitation to load fields for mapping in webmerge?

    Hi,

    You can use only 3000 fields to map to your template, for increasing it you need to talk to salesforce support.

    Hope this helps

  • shariq

    Member
    September 20, 2018 at 10:26 PM in reply to: How To Restrict Any Trigger To Fire Only Once?

    Hi Parul,

    There are some scenarios in which this case occurs so we use the static variable for it and there is one more way to achieve it by toggling custom setting records.

    Hope this helps.

     

  • shariq

    Member
    September 20, 2018 at 10:24 PM in reply to: How To Create Many To Many Relationships Between Object?

    Hi,

    Adding Example -

    Like many products have same price and same product can be of different prices, its kind of many to many relationship.

    Hope this helps.

  • shariq

    Member
    September 20, 2018 at 10:21 PM in reply to: Is it possible to create community user through Salesforce Apex?

    Hi,

    Yes, you can create community  user through apex, just remember community user has extra field contactId which is required.

    Hope this helps.

  • Hi,

    Try out WebMerge for images in JPEG format.

    Hope this helps.

  • shariq

    Member
    September 20, 2018 at 10:17 PM in reply to: How can we create a relationship with conga composer in Salesforce?

    Hi,

    I found this online -

    So there is no limitation around querying grandchild data specific to Conga, the querying of grandchild data in a nested query is a limitation of SOQL. That said, you could easily build a tabular query that will capture fields from all three levels and then group against parent detail on the template.

    So while the Conga Query Builder doesn't expose grand parent level information, you're welcome to build your own queries to pull data.

    Example:

    SELECT Opportunity.Account.Parent.Name, Opportunity.Account.Name, Opportunity.Account.Type, Opportunity.Custom_Lookup__r.Name, Opportunity.Amount, Opportunity.StageName, Opportunity.Name, Opportunity.CloseDate, PricebookEntry.Product2.Name, PricebookEntry.Product2.Family, PricebookEntry.Product2.Description, Quantity, Salesprice, Totalprice FROM OpportunityProduct WHERE Opportunity.Account.Id = '{pv0}'

    So in the above example, I can start at the lowest level and select fields as many as 5 relationships up and could group against any field selected in the query. Your challenge is specific to the with/out grandchild. To accommodate that, I would build your query with the CHILD as the "FROM" clause.

    Hope this helps.

  • shariq

    Member
    September 20, 2018 at 10:14 PM in reply to: Can We Change The Record Owner?

    Hi,

    One more way to do it -

    if you write your class without sharing. Without sharing keyword make sure that code runs in system context and so it has full access to change theownership of record event if current user id not the owner.

    Hope this helps.

  • shariq

    Member
    September 20, 2018 at 9:50 PM in reply to: How to check more the 2048 records in Salesforce Reports?

    Hi,

    Rows displayed in a report Up to 2,000. To view all the rows, export the report to Excel or use the printable view for tabular and summary reports. For joined reports, export is not available, and the printable view displays a maximum of 20,000 rows.

    Hope this helps.

  • Hi,

    You can understand Wrapper like this.If you want to make a object which includes both( account and contact) or( account and its corresponding selection check box) you use wrapper class

     

    <apex:page sidebar="false" controller="WrapTest ">

    <!--VF PAGE BLOCK-->

    <apex:form >
    <apex:pageBlock >
    <apex:pageBlockButtons >
    <apex:commandButton action="{!ProcessSelected}" value="Show Selected accounts" reRender="block2"/>
    </apex:pageBlockButtons>
    <apex:pageBlockSection columns="2">
    <apex:pageBlockTable value="{!wrapaccountList}" var="waccl">

    <apex:column >
    <apex:facet name="header">
    <apex:inputCheckbox />
    </apex:facet>
    <apex:inputCheckbox value="{!waccl.isSelected}" id="InputId"/>
    </apex:column>

    <apex:column value="{!waccl.accn.name}"/>
    <apex:column value="{!waccl.accn.phone}"/>
    <apex:column value="{!waccl.accn.billingcity}"/>
    </apex:pageBlockTable>

    <apex:pageBlockTable value="{!selectedAccounts}" var="sa" id="block2">
    <apex:column value="{!sa.name}"/>
    <apex:column value="{!sa.phone}"/>
    <apex:column value="{!sa.billingcity}"/>
    </apex:pageBlockTable>

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

    Controller -

    public class WrapTest {

    //CONTROLLER CLASS

    public list<wrapaccount> wrapaccountList { get; set; }
    public list<account> selectedAccounts{get;set;}

    public WrapTest (){

    //if(wrapaccountList ==null){
    wrapaccountList =new list<wrapaccount>();
    for(account a:[select id,name,billingcity,phone from account limit 10]){
    wrapaccountlist.add(new wrapaccount(a));

    }
    // }
    }

    //### SELECTED ACCOUNT SHOWN BY THIS METHOD
    public void ProcessSelected(){
    selectedAccounts=new list<account>();

    for(wrapaccount wrapobj:wrapaccountlist){
    if(wrapobj.isSelected==true){
    selectedAccounts.add(wrapobj.accn);
    }

    }
    }

    //##THIS IS WRAPPER CLASS
    // account and checkbox taken in wrapper class

    public class wrapaccount{

    public account accn{get;set;}
    public boolean isSelected{get;set;}

    public wrapaccount(account a){

    accn=a;
    isselected=false;
    }
    }
    }

    Hope this helps.

  • shariq

    Member
    September 20, 2018 at 9:45 PM in reply to: What is service process in Salesforce?

    Hi,

    Salesforce Service Cloud is a customer relationship management (CRM) platform for customer service and support, based on the company's CRM software for sales professionals. Service Cloud allows users to automate service processes, streamline workflows and find key articles, topics and experts to support the agent.

    Hope this helps.

  • Hi,

    Click on Setup
    Write “Orders Setting” in quick find/search box
    click on “Orders Settings” link
    Check “Enable Orders ” checkbox
    Click Save

    Then make it available on the page layout of opportunity

    Hope this helps.

  • shariq

    Member
    September 20, 2018 at 9:42 PM in reply to: How to add Quote function to a Salesforce Opportunity object?

    Hi,

    Steps to achieve this –

    Click on Setup
    Write “Quote Setting” in quick find/search box
    click on “Quote Settings” link
    Check “Enable Quotes” checkbox
    Click Save

    Then make it available on the page layout of opportunity

    Hope this helps

    • This reply was modified 7 years, 6 months ago by  shariq.
  • Hi,

    Steps to achieve this -

    Click on Setup
    Write “Quote Setting” in quick find/search box
    click on “Quote Settings” link
    Check “Enable Quotes” checkbox
    Click Save

    Hope this helps

  • shariq

    Member
    September 20, 2018 at 9:37 PM in reply to: How to add error message in a Salesforce Apex Trigger?

    Hi,

    This is the code snippet -

    trigger AvoidDuplicateAccounts on Account (before insert, before delete)
    {
    Set<String> setAccountName = new Set<String>();
    for(Account objAccount: [Select Name from Account])
    setAccountName.add(objAccount.Name);
    for(Account objAccount: Trigger.new)
    {
    if(!setAccountName.contains(objAccount.Name))
    {
    setAccountName.add(objAccount.Name);
    }
    else
    {
    objAccount.Name.addError('Account with same name Exists');
    }
    }
    }

    Hope this helps

  • shariq

    Member
    September 20, 2018 at 8:13 PM in reply to: What is the maximum number of rows that SOQL and SOSL can “scan”?

    Hi,

    Found this online-

    LIMIT is an optional clause that can be added to a SOSL query to specify the maximum number of rows that are returned in the text query, up to 2,000 results. If unspecified, the default is the maximum 2,000 results. The default 2,000 results is the largest number of rows that can be returned for API version 28.0 and later. 

    The LIMIT clause has no limit in and of itself. It’s limited to the context in which it’s used. If it’s used in Apex code it’s limited to the total governor limit for SOQL rows, which is currently 50,000. If it’s used in a query via the Web Service API then there is no limit.

    Hope this helps.

  • shariq

    Member
    September 20, 2018 at 8:11 PM in reply to: How can we get the day value from a date value in Salesforce?

    Hi,

    Try this -

    DateTime testdate=DateTime.newInstance(date.today(), Time.newInstance(0, 0, 0, 0));
    String testday=testdate.format(‘EEEE’);

    System.debug(day);

    Hope this helps.

  • Hi,

    I think you can use - runtime.onInstalled event.

    Hope this helps.

     

Page 23 of 57