• Sumit Kumar Singh 9
  • SMARTIE
  • 918 Points
  • Member since 2016
  • Technical Solution Lead
  • A Medial Company


  • Chatter
    Feed
  • 28
    Best Answers
  • 1
    Likes Received
  • 1
    Likes Given
  • 6
    Questions
  • 253
    Replies
Hello,

I have a custom object like below:
CustomObject1__c
   CustomField1__c (Picklist, values: Val1, Val2, Val3)
   CustomField2__c (Text: 100 char)
   CustomField3__c (Tex Area)

I have a visualforce page whcih displays the 3 input fields above like below
 
<apex:inputField value="{!CustomObject1__c.CustomField1__c }" />
<apex:inputField value="{!CustomObject1__c.CustomField2__c }" />
<apex:inputField value="{!CustomObject1__c.CustomField3__c}" />
Use case
1) When the CustomField1__c is changed to Val1, i want the below things to happen
> the CustomField2__c is updated to "recordtypename+username+val1"
>the CustomField3__c is updated to
 "the user name is username, record type name isrecordtypename and the value selected is Val1
Date:
Time:
 "
Thanks for suggestions !

 
  • December 26, 2016
  • Like
  • 0
Hello,

I have used data loader to make make update on all the records for an object.

The field i am updating is getting updated correctly but the triggers which i used to update certain values are not working, the trigger is workig if i make update mannualy but not by data loader.

I have already checked By pass trigger check box.

What are other reasons that can halt this update ?
  • June 28, 2016
  • Like
  • 0
Hi,

I created a custom object and set the record name to text and now I realize that I need to set it to Auto-number. The problem is I cannot change it.
this object is included in my managed package so I cannot delete and recreate.

Is there a way around this?
I'll appreciate any help. Thanks
  • June 24, 2016
  • Like
  • 0
In salesforce I have a requirement that, I need to set the Created By field value to a particular user, irrespective of the user who creates it through UI/Apex. So how can I do that?
I have a trigger with some code that references a number field with 18, 0.  My method returns an integer and the quantity variable is an integer, however when I try and use the field value I get the following error:

Method does not exist or incorrect signature: dcSystemSize(String, Decimal)

here is all the relevant code:
Map<String, Integer> panelType = new Map<String,Integer>{'Hyundai 255'=>255,'Hyundai 280'=>280,'Trina 290'=>290,'Hyundai 325'=>325,'SW Mono 280'=>280,'Hyundai 290'=>290};

 public Integer dcSystemSize(String panel, Integer qty){
                    
        Integer panelWattage = panelType.get(panel);
        return ((panelWattage * qty)/1000);
    } 

 for(Proposal__c p:Trigger.new){
 p.System_Size_kW__c = dcSystemSize(p.Panel_Type__c,p.Panel_Qty__c);
}

Is there any way to assign a field to an Integer variable?  Or, are they always decimal?  
Hello,

I am trying to create dependent select lists: when the first one is changed, the second one updates its options and so on.
But for the life of me I cannot figure out how to get the value of the first select list to not return null.

My VF page:
<apex:page controller="TryCtrl">
    <apex:form>
        <apex:pageBlock title="Filters">
            <apex:pageMessages />
            <apex:pageBlockSection>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Product Family" />
                    <apex:actionRegion>
                        <apex:selectList value="{!family}" size="1" id="ffamily">
                            <apex:selectOptions value="{!familyList}" />
                            <apex:actionSupport event="onchange" rerender="fproduct" />
                        </apex:selectList>
                    </apex:actionRegion>
                </apex:pageBlockSectionItem> 
                
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Product"/>
                    <apex:actionRegion >
                        <apex:selectList value="{!product}" id="fproduct" size="1" >
                            <apex:selectOptions value="{!productList}"/>
                        </apex:selectList>
                    </apex:actionRegion>
                </apex:pageBlockSectionItem> 
                    
            </apex:pageBlockSection>
		</apex:pageBlock>
    </apex:form>
</apex:page>

My controller:
public class TryCtrl {
	private final Id accId = '001g000000cnDTb';
    private List<Custom__c> objects;
    public String family {get;set;}
    public String product {get;set;}
    
    public TryCtrl() {
        this.objects = [select ...];
    }
    
    public Set<SelectOption> getFamilyList() {
        Set<SelectOption> options = new Set<SelectOption>{new SelectOption('', '--All--')};
        for(Custom__c o : this.objects) {
            options.add(new SelectOption(o.Product_Family__c, o.Product_Family__c));
        }
        return options;
    }
    
