• Gyanender Singh
  • NEWBIE
  • 278 Points
  • Member since 2015
  • Senior Associate Consultant
  • Infosys Limited


  • Chatter
    Feed
  • 7
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 87
    Replies
I am a newbie salesforce develoepr working for a ISV and we support multiple customers. The chanllenge I have right now is that some customers have certain custom fields while others don't have the fields. 

Does anyone here know how I can build a visualforce page so that the field name is not hard-coded in my visualforce page. Instead I want to be able to specify the field names that I want to display in a text file, so that the fields that are displayed in my visualforce page are adjustable for each customers. 

I am stuck on this for a while now. Any help is greatly appreciated!!!  
Hi,
When I create a new contact, the layout show me three differents fields: salutation (a list of value), name and lastname, but when I see the record (in edit mode, for example) the three fields appears in only one field, I need to separate these three fields when the layout is in edit mode (modifying the record)
I don't know where or how can I change this behavior.
I need help, please!
Thanks,
Hi all,

I want to solve with the below code 
<apex:pageBlockSection dir="LTR" rendered="{!Lead.Years__c=='0'||Lead.Years__c=='1'||Lead.Years__c=='2'}">
Here Year__c is a picklist field in Lead object. I want to check that condition for rendering the pageBlock section. I dont want to use the controller. Please some one help me.

Thank you.
 
Hi,

We have a VisualForce (VF) page that renders as a pdf. I have an automated email that is going to be trigger when criteria A, b, and C are met. 

How can i attach the pdf from the VF page as an email attachment in the automated email that is sent from an apex trigger or class?
  • October 25, 2015
  • Like
  • 1
How to pre-populate the shipping address on the Opportunity from the Account?
As soon as the user clicks on New Opportunity, the shipping address from Account should pre-populate on the Opportunity Shipping address and this should be editable before saving. 
Hello,

Is there any workaround to export Joined reports

 
Hello,

I am using joined report

Is it possibel to take a screenshot of a report (or converting report in to pdf)and get it in apex.

I will later use it to email by scheduler

thank you
Thuis is Apex Code

public class loginController {
    public String userName { get; set; }
    public List<Customer__c> customerobjList { get; set; }
    public loginController(){
        getInput = True;
        customerobjList = new List<Customer__c>();
    }    
    public void searchUserName(){
        getInput = False;
        customerobjList = [select Id, UserName__c FROM Customer__c WHERE UserName__c =:userName];
    }
}
Hi guys,

Im having trouble getting my visualforce page to save data to my custom object. Im working in sandbox and using sites to expose my page publicly to get input from guest users. It works when I enter data from the preview but not when I open the link. I have checked my 'Public Access Settings' and gave the correct permissions for Org, Object and Field level security. I've tried everything from related posts but nothing seems to work.

Here is my code:

Visualforce page:
 
<apex:page standardStylesheets="false" sidebar="false" showHeader="false" standardController="Candidate__c" extensions="MyCandidateController">
<apex:form style="font:poppins;">
 
<apex:pageBlock >

        <center> <apex:image url="{!$Resource.Khono}" width="375" height="92"/> </center>
        <apex:styleSheet value="{!$Resource.Khonology_CSS_Style}"/>
        <apex:styleSheet value="{!$Resource.Khono_Font_Style}"/>
        <apex:styleSheet value="{!$Resource.Khono_Button_Style}"/>
        <apex:styleSheet value="{!$Resource.Khono_All_Min_Style}"/>


 <form id="contact-form">  
        <apex:pageBlockSection title="Personal Information">


            <apex:pageBlockSectionItem >
                
                <apex:inputfield html-placeholder="First Name" id="Name" value="{!c.Name}" />
            </apex:pageBlockSectionItem>
    
             <apex:pageBlockSectionItem >
                
                <apex:inputfield html-placeholder="Last Name" id="Surname" value="{!c.Surname__c}" />
            </apex:pageBlockSectionItem>
    
            <apex:pageBlockSectionItem >
               <apex:outputLabel ><th><td>Gender</td></th></apex:outputLabel>
                <apex:inputField html-placeholder="Gender" id="Gender" value="{!c.Gender__c}" />
            </apex:pageBlockSectionItem>
    
            <apex:pageBlockSectionItem >
                <apex:outputLabel ><th><td>Ethnicity</td></th></apex:outputLabel>
                <apex:inputField id="Ethnicity" value="{!c.Ethnicity__c}" />
            </apex:pageBlockSectionItem>
    
            <apex:pageBlockSectionItem >
                <apex:outputLabel ><th><td>Country of Birth</td></th></apex:outputLabel>
                <apex:inputField id="COB" value="{!c.Country_of_Birth__c}" />
            </apex:pageBlockSectionItem>
    
            <apex:pageBlockSectionItem >
               
                <apex:inputField html-placeholder="ID Number" id="IDno" value="{!c.ID_Number__c}" />
            </apex:pageBlockSectionItem>
    
            <apex:pageBlockSectionItem >
                
                <apex:inputField html-placeholder="Email" id="Email" value="{!c.Email_Address__c}"/>
            </apex:pageBlockSectionItem>
    
            <apex:pageBlockSectionItem >
               
                <apex:inputField html-placeholder="Contact Number" id="ContactNo" value="{!c.Contact_Number__c}" />
            </apex:pageBlockSectionItem>
    
            <apex:pageBlockSectionItem >
                <apex:outputLabel ><th><td>Residential Address Province</td></th></apex:outputLabel>
                <apex:inputField id="Province" value="{!c.Residential_Address_Province__c}" />
            </apex:pageBlockSectionItem>
    
