• Naveen Velkur 6
  • NEWBIE
  • 10 Points
  • Member since 2023

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 2
    Replies
VF button is not appearing on all forms, a custom button is appearing only on one form, rather than all forms.  
public class ShowroomDetail_Ctl {
    public Showroom_Request__c recShowroom {get;set;}
    public List<Sales_Order__c> lstSalesOrders {get;set;}
    public Map<Id,List<Transaction__c>> mapTransactions {get;set;}
    public Map<Id,List<Transaction_Line__c>> mapTransactionLines {get;set;}

    public ShowroomDetail_Ctl(ApexPages.StandardController controller){
        recShowroom = new Showroom_Request__c();
        lstSalesOrders = new List<Sales_Order__c>();
        mapTransactions = new Map<Id,List<Transaction__c>>();
        mapTransactionLines = new Map<Id,List<Transaction_Line__c>>();
       
        String showroomId = ApexPages.currentpage().getparameters().get('id');
        System.debug('showroomId : '+showroomId);
        Set<String> setOfOrder = new Set<String>();
        if(showroomId != null && showroomId.length() >= 15){
            recShowroom = [SELECT Id,Name,Order_Number_1_BH__c,Order_Number_2_BH__c ,Order_Number_3_BH__c ,Order_Number_4_BH__c,
                              Order_Number_5_BH__c,Order_Number_6_BH__c,Order_Number_7_BH__c,Order_Number_8_BH__c ,Order_Number_9_BH__c,
                              Order_Number_10_BH__c,Order_Number_1_BSD__c,Order_Number_2_BSD__c,Order_Number_3_BSD__c,Order_Number_4_BSD__c 
                              FROM Showroom_Request__c WHERE Id =: showroomId];
            if(recShowroom.Id != null){
                System.debug('Id : '+showroomId);
                setOfOrder.add(recShowroom.Order_Number_1_BH__c);
                setOfOrder.add(recShowroom.Order_Number_2_BH__c);
                setOfOrder.add(recShowroom.Order_Number_3_BH__c);
                setOfOrder.add(recShowroom.Order_Number_4_BH__c);
                setOfOrder.add(recShowroom.Order_Number_5_BH__c);
                setOfOrder.add(recShowroom.Order_Number_6_BH__c);
                setOfOrder.add(recShowroom.Order_Number_7_BH__c);
                setOfOrder.add(recShowroom.Order_Number_8_BH__c);
                setOfOrder.add(recShowroom.Order_Number_9_BH__c);
                setOfOrder.add(recShowroom.Order_Number_10_BH__c);
                
                setOfOrder.add(recShowroom.Order_Number_1_BSD__c);
                setOfOrder.add(recShowroom.Order_Number_2_BSD__c);
                setOfOrder.add(recShowroom.Order_Number_3_BSD__c);
                setOfOrder.add(recShowroom.Order_Number_4_BSD__c);
            }
            
            Set<Id> setOfSOIds = new Set<Id>();
            for(Sales_Order__c eachSO : [SELECT Id,Name,(SELECT Id,Name,Sales_Order__c FROM SalesOrder__r) FROM Sales_Order__c WHERE Name IN: setOfOrder AND Name != null]){
                lstSalesOrders.add(eachSO);
                if(eachSO.SalesOrder__r != null && eachSO.SalesOrder__r.size() > 0)
                mapTransactions.put(eachSO.Id,eachSO.SalesOrder__r);
                
                setOfSOIds.add(eachSO.Id);
            }
            System.debug('mapTransactions : '+mapTransactions);
            for(Transaction__c eachTran : [SELECT Id,Name,Sales_Order__c,(SELECT Id,Name FROM Invoice_Lines__r) FROM Transaction__c WHERE Sales_Order__c IN: setOfSOIds AND Sales_Order__c != null]){
                if(eachTran.Invoice_Lines__r != null && eachTran.Invoice_Lines__r.size() > 0)
                mapTransactionLines.put(eachTran.Sales_Order__c,eachTran.Invoice_Lines__r);
            }
           
        }
    }
}
 <apex:form>
        <apex:pageBlock title="Purchase Order" >
            <apex:pageBlockTable value="Transaction">
                <apex:column headerValue="Name" value="Name" />
              <apex:column headerValue="Product" value="Product__c" />
                <apex:column headerValue="Qty" value="Qty_Sold__c" />
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
trigger BlockCaseDeletion on Case (before delete) {
for (Case c : Trigger.old) {
        // Prevent deletion of cases
        c.addError('Cases cannot be deleted.');
    }
}
what is the formula to display only checked boxes, i have  check box fields Red,Green,Orange,Yellow, Violet  in the form, User have checked Red, Green and Orange leaving others unchecked. What is the formula to display checked boxes in the Merge Fields?
We are using a Visual force page which generate pdf document , merge fields retrieve all the check box fields, requirement is "only selected check box Fields" needs to appear not all the check boxes like yes or no. 
Is there any solution to show only selected checkboxes, not all in the pdf document?
trigger CountContacts on Contact (after insert, after delete) {
List<Account> addAccCount= new List<Account>();
    Set<Id> addConId= new Set<Id>();
if(trigger.isInsert){
for(Contact con:trigger.new){
addConId.add(con.AccountId);
}
}
if(trigger.isDelete){
for(Contact con:trigger.old){
addConId.add(con.AccountId);
}
}
List<Account> accList=[SELECT Id,CountofContacts__c, (SELECT Id FROM Contacts) FROM Account WHERE Id in: addConId];
for(Account acc:accList){
acc.CountofContacts__c = acc.Contacts.size();
addAccCount.add(acc);
}
Update addAccCount;
}
if(trigger.isDelete){
for(Contact con:trigger.old){
addConId.add(con.AccountId);
}
}
List<Account> accList=[SELECT Id,CountofContacts__c, (SELECT Id FROM Contacts) FROM Account WHERE Id in: addConId];
for(Account acc:accList){
acc.CountofContacts__c = acc.Contacts.size();
addAccCount.add(acc);
}
Update addAccCount;
}
VF button is not appearing on all forms, a custom button is appearing only on one form, rather than all forms.  
 <apex:form>
        <apex:pageBlock title="Purchase Order" >
            <apex:pageBlockTable value="Transaction">
                <apex:column headerValue="Name" value="Name" />
              <apex:column headerValue="Product" value="Product__c" />
                <apex:column headerValue="Qty" value="Qty_Sold__c" />
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>