    public Set<SelectOption> getProductList() {
        Set<SelectOption> options = new Set<SelectOption>{new SelectOption('', '--All--')};
        for(Custom__c o : this.objects) {
            if(String.isBlank(family) || o.Product_Name__c == family)
            	options.add(new SelectOption(o.Product_Name__c, o.Product_Name__c));
        }
        return options;
    }
}

When the page loads, the two are populated correctly. Changing the first select list is rerending the second one, but the 'family' variable is still set to null, so the products list is the same as before. I tried removing actionRegion, but didn't help. Can anyone please help? Thanks.
  • April 26, 2016
  • Like
  • 0
I'm trying to create a filter on a pageBlock and am running into difficulties.
This is my code currently:

Apex:
public with sharing class ChildOpportunitiesAP {
    private id Parent_Acc_Id;
    Public Integer noOfRecords{Get;Set;}
    Public Integer size {get;Set;}
    
          public ApexPages.StandardSetController controller {
                    get{
                 Parent_Acc_Id = ApexPages.currentPage().getparameters().get('id');
                        if(controller == null){
                            size = 4;
                            string queryString = 'SELECT Account.Name, Name, Total_Opportunity_Amount__c ' +
                                ' FROM Opportunity WHERE Account.Parent.id=: Parent_Acc_Id';
                                 controller = new ApexPages.StandardSetController(Database.getQueryLocator(queryString));
                        controller.setPageSize(size);
                            noOfRecords = controller.getResultSize();
             }
             return controller;                              
            }set;
        }
    
         public List<Opportunity> getRelatedOpportunities(){
                        List <Opportunity> childOpps = New List<Opportunity>();
        FOR(Opportunity opp:(List<Opportunity>)controller.getRecords())
            childOpps.add(opp);
                 Return childOpps;   
         }
    
        public pageReference refresh(){
            controller = null;
            getRelatedOpportunities();
            controller.setPageNumber(1);
            return null;
        }
    
    public list<selectOption> getAvailableFilters(){
       List<selectOption> options = new List<SelectOption>();
        for(Opportunity opp: getRelatedOpportunities)
        {
            options.add(new SelectOption(opp.Name,opp.Name));
        }
       return options;
    }
 }

VF:

<apex:page sidebar="false" showHeader="false" Controller="ChildOpportunitiesAP">
   <apex:form >
          <apex:pageBlock title="Linked child opportunities" id = "pb">
              Filter:
              <apex:selectList> value="{! availableFilters }" size="1">
                <apex:selectOptions value="{! Account.Name  }"/>
                <apex:actionSupport event="onchange" reRender="pb"/>
              </apex:selectList>
          <apex:pageBlockTable value="{! RelatedOpportunities}" var="opp">
              <apex:column value="{! opp.Account.Name}"/>
              <apex:column value="{! opp.Name}"/>
              <apex:column value="{! opp.Total_Opportunity_Amount__c}"/>
          </apex:pageBlockTable>
        <apex:panelGrid columns="7">
                <apex:commandButton status="fetchStatus" reRender="pb" value="|<" action="{!controller.first}" disabled="{!!controller.hasPrevious}" title="First Page"/>
                <apex:commandButton status="fetchStatus" reRender="pb" value="<" action="{!controller.previous}" disabled="{!!controller.hasPrevious}" title="Previous Page"/>
                <apex:commandButton status="fetchStatus" reRender="pb" value=">" action="{!controller.next}" disabled="{!!controller.hasNext}" title="Next Page"/>
                <apex:commandButton status="fetchStatus" reRender="pb" value=">|" action="{!controller.last}" disabled="{!!controller.hasNext}" title="Last Page"/>
                <apex:outputText >{!(controller.pageNumber * size)+1-size}-{!IF((controller.pageNumber * size)>noOfRecords, noOfRecords,(controller.pageNumber * size))} of {!noOfRecords}</apex:outputText>
                <apex:commandButton status="fetchStatus" reRender="pb" value="Refresh" action="{!refresh}" title="Refresh Page"/>
                <apex:outputPanel style="color:#4AA02C;font-weight:bold">
                    <apex:actionStatus id="fetchStatus" startText="Fetching..." stopText=""/>
                </apex:outputPanel>
            </apex:panelGrid>
    </apex:pageBlock>
  </apex:form>
</apex:page>

I would like the user to be able to click on the ppp.Account.Name column and see a list of populated account names.
If it's possible I'd like the user to be able to filter by the ppp.Account.Name and the opp.Name columns; I'm not sure if that is possible or not.

Many thanks for any help
 
I am trying to figure out how to write  a trigger/apex class that would look through a list of quotes. There is a checkbox (Primary_Quote__c) I need the trigger or class to look through the list of quote. There is a custom field Entitled (Oracle_Quote__c). I need the trigger to look through the list of quotes with the same Oracle Quote Number and automatically check the Primary Quote checkbox on the record with the newest created date, and also uncheck the older quote records. Is this possible? How would I accomplish? Any helpwuold be greatly appreicated. 
  • April 13, 2016
  • Like
  • 0
Hi 

I create the form with mandatory field(Name,Mobile,city,Email,Gender).I create the form and insert the value into salesforce also.
But i need to throw the error message if mobile no is exist in salesforce and cannot submit without change the mobile no.
How can i do this anyone help????


Hi Team,

I want to send email to number of users, for this I am storing 'toaddress' in custom label.
here is the code,
List<Messaging.SingleEmailMessage> mails = new List<Messaging.SingleEmailMessage>();

        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();

        List<String> sendTo = new List<String>();
        sendTo.add(Label.CommunityContact);
        mail.setToAddresses(sendTo);
        
        mail.setReplyTo('noreply@salesforce.com');
    
        List<String> ccTo = new List<String>();
        mail.setCcAddresses(ccTo);
        
        String Sub = 'Application Submitted for Group : ' + groupname;

        mail.setSubject(Sub);
        String body = 'An application for group membership has been submitted with the following information:<br />';
      
        body += '<p><b>Name</b>: ' + firstName + ' ' + lastName + '<br>';
        body += '<b>Company:</b> ' + company + '<br>';
        body += '<b>Address:</b> ' + streetAddress + ' ' + streetAddressLine2 + '<br>';
        body += '<b>City:</b> ' + city + '<br>';
        body += '<b>State/Province/Region:</b> ' + stateProvinceRegion + '<br>';
        body += '<b>Postal/Zip Code:</b> ' + postalZip + '<br>';
        body += '<b>Country:</b> ' + country + '<br>';
        body += '<b>Email:</b> ' + email + '<br>';
        body += '<b>Job Title:</b> ' + jobTitle + '<br>';
        body += '<b>Regional Account Manager Name:</b> ' + AMFirstName + ' ' + AMLastName + '<br>';
        body += '<b>Disributor:</b> ' + Dist + '<br></p>';
        
        mail.setHtmlBody(body);
    
        mails.add(mail);
        Messaging.sendEmail(mails);

I am getting test class error shown below:-

System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_EMAIL_ADDRESS, Email address is invalid: amit@abc.com;sudeep@abc.com: [toAddresses, amit@abc.com;sudeep@abc.com] 
Stack Trace: Class.GroupRegistrationController.registerUser: line 95, column 1 Class.GroupRegistrationControllerTest.testGroupRegistrationController: line 40, column 1


Please help me to resolve this issue.

Thanks,

 
vf code:
<apex:page standardController="Lead" action="{!convertLead}" extensions="ControllerLeadConvertView"> </apex:page>
controller:
public class ControllerLeadConvertView {
  public Id leadId;
    public String convertedAccountId ;
    public ControllerLeadConvertView(ApexPages.StandardController stdController){
        leadId = ApexPages.CurrentPage().getParameters().get('id');
        
    }

     
    public PageReference convertLead(){
    try
    {
    lead leadobj=new Lead();
    leadobj = [select id,MobilePhone,Company from lead where id =:leadId];
    Account a = new Account();
    a.Name =leadobj.Company;  
    insert a;
    PageReference newocp= new PageReference('/'+ a.Id);

     newocp.setRedirect(true);

           return newocp;

     }   
               
    catch(Exception e)
    {
            System.Debug('Error - ControllerLeadConvertView.convertLead - Exception [' + e.getMessage() + ']');
            return null;
    }     
}
}

 
Hi,
I have to increment with 100 in  one custom filed for very 5 minutes using batch class.
Lets say I have Id of Account record and I am initializing the sobject and assigning the Id to account variable. Below is the code :
sObject obj = Schema.getGlobalDescribe().get(parentObjName).newSObject() ;
obj.Id = recordId;
System.debug('****obj : '+obj);
Debug Result: 
****obj : Account:{Id=0019000001dbup5AAA}
I was hoping that the debug will have the entire information from the account example like : Account:{Id=0019000001dbup5AAA, Name=TestAccount,...}
Is there any way to initialize the sobject in a way such that it gets loaded with the entire information?
I'm trying to query all related record in a child list from opportunity object, but I've not achieved this:

Parent Object: Opportunity

Child Object: Opportunity_Product__c (Custom Object)
Fields: Product_Description1__c and Product_Dimension__c
Master-Detail(Opportunity): Opportunity__c

So far, I have:
Select Id, Name, 
(
Select Id, Opportunity__r.Opportunity__c, 
Opportunity__r.Product_Description1__c, 
Opportunity__r.Product_Dimesion__c 

from Opportunity_Product__c

from Opportunity where id =  '0061b000002DjSCAA0'

Any HELP, will appreciated... Thanks
Wrapper class:-

public class MailMergeGroupContactsListwrap  {

public string GroupName{get;set;}
}

Apex Page:-

global class SalesforceVersionInfo
{
  
  public List<MailMergeGroupContactsListwrap> ConsoleWrapperList5{get;set;}
  
  
  //  public List<SFInstance> sfInstances{get;set;}
    public List<MailMergeGroupContactsListwrap> getperformcallout5()
        { 
   // public SalesforceVersionInfo()    {
   
        String jsonString = '[{"GroupContactID":539,"GroupName":"Recently modified Oct 6","TotalContacts":275},{"GroupContactID":538,"GroupName":"New Contacts Oct 6","TotalContacts":973},{"GroupContactID":529,"GroupName":"Egrabber test 2","TotalContacts":3},{"GroupContactID":526,"GroupName":"Unopened List 16","TotalContacts":721},{"GroupContactID":525,"GroupName":"Unopened List 15","TotalContacts":710},{"GroupContactID":524,"GroupName":"Unopened List 14","TotalContacts":700},{"GroupContactID":523,"GroupName":"Uploaded List 13","TotalContacts":700},{"GroupContactID":522,"GroupName":"Unopened List 12","TotalContacts":900},{"GroupContactID":521,"GroupName":"Unopened List 11","TotalContacts":900},{"GroupContactID":520,"GroupName":"Unopened List 10","TotalContacts":900},{"GroupContactID":402,"GroupName":"CS_Seattle_Mgr_10kplus_RQ","TotalContacts":523},{"GroupContactID":371,"GroupName":"List 1 Channel Manger Boston Linkedin","TotalContacts":141},{"GroupContactID":68,"GroupName":"DoD test email list","TotalContacts":3}]';
        ConsoleWrapperList5= (List<MailMergeGroupContactsListwrap>) System.JSON.deserialize(jsonString,List<MailMergeGroupContactsListwrap>.class);
       
   
      return consolewrapperlist5; 
                }
   
    global class MailMergeGroupContactsListwrap implements Comparable
    {
        public String GroupContactID {get;set;}
        public String GroupName {get;set;}
        public String TotalContacts {get;set;}
       
        public Integer compareTo(Object ObjToCompare)
        {
            return GroupContactID.CompareTo(((MailMergeGroupContactsListwrap)ObjToCompare).GroupContactID);
        }
    }
   
}

Visualforce Page :--


<apex:page controller="SalesforceVersionInfo">
<apex:form >
<apex:pageBlock >

 <apex:repeat value="{!performcallout5}" var="val">
 
        {!val.GroupName}<br/>
     
    </apex:repeat>
 
 </apex:pageBlock>

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

I want picklist here.

Thanks....
 /*error: System.NullPointerException: Attempt to de-reference a null object 
Class.UserAccessDetailsController.getObjectLabels: line 290, column 1
line 290 is this describe.get(op.SObjectType).getDescribe().getLabel()));
*/

 public List<NameLabel> getObjectLabels() {
        if (null == xObjectLabels) {
            List<NameLabel> result = new List<NameLabel>();
            Map<String,SObjectType> describe = Schema.getGlobalDescribe();

            
            for (ObjectPermissions op : [SELECT SObjectType FROM ObjectPermissions 
                                          WHERE Parent.Profile.Name = 'System Administrator'  ]) {
                result.add(new NameLabel(op.SObjectType, 
                                         describe.get(op.SObjectType).getDescribe().getLabel()));
            }
            result.sort();
            xObjectLabels = result;
        }
        return xObjectLabels;
    }
This is my visualforce code. Please help!

<apex:pageBlockSection title="RMS SYSTEM" columns="1" collapsible="false" id="thePbs2"  >
            <apex:outputLabel value="{!$ObjectType.Datavis_Client__c.Fields.RMS_SYSTEM__c.InlineHelpText}" />
           <apex:selectcheckboxes layout="pageDirection"  value="{!MPItems}" label="" id="checkbox1">  
               
               <apex:selectoptions value="{!MPOptions}" > 
                  
               <apex:actionSupport event="onselect" reRender="ajaxrequest" />
                </apex:selectoptions>       
            </apex:selectcheckboxes>
                
              <apex:outputPanel id="ajaxrequest">
                   <apex:outputPanel rendered=" {!MPOptions=='OTHER'}" >
                    <apex:inputField value="{!Datavis_Client__c.Others_data__c}" />
                     </apex:outputPanel>

                   </apex:outputPanel>
           
         </apex:pageBlockSection>
I have 2 objects A and B each having a phone number  field. the Mobile number field of Object A automatically gets updated in the phone number field in Object B.Now I want that all the records in B should be deleted if its matching record(phone Number) isnt found in Object A.

Object A ---> mobile number
Object B --> phone number
please note : I want the deletion of the orphan records of B working in a trigger
A Query to deal with this conundrum would be helpful and much appreciated
Thanks



 
Hi All,
I created a custom object as accproducts__c,this object having one of the field is Product__c - it has the Product name from the Product standard object in sfdc. In table Product__c field holding Productid of  that Productname.
 Now, I create a one visualpage ,input of this page i want to give the picklist value of  Product__c(that input picklist field must be product name not a productid) .how to get it from controller. If anybody knows please tell me.


Thanks & Regard,
M. Sivasankari. .
Hello Developers,
Suppose I have a custom object 'XYZ'. This object has many fields lookup to contact and User Object.
I want to get list of  all fields which has lookup to Contact object.
I want to get list of user in ApEX cladd who have access to particular Account record in Salesforce.
Hi All,
I have developed one App, I want to list this app as Salesfroce Ap Labs. How can I ? Any help is highly appriciated.

 
I have 4 record types "RT1", "RT2(default)",  "RT3",  "RT4" on a custom Object. If I choose "RT4" and save the record, the defualt recordtype "RT2" is getting saved. I checked the profile, there all 4 recordtypes have permission. 
What could be the possible issue?
Hello Experts, 

I am experiencing an unexpected situation. Below code works fine in API version 26 but in API Version 36, Its throwing an exception "Attempt ro re-deference a null object."
I debug it and came to know that  "objToken" is coming null. Why???
String objectName = 'Account';
SObjectType objToken = Schema.getGlobalDescribe().get(objectName);
DescribeSObjectResult objDef = objToken.getDescribe();
Map<String, SObjectField> field = objDef.fields.getMap();

 
Hello Experts, 
Can anyone pls tell me the scenario when I should use 'Interface' and when should I 'Abstract Class'. 
Actually, I googled a lot, but still not clear to me.
I don't want the code, please let me know the key factors which decides when to use Interface and when to use Abstract Class.
Thanks in advance.
Hello Experts, 
Can anyone pls tell me the scenario when I should use 'Interface' and when should I 'Abstract Class'. 
Actually, I googled a lot, but still not clear to me.
I don't want the code, please let me know the key factors which decides when to use Interface and when to use Abstract Class.
Thanks in advance.
Looking for a bulk attachment download tool for selected object. Please advise.
Hi Fellows,

Great day!!! 
I am trying to download all the files there in my org at once into my local drive. Is there any way to achieve this, tried export option that does not worked for me. Please suggest any other ways to achieve this.

Thanks in advance.

Prad
8886889911
Hello Developers,
Suppose I have a custom object 'XYZ'. This object has many fields lookup to contact and User Object.
I want to get list of  all fields which has lookup to Contact object.
Hey all,

Posted about this a while ago, but still never got a real answer. Please help if you can!

We have a Date field in our Contact records - "Date of Training"

We want to build a Checkbox field in the Account level that looks at all of the Contacts related to that Account, and if there is a Contact trained in the past 6 months, then the box will be checked. If there is no Contact in the Account trained in the past 6 months, the Checkbox will be unchecked.

Can anyone help with this?
When should i use data loader batch size 1? 
Hi Experts,

I have added a button "opt-out" in the email template.
This email will be sent to people and when they click the opt-out button, then the stage in opportunity should change to opt out.
How can do this

Please help.
Thanks.
I am a newbie to salesforce and i have a requirement to which i need suggestions how to approach this requirement
I have 4 contacts related to one account and when someone deletes contacts, he should not be able to delete the last contact related to the account.For example: in account A1 i have 4 contacts and someone deletes the 3 contacts from that account then it should be deleted, after that there will be only 1 contact related to that account and den someone tries to delete the last contact than it should not be deleted and throws an error "There should be atleast one contact for this account <<account name>>".
How can i achieve this using trigger?
Here I want to use List rather than Map.
Hi
I need to display on vf  by SOQL to fetch Tasks that are assinged on a Particular Account
Hello All ,

While deploying my code to production I'm getting validation failover error due to some issue with a test class and apex class. I got the error but I'm not able to rectify them as I could not see an option to edit them. So what needs to be done in this situation? Do I need to edit those classes in sandbox and then again create a new change set? or somehow the old changeset could be reused? Please help me.

Thanks,
Tanoy
Hi all,

I am trying to pass a parameter from one Visualforce to another.

I need to display / filter opportunities to an Account I gave in the first visualforce.

Here is the part where I declare the "passing" of the AccountId to the second visualforce:
 
public PageReference GoTo_VRWithOptys (){
        string value = 'accountId';
        string url;
        url = '/apex/Visit_Report_with_Opportunities?param1=' + accountId; 

        PageReference pageRef = new PageReference(url);
        pageRef.setRedirect(true);
        return pageRef;
        
    }

In my second Visualforce "Visit_Report_with_Opportunities" I am referencing that parameter in order to show only the opportunities to that account:
 
<apex:pageBlock id="pagination" title="Opportunity Details">
         <apex:pageBlockTable value="{!param1}" var="o" >
            <apex:column value="{!o.Name}"/>
            <apex:column value="{!o.CloseDate}"/>
             <apex:column value="{!o.Amount}"/>
            <apex:column value="{!o.CloseDate}"/>
         </apex:pageBlockTable>
The apex to the second Visualforce page looks like this:
 
public String optyquery;
	public String name {get;set;}
	public Date closedate {get;set;} 
    public Boolean fetchCalled {get;set;} 
    public integer totalRecs {get;set;}
    private integer index = 0;
    private integer blockSize = 5; 
    Id param1 {get;set;}
    String param_value {get;set;}
    
  
    public PaginationWithFilter()
    {
        param_value = System.CurrentPageReference().GetParameters().get('param1');
        totalRecs = [select count() from Opportunity where Days_since_created__c <=365 and Account.Id =: param1];       
        fetchCalled = false;
        
    } 
  
    public void fetch()
    {         
       
        optyquery = 'SELECT Name, CloseDate FROM Opportunity where Days_since_created__c <=365 and Account.Id =: param1 ';
        
        List<Opportunity> tempopty = Database.Query(optyquery);
        totalRecs = tempopty.size();  
       
        optyquery += ' LIMIT ' + blockSize + ' OFFSET ' + index; 
       
        fetchCalled = true;                        
    }       
   
    public List<Opportunity> getOpty()
    {      
        List<Opportunity> optys;
        if(fetchCalled)
        {
            fetch();
        }  
        else
        {
            optyquery = 'SELECT Name, CloseDate FROM Opportunity where Days_since_created__c <=365 and Account.Id =: param1 LIMIT : blockSize OFFSET : index';
        }          
        optys = Database.Query(optyquery);       
        System.debug('Values are ' + optys);
        return optys;       
    }
When I try to save the second visualforce, the error I get is:
 
Error: Unknown property 'param1' referenced in Visit_Report_with_Opportunities
I also tried replacing "param1" by "accountId" but the error then says:
Error: Unknown property 'accountId' referenced in Visit_Report_with_Opportunities

Is there here something missing?



 

Hi All,

I am trying to fetch records from another salesforce ORG using REST API. I found that we can fetch upto 2000 records only. Now digging more into this, I found that we need to use NEWRecordURL for fetching remaining records.

With that I am facing some challenges fetching more than 2000 records via REST API. Does anyone have some sample code/snippet with which I can achieve that using NewRecordURL?

Thanks in advance.

Hello Friends,

I've created a visualforce page for Lead which displays basic details of the lead/prospect from where the users/ sales person can work on.

Controller class: Leadview.cls
VF page: Leadview.page

In this VF page I need to add the "Open Activities" related list (that is there in the standard page of Lead) with only "New Task" button added to it. When the user clicks this "New task" button, the functionality to create a Task should work as standard.

Can anyone guide me to achieve this, please?
Having a couple issues with CSS and VisualForce datatable formatting. 

I am rendering a visual force page using a seperate page with renderAs="pdf". This just makes it easier to maintain just what I need to display. The visualForce page saves as a pdf attachment on the main account record. However when I view the stored PDF the datatable formatting is not displaying as it is on the main VF page.

How can I maintain the solid border and font colors on the rendered pdf ? 
Also, how can I control the cell padding using CSS instead of using the cellpadding parameter on the datatable tag. Is there a way to automaically scale the data table width should a table be long ? 

Main Visual Formce Page - PROD_UW_AccountSummary
Main visual force page with proper table rendering.
<apex:page standardStylesheets="true"  standardController="Account_Summary__c" readOnly="false" extensions="AccountSummaryController"  >
<apex:stylesheet value="{!URLFOR($Resource.pdfcssresource, 'CREresource_CRE.css')}"/>
......
 <apex:pageBlockSection columns="1" id="section2b" title="* Expiring Excess of Loss Contract Information" showHeader="true"  >  
    <apex:outputPanel id="out2b" >
       <apex:actionstatus startText="loading...">
           <apex:facet name="stop" >
              <apex:outputPanel >
                  <apex:dataTable styleClass="alldatatables" value="{!contractSectionList}" var="cs" cellpadding="5" rowClasses="alldatarows"  >
                       <apex:column value="{!cs.MR_Contract__c}" headerValue="Contract"  />
                       <apex:column value="{!cs.Name}" headerValue="Section"/>

Saved PDF Page - PROD_UW_AccountSummary_PRT
saved pdf file
 
<apex:page standardStylesheets="false" standardController="Account_Summary__c" readOnly="false" extensions="AccountSummaryController" renderAs="pdf" >
<apex:stylesheet value="{!URLFOR($Resource.pdfcssresource, 'CREresource_CRE.css')}"/>
.....
<apex:pageBlockSection columns="1" id="section2b" title="* Expiring Excess of Loss Contract Information" showHeader="true"  > 
    <apex:outputPanel id="out2b" >
      <apex:actionstatus startText="loading...">
           <apex:facet name="stop" >
              <apex:outputPanel >
                   <apex:dataTable styleClass="alldatatables" value="{!contractSectionList}" var="cs" cellpadding="5" rowClasses="alldatarows"  >
                       <apex:column value="{!cs.MR_Contract__c}" headerValue="Contract"/>
                       <apex:column value="{!cs.Name}" headerValue="Section"/>

CSS file:  CREresource_CRE.zip

 
/*
table, th, td {
    border: 1px solid black;
}

table {
    border-collapse: collapse;
}


th, td {
    padding: 15px;
    order-bottom: 1px solid #ddd;
   }

th {
    text-align: center;
    font-weight: bold;
    /* white-space: nowrap; */
}

td {
    text-align: right;
    font-family: 'Arial'; 
    font-size: 100%;   
    vertical-align: middle; 
}
*/


tr:hover {background-color: #f5f5f5}


.alldatatables {
    text-align: right;
    font-family: 'Arial'; 
    font-size: 100%;   
    vertical-align: middle;
    border-collapse: collapse; 
    border: 1px solid black;
    padding: 5px 5px 5px 5px;
    color: blue;

}

.alldatarows {
    text-align: right;
    font-family: 'Arial'; 
    font-size: 100%;   
    vertical-align: middle;
    border-collapse: collapse; 
    border: 1px solid black;
    padding: 15px 15px 5px 5px;
}

.alldatacols {
    border-collapse: collapse; 
    border: 1px solid black;
    }

@page {
/* Landscape orientation */
size: ledger landscape;

/* Put page numbers in the top right corner of each
   page in the pdf document. */
@bottom-right {
 content: "Page " counter(page) "of " counter(pages);
}
   margin-top:3cm;
   margin-left:2.54cm;
   margin-right:2.54cm;
   margin-bottom:3cm; 
}

Main Visual Formce Page - PROD_UW_AccountSummary







 
Hi everyone,
I've got some issues using data loader from the command line.
I follow all steps described in the data loader guide and the procedure works fine!
Now I 'd like to set up the config.properties file to avoid inserting every time the infos of endpoint, password and username.
I 've created the properties file in this way 
#Loader Config
#Thu Sep 10 09:37:47 PDT 2009
sfdc.endpoint=https://login.salesforce.com
sfdc.username=xxx@yyyy.it.dev
process.encryptionKeyFile=C:\Program Files (x86)\salesforce.com\data loader\bin\password.txt
sfdc.password=7c70f134b4e7542523a22faf15569753671ea416756a75db
but when I throw the process in command line I receive  the following error
2016-10-14 17:25:39,951 INFO  [main] controller.Controller initLog (Controller.java:389) - Using built-in logging configuration, no log-conf.xml in C:\Program Files (x86)\salesforce.com\Data Loader\bin\log-conf.xml
2016-10-14 17:25:39,967 INFO  [main] controller.Controller initLog (Controller.java:391) - The log has been initialized
2016-10-14 17:25:39,967 INFO  [main] process.ProcessConfig getBeanFactory (ProcessConfig.java:104) - Loading process configuration from config file: C:\Program Files (x86)\salesforce.com\Data Loader\bin\..\samples\conf\process-conf.xml
2016-10-14 17:25:40,139 INFO  [main] support.AbstractApplicationContext prepareRefresh (AbstractApplicationContext.java:495) - Refreshing org.springframework.context.support.FileSystemXmlApplicationContext@a30797: startup date [Fri Oct 14 17:25:40 CEST 2016]; root of context hierarchy
2016-10-14 17:25:40,233 INFO  [main] xml.XmlBeanDefinitionReader loadBeanDefinitions (XmlBeanDefinitionReader.java:315) - Loading XML bean definitions from file [C:\Program Files (x86)\salesforce.com\Data Loader\bin\..\samples\conf\process-conf.xml]
2016-10-14 17:25:40,311 INFO  [main] support.DefaultListableBeanFactory preInstantiateSingletons (DefaultListableBeanFactory.java:557) - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@6e2eef: defining beans [ANTAW01F_Upsert]; root of factory hierarchy
2016-10-14 17:25:40,451 INFO  [ANTAW01F_Upsert] controller.Controller initConfig (Controller.java:327) - config dir created at C:\Program Files (x86)\salesforce.com\Data Loader\bin\..\samples\conf
2016-10-14 17:25:40,467 ERROR [ANTAW01F_Upsert] config.Config initEncryption (Config.java:756) - Error initializing encryption for key file C:Program Files (x86)salesforce.comdata loaderbinpassword.txt: Cannot Access Key File: C:Program Files (x86)salesforce.comdata loaderbinpassword.txt
2016-10-14 17:25:40,467 FATAL [ANTAW01F_Upsert] process.ProcessRunner topLevelError (ProcessRunner.java:238) - Unable to run process ANTAW01F_Upsert
java.lang.RuntimeException: com.salesforce.dataloader.exception.ControllerInitializationException: Error loading config file: C:\Program Files (x86)\salesforce.com\Data Loader\bin\..\samples\conf\config.properties.  Please make sure that it exists and is readable
	at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:112)
	at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:100)
	at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.java:253)
Caused by: com.salesforce.dataloader.exception.ControllerInitializationException: Error loading config file: C:\Program Files (x86)\salesforce.com\Data Loader\bin\..\samples\conf\config.properties.  Please make sure that it exists and is readable
	at com.salesforce.dataloader.controller.Controller.initConfig(Controller.java:360)
	at com.salesforce.dataloader.controller.Controller.<init>(Controller.java:110)
	at com.salesforce.dataloader.controller.Controller.getInstance(Controller.java:212)
	at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:110)
	... 2 more
I 've put the config.properties file in samples folder ( in data loader directory) and I checked many times it exists and it's readable!
Like I said before storing this information in process-conf.xml (without using config.properties file) the procedure works perfectly, so I'm asking where Am I wrong??
Any ideas?
Thanks in advace.
Alex

 
Hi,

There is an standard object called File. If i want to import and export files in the file object using data loader i cannot do it because File object is not there in the list in Data Loader. Please tell me how to export and import files.
Is there any method to export the attacments of custom object?
I am uploading word document in Document folder and trying to get that document information and displaying on visualforce page. Not able to do.
Please share ideas

Thanks in advance.

Venkat.
  • April 07, 2016
  • Like
  • 0
Hello
I found out that the file storage for attachments reached 95%. When I talked to users, they want to keep all the files for compliance puporse.

Do you have any suggestion on how I can mass download (15000) files from attachments and store in local share drive.

I can write code, do not have approval to buy anything

Thanks