• Nitin Wader 21
  • NEWBIE
  • 55 Points
  • Member since 2016
  • CRM Manager
  • Ambuja Cements Ltd [LafargeHolcim]

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 19
    Replies
Hi,

I just deployed my first VF page and associated Apex Class. The validation and deployment were all successful and if I open the developer console in the live org I can see the VF page and APEX class and test class. When I go to the Account Page layout though in the live org to add the VF page there is no option for VisualForce Pages. It's all working fine and displaying in the Sandbox.
The page simply gets all of the open opportunities for accounts where the Parent Account is equal to the account that is currently being displayed.
This is my code that is working in the Sandbox

VF Page:
<apex:page sidebar="false" showHeader="false" Controller="ChildOpportunitiesAP">
   <apex:form >
          <apex:pageBlock title="Open child opportunities" id="pb"> 
              Filter:
              <apex:selectList value="{! selectListValue }" size="1">
                  <apex:selectOptions value="{!availableFilters}"/>
                  <apex:actionSupport event="onchange" action="{!refresh}" reRender="pb"/>
              </apex:selectList>
          <apex:pageBlockTable value="{!RelatedOpportunities}" var="opp">
              <apex:column >
                  <apex:facet name="header"> 
                      <apex:commandLink action="{!sortByAccountName}"
                                    reRender="pb">Account Name
                      </apex:commandLink>
                  </apex:facet>    
                     <apex:outputLink value="/{! opp.Account.id}" target="_top">
                                {!opp.Account.Name}
                     </apex:outputLink>     
               </apex:column>
              <!--<apex:column value="{! opp.Account.Name}" >
                  <apex:facet name="header"> 
                      <apex:commandLink action="{!sortByAccountName}"
                                    reRender="pb">Account Name
                      </apex:commandLink>
                  </apex:facet>        
               </apex:column>-->
              <apex:column >
                  <apex:facet name="header"> 
                      <apex:commandLink action="{!sortByOpportunityName}"
                                    reRender="pb">Opportunity Name
                      </apex:commandLink>
                  </apex:facet>    
                     <apex:outputLink value="/{! opp.id}" target="_top">
                                {!opp.Name}
                     </apex:outputLink>     
               </apex:column>
              <!--<apex:column value="{! opp.Name}">
                  <apex:facet name="header">
                  <apex:commandLink action="{!sortByOpportunityName}"
                                    reRender="pb">Opportunity Name
                      </apex:commandLink>
                  </apex:facet>
              </apex:column>-->
              <apex:column value="{! opp.Total_Opportunity_Amount__c}">
                  <apex:facet name="header">
                  <apex:commandLink action="{!sortByAmount}"
                                    reRender="pb">Total Opportunity Amount
                      </apex:commandLink>
                  </apex:facet>
              </apex:column>
              <apex:column value="{! opp.StageName}">
                  <apex:facet name="header">
                  <apex:commandLink action="{!sortByStage}"
                                    reRender="pb">Stage
                      </apex:commandLink>
                  </apex:facet>
              </apex:column>
          </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>

APEX page:

public with sharing class ChildOpportunitiesAP {
    private id Parent_Acc_Id;
    Public Integer noOfRecords{Get;Set;}
    Public Integer size {get;Set;}
    public String selectListValue{get;Set;}
    private String sortColumn = 'Name';
    private String previousSortColumn = null;
    private String sortOrder = 'ASC';
     
          public ApexPages.StandardSetController controller {
                    get{
                 Parent_Acc_Id = ApexPages.currentPage().getparameters().get('id');
                        system.debug('ChildOpps-Test:' + Parent_Acc_Id);
                        if(controller == null){
                            system.debug('ChildOpps-Test-2');
                            size = 4;
                            string queryString = '';
                             system.debug(' Before query - Sort order = ' + sortColumn);
                            if (selectListValue == 'All') {
                                system.debug('ChildOpps-Test-3');
                                queryString = 'SELECT Account.Name, Name, Total_Opportunity_Amount__c, StageName ' +
                                ' FROM Opportunity WHERE Account.Parent.id=: Parent_Acc_Id AND IsWon = False ORDER BY ' + sortColumn + ' ' + sortOrder;
                            }
                            else {
                                system.debug('ChildOpps-Test-4');
                                queryString = 'SELECT Account.Name, Name, Total_Opportunity_Amount__c, StageName ' +
                                ' FROM Opportunity WHERE Account.Parent.id=: Parent_Acc_Id AND IsWon = False AND Name =: selectListValue ORDER BY ' + sortColumn + ' ' + sortOrder ;
                            }
                            system.debug(queryString);
                            system.debug(Parent_Acc_Id);
                                 controller = new ApexPages.StandardSetController(Database.getQueryLocator(queryString));
                        controller.setPageSize(size);
                            noOfRecords = controller.getResultSize();
             }
             return controller;                              
            }set;
        }
    
    public ChildOpportunitiesAP() {
        selectListValue = 'All';
    }
    
        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>();
        List<Opportunity> availableOpps = new List<Opportunity>();
        availableOpps = [SELECT Account.Name, Name, Total_Opportunity_Amount__c, StageName FROM Opportunity WHERE IsWon = False AND Account.Parent.id=: Parent_Acc_Id];
        options.add(new SelectOption('All','All'));
        
        Set<Id> accountIdSet = new Set<Id>();
        for (Opportunity opp:availableOpps){
            if(!accountIdSet.contains(opp.accountID)) {
                options.add(new SelectOption(opp.AccountId, opp.Account.Name));
                accountIdSet.add(opp.AccountId);
            }
        }
        return options;
    }
    
    Public pageReference getFilteredOpportunities(){
        /*getRelatedOpportunities();*/
        controller.setPageNumber(1);
        return Null;
    }
    
    public pageReference sortByAccountName() {
        setSortOrder('Account.Name');
        return Refresh();
    }
    
    public pageReference sortByOpportunityName(){
        setSortOrder('Name');
         return Refresh();
    }
    
    public pageReference sortByAmount(){
        setSortOrder('Total_Opportunity_Amount__C');
        return Refresh();
    }
      
    public pageReference sortByStage() {
        setSortOrder('StageName');
        return Refresh();
    }
    
    private void setSortOrder(string columnName){
        sortColumn = columnName;
        if (previousSortColumn == sortColumn){
            sortOrder = 'DESC';
            previousSortColumn = null;
        }
        else{
            previousSortColumn = sortColumn;
            sortOrder = 'ASC';
        }        
    }
}

Could you someone offer some advice please

Thanks
<apex:page id="pg" sidebar="false" showHeader="false" standardStylesheets="false" applyHtmlTag="false" 
    controller="MultipleSalarySlips" renderAs="{!if(isRender == true, "PDF", '')}">
    <html>
        <head>
        </head>
    <apex:form id="frm">
        <table style = "margin-left: 560px;border: 2px solid;padding: 19px;border-radius:5px;background-color:#f1d1bf;display:{!if(isRender == true, 'None','')}" id = "firstTable">
            <!--Table 1 code-->
        </table>
        

        <table style="width:100%;margin-top: 50px;border-collapse: collapse;page-break-after:always;">
                  <!--Table 2 code with repeate-->
        </table>