</apex:pageBlockSection>

<apex:pageBlockSection title="Qualification">    

    
            <apex:pageBlockSectionItem >
                <apex:outputLabel >University</apex:outputLabel>
                <apex:inputField id="Uni" value="{!c.University__c}" />
            </apex:pageBlockSectionItem>
    
            <apex:pageBlockSectionItem >
                <apex:outputLabel >Qualification</apex:outputLabel>
                <apex:inputField id="Qualification" value="{!c.Qualification__c}" />
            </apex:pageBlockSectionItem>
    
            <apex:pageBlockSectionItem >
                
                <apex:inputField html-placeholder="Major Subjects" id="Subjects" value="{!c.Major_Subjects__c}" />
            </apex:pageBlockSectionItem>
   
</apex:pageBlockSection>
 </form>    


    <apex:pageBlockButtons >    
        <apex:commandButton id="Save" action="{!Save}" value="Save" styleClass="btn .btn-primary"/>
        <apex:commandButton id="Cancel" action="{!Cancel}" value="Cancel" styleClass="btn .btn-primary"/>
    </apex:pageBlockButtons>



</apex:pageBlock>

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






Controller:
 
public without sharing class MyCandidateController {
   
   
    public Candidate__c c { get; set; }
    
    public MyCandidateController(){
        c=new Candidate__c();      
    }

    
    public MyCandidateController(ApexPages.StandardController con){
       c=new Candidate__c();
    
    }

    public PageReference save() {
       insert c;  
        PageReference pr=new PageReference('/apex/CandidateConfirmation');
        pr.setRedirect(true);
   
      return pr;
    }


   }





 
I am a newbie salesforce develoepr working for a ISV and we support multiple customers. The chanllenge I have right now is that some customers have certain custom fields while others don't have the fields. 

Does anyone here know how I can build a visualforce page so that the field name is not hard-coded in my visualforce page. Instead I want to be able to specify the field names that I want to display in a text file, so that the fields that are displayed in my visualforce page are adjustable for each customers. 

I am stuck on this for a while now. Any help is greatly appreciated!!!  
Every time we try to edit an account in Salesforce, we cannot open it and Salesforce ends up bugging and crashed. Thanks for the help you could give to solve this problem.
Hi Guys,

I have a Vf page which has two Input fields of date types one is Start date and other is end date, what i want is that if the difference between the end date and start date is greater than 7 i want to show an error. I am able to do the same via controller, but don't want this to happen on server side, therefor trying to do this on VF page using JavaScript or Jquery.
Any help would be appricaited

Thanks in advance !!
Hi All

I have a JS button on a custom object that copies fields from the record an makes a new record in a different object. One of the fields im trying to copy is a long text area but it often has illegal char's and a lot of weird stuff in it.
 
ito.incidentDescription__c = "{!ncident__c.incidentDescription__c }";
Always results in an Illegal error

So im trying to clean it up an put it into an error box so i can confirm that it works but i still get illegal errors. The code im trying that still errors is:
 