public with sharing class MultipleSalarySlips {
    public String selectedToMonth{get;set;}
    public String selectedFromMonth{get;set;}
    public String selectedToYear{get;set;}
    public String selectedFromYear{get;set;}
    public List<Monthly_Salary_Details__c> monthlySalaryDetails{get;set;}
    public List<WrpSalaryDetail> wrpSalaryDetails{get;set;}
    public Monthly_Salary_Details__c msd{get;set;}
    public Boolean isRender{get;set;}
    public static Integer iq = 1;
    
    public MultipleSalarySlips(){
        wrpSalaryDetails = new List<WrpSalaryDetail>();
        msd = new Monthly_Salary_Details__c();
        isRender = false;
    }


Hi,
I am facing very unusual and silly issue. I have a vf page with render as pdf based on a condition. The page contains two tables. I am hiding first table conditionally so that second table can generate with proper pdf format. Here is what should happen: On button click of first table a new tab should open and first table should be hidden and second table should be visible in pdf format. What happens is a new tab opens but first table does not get hidden as the condition (isRender remains false) remains true. Above is the code for more understanding.

 
HI 

Can anyone help me out qurerying how many sharing rules and public groups assigned to a particular Role?
We have a roll-up summary field on the opportunity to Summarize opportunity line items list price after the discount and it's not calculating automatically until unless we edit and save all line items(Dummy Update).
Is there any worked around for this issue ?
Hi Experts,

I created a class to insert Account List Item Record for every Affiliation child record. 

Here is the code, and it's working in a single record, but when I executed the code manual in developer console I got an error message: 
Error message

Here is my code below: I think I need to use map but I'm just new and still confused on using map.
 
public with sharing class Eisai_InsertAccListItem_cls {
    
    List<Affiliation_vod__c> affChildRecsList;
    List<Account_List_vod__c> acctListInDb;
    List<Account_List_Item_vod__c> newAccListItem = new List<Account_List_Item_vod__c>();
    Set<Id>usersIdSet = new Set<Id>();
    
    public Eisai_InsertAccListItem_cls(){
        
        affChildRecsList = new List<Affiliation_vod__c>([SELECT Id, From_Account_vod__c, To_Account_Value__c, OwnerId
                                                         FROM Affiliation_vod__c 
                                                         WHERE Parent_vod__c = False
                                                         AND OwnerId IN :ActiveUsers()]);
        
            System.debug('Child Affiliation Records count ' + affChildRecsList.size()); 
        
        
        acctListInDb = new List<Account_List_vod__c>([Select Id, Name, OwnerId FROM Account_List_vod__c 
                                                      WHERE OwnerId IN :ActiveUsers()]);
        
            System.debug('Account List Records count ' + acctListInDb.size());
        
        
        
        for(Affiliation_vod__c affChild : affChildRecsList){
            for(Account_List_vod__c acctList : acctListInDb){
               if((acctList.Name.substring(3) == affChild.To_Account_Value__c)
                  && (affChild.OwnerId == acctList.OwnerId)){
                       Account_List_Item_vod__c AccListItem = new Account_List_Item_vod__c();
                       AccListItem.Account_List_vod__c = acctList.Id;
                       AccListItem.Account_vod__c = affChild.From_Account_vod__c;
                       newAccListItem.add(AccListItem);
                 }
             }
         }
   
        
        try{        
            insert newAccListItem ;
            System.debug('New Account List Item Records: ' + newAccListItem);
        }catch(DMLException e){
            System.debug('exeption catch ' + e.getMessage()); 
        }
        
        
    }//End of Constructor   
    
    public Set<Id> ActiveUsers(){
        
       List<User> usersIdList;
        
        usersIdList = new List<User>([SELECT Id
                                      FROM User
                                      WHERE (Profile_Name_vod__c LIKE '%Eisai_Epilepsy%' 
                                      OR Profile_Name_vod__c LIKE '%Eisai_PrimaryCare%') 
                                      AND IsActive = TRUE]); 
        
        for(User users : usersIdList){
            usersIdSet.add(users.Id);  
        }
        return usersIdSet;
    }
    
} //End of Class

Thanks for the help in advance
Hello,
I am trying to import volunteer hours in Volunteers for Salesforce app.
When importing data via the Wizard, I get the following error FIELD_CUSTOM_VALIDATION_EXCEPTION:Please specify a Status value.:GW_Volunteers__Status__c --"
Status is included in the file but it seems that SF does not recognize it?
Please help
User-added image
User-added image
want to create a forumal filed witht the below logicet 

Represents Days,Hours 
Calculates the total duration of time since the record create time till now or till Closed Won/Lost time , with counting the weekend days friday and saturday on working days
Hi All,

I'm a bit confused on this. if we have a standard user profile with (CRED) on all objects and OWD set for private (let's say on Opportunity object)

Will the standard user be able to CRED on any opportunity record (owned or not-owned)? or will they have zero access to opportunity records they do not own?

I was under the impression that the user will have zero access to CRED any records they do not own. Unless permitted by role hierachy or sharing rules.