{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")}

var incidentdesc = "{!Incident__c.incidentDescription__c}"
clean = incidentdesc.replace(/[|&;$%@"<>()+,]/g, "");

alert( 
clean
);

Can anyone offer up any possiable solutions to this?

Cheers
Dale
Helllo 
How can i create field for custom object for the following thing.
User-added image
Hi,
I have 3 objects : Payment, Opportunity, and Device.
The relationship is: Payment ---(Master-Detail)-- > Opportunity <--(Lookup)--- Device

What I'm trying to do is: When PaymentFieldStatus is edit, Update the related DeviceFields.

I tried to make a formula field on the device that shown me the "PaymentFieldStatus" and whan the value will change, update DeviceFields.
But the Workflow dosen't work on formula fields (because they not edit manually).

What more should I try?
  • May 06, 2016
  • Like
  • 0
Hi, can anyone help as to how i can bulkify this code:
Context: A list of accounts is loaded (imported) into a custom VF page, the list is in a .CSV file.  Afeter the list is uploaded to the VF page & viewable by the user they can insert the list into the SF database.    

As part of the load step (or import step) the controller behind the VF page validates the accounts coming in to ensure that they actaully exist on the SF database (ie they have to be exisiting accounts) otherwise an error message is shown telling the user which account doen't exist and the insert button is disabled.   However, the code gets a 'Too many sql queries error' when running with a largish file. 

There are other things going on in the controllwe file so other SQL contribute to the limit being reached, but is there a way that a list can be validated in bulk as currently the list is validated acount by account?     An import file of over 30 accounts is getting the too many SQL query error.  

Here is the SOQL:
1st checks if the account exisit & then checks if the account is associated to an opportunity? 

public static integer validateContractAccount(string contAcct, string SFOppId, string oppId_c, integer errorNum, integer linenum) {
     List<Account> acctList = [SELECT ID, ParentId FROM Account WHERE Account.Sap_ca_Id__c =: contAcct LIMIT 1];    
     if (acctList.size() < 1 ) {  
         errorNum = errorNum + 1;
         ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.ERROR, errorNum +  
            ') Contract Account ' + contAcct + ' for site ' + linenum + ' was not found in Salesforce. Data can not be inserted.');
         ApexPages.addMessage(errorMessage);     
       }  
     else {
         List<Contract_Account_Relationship__c> relation = [SELECT ID, Opportunity__c FROM Contract_Account_Relationship__c
                                                                WHERE Account__c =: acctList.get(0).ID and Opportunity__c =: SFOppId];
         if (relation.size() < 1 ) {  
             errorNum = errorNum + 1;
             ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.ERROR, errorNum +  
             ') Contract Account ' + contAcct + ' for site ' + linenum + ' is not associated to opportunity ' + oppId_c + '. Data can not be inserted.');
             ApexPages.addMessage(errorMessage);     
            }
        }
    return errorNum;
    } 

The actual insert code (not shown) is bulkified but can the validation code be bulkified?
cheers
I have created an APEX trigger in sandbox and when I try to validate in production I am getting this error. 

Code Coverage Failure
The following triggers have 0% code coverage. Each trigger must have at least 1% code coverage.
 - UpdateLeadswithTask

This does not make sense to me as the tigger in production says I cover 76% of code. See attachtment User-added image

I did not write an APEX class specifically for the trigger, rather just ran tests on all of my existing. Tihs is what got me the 76%. Any ideas?
Hi All,

I have 2 custom object Invoicing and Invoice details. Invoice details has a lookup relationship to Invoice. this query works fine
[select Date__c,company__c  from invoicing_details_gen__c where invoicing__c=:invoiceId ];

but i need to query 1 field from invoicing__C object also. when i try this I get the below error:

Error: Compile Error: Didn't understand relationship 'Invoiving__c' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name
[select Date__c,company__c ,(select region__c from invoicing__c) from invoicing_details_gen__c where invoicing__c=:invoiceId ];
How can i query this?

Thanks,
Richa
 
I have custom field "Email__c"  on Account . If I try to run below query, 

If I run below query,  I get "Unknown error parsing query"  error. Not sure what I'm doing wrong here. 
SELECT ID , Account.Email__c  ,Email  FROM Contact WHERE   Account.Email__c  != Email

Below query runs successfully 
SELECT ID , Account.Email__c  ,Email  FROM Contact WHERE   Account.Email__c  !=''

Thanks for help.
  • January 20, 2016
  • Like
  • 0
Hello,

I am using joined report

Is it possibel to take a screenshot of a report (or converting report in to pdf)and get it in apex.

I will later use it to email by scheduler

thank you
Hi,

We are using custom objects and fields on the Force.com site to accept the data from users. But the fields are not visible on the pages. The pages are working fine for Sandbox's force.com site. But, not working for production.


We checked..
  1. the CRUD permissions for the custom object and its parent object.
  2. the field level security for all the fields for the custom object. Made all the fields visible to the Site User Profile.
  3. the sharing settings for the relevant custom object as well as its parent object.
  4. the deployment status of the custom object. It's "Deployed".
  5. the page layout and record type permissions for the custom object.
  6. "Public Access Settings" for the site are also verified.
Is there any setting we are missing? Why the fields are not visible on visual force pages present on force.com site?

Thanks,
Rupali