Thanks alot everyone

Pedro
Hi,
Created field in Account Object,
1.Distributor Discount Product

 Created formula field in Quote Object,
1.Distributor Product Discount

Scenario :
If i enter the values in account field, it automatically update in Quote Object  for  OPEN Opportunity . 

I Try the Code:(i dont know what have to give in ELSE part )
IF( !ISPICKVAL( Opportunity.StageName ,'6. Closed/Won - PO at Disti') || ISPICKVAL( Opportunity.StageName ,'Closed Lost') || ISPICKVAL( Opportunity.StageName ,'Closed Invalid') ,  Opportunity.Distributor__r.Distributor_Discount_Product__c,  )

Else part: It Contains the Last modified value(Distributor Discount Product )account object.

For Example:
1.I enter the Value for  Distributor Discount Product in account Object = 24
   It automatically update the value Distributor Product Discount in Quote Object (For Open Opportunity) =24

2.I again enter the Value for  Distributor Discount Product in account Object = 50
   It should not update the value Distributor Product Discount in Quote Object (For close Opportunity) =24 (Not 50) - I need Only Existing Value (24).

Thanks
Sivapriyaa M S
Hello Experts,

Need your inputs on how we can assign particular records created by this trigger to specific user. Say the record "Website Audit Report and Recommendations" will be assign to User A and the record "Optimize keywords in footer links" will be assign to User B. 

=================================================

trigger AutoCreateProductionTask on SFDC_Project__c (after insert) {

   List<Production_Task__c> newRecord = new List<Production_Task__c>(); 

   List<String> namePT = new List<String>();
   namePT.add('Website Audit Report and Recommendations');
   namePT.add('Keyword Research');
   namePT.add('Competitor Research');
   namePT.add('Run page speed loading test and make improvements');
   namePT.add('Run site on validator and fix broken links and html errors');
   namePT.add('Run crawl test and redirect any obsolete urls');
   namePT.add('Keyword mapping, meta data creation and implementation');
   namePT.add('Text content creation');
   namePT.add('Upload optimized text content, insert and highlight ketwords');
   namePT.add('Optimize keywords in footer links');
   namePT.add('Optimize alt tags of images');
   namePT.add('Create or improve HTML sitemap page');
   namePT.add('Add breadcrumbs navigation on inner pages');
   namePT.add('Create Google Places listing');
   namePT.add('URL and Directory Submission');
   namePT.add('Create Google Webmaster Tools profile');
   namePT.add('Create Google Analytics profile');
   namePT.add('Create Google Analytics Contact Forms Goal Setup');
   namePT.add('Add in AI Directory');   
   namePT.add('Create and submit xml sitemap to Google');
   namePT.add('Create and publish 1 Press Release');
   
    for (SFDC_Project__c aim : Trigger.new) {
        
        if (aim.RecordTypeID == Schema.SObjectType.SFDC_Project__c.getRecordTypeInfosByName().get('AIM Project').getRecordTypeId())
        if (aim.Product_Service__c == 'SEO - Premium'|| aim.Product_Service__c == 'SEO - Pro'|| aim.Product_Service__c == 'SEO - Starter'|| aim.Product_Service__c == 'SEO - Plus')
        
                {

          for(Integer i = 0; i < namePT.size(); i++){
            
            Production_Task__c aimTask = new Production_Task__c();
            aimTask.recordTypeId = Schema.SObjectType.Production_Task__c.getRecordTypeInfosByName().get('AIM').getRecordTypeId();
            aimTask.Name = namePT [i];
            aimTask.Due_Date__c = Date.today().addDays(30);
            aimTask.Project__c = aim.Id;
            aimTask.Instructions__c = 'test';
            
                newRecord.add(aimTask);   
            
           }
           }
            insert newRecord;
   }
   }

=================================================

Any assistance is highly appreciated. Thank you. 

Hi ,

 

     I am confused between synchronous and asynchronous can any one explain me from the scratch what are they actually , and when we use the @future annotation . Please Help me  !!!

 

 

Help is highly appreciated.

 

Thanks in Advance. 

  • June 22, 2013
  • Like
  • 2