• Mohd Rais
  • NEWBIE
  • 45 Points
  • Member since 2018

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 10
    Replies
Visual Page:
<li><a href="" onclick="getProduct('{!fa.Family}'); return false;">{!fa.Family}</a></li>
<apex:actionFunction action="{!searchByFamily}" name="getProductFamily" >
           <apex:param name="family" value="" assignTo="{!family}" />
 </apex:actionFunction>
  <script>
  function getProduct(family)
         {
               getProductFamily(family);
         }
    </script>

Controller:
public string family { get;set;}
 public void searchByFamily(){ 
         System.debug(family);
            string searchquery='select ProductCode,Name,ImageName__c,(Select UnitPrice,Pricebook2.Name From PricebookEntries where IsActive=True)  from Product2 where Family=:family '; 
            MyProducts= Database.query(searchquery); 
     }

Log debug:
04:27:26.0 (32330563)|USER_DEBUG|[98]|DEBUG|null

Why actionFuntion can't send parameter?
How to display multi-picklist values as checkboxesin lightning component
Trigger
 
trigger CreateRecord on Deal__c (after insert, after update) 
{
set<id> triggerIds = trigger.newMap.keyset();
List <Project__c> Project = [select id, Name, Deal__r.Property__r.Name from Project__c where id in :triggerIds];

List <Project__c> projectsForInsert = new List<Project__c>() ;


for(Deal__c deal : [Select id, Type__c, Property__r.Name, Property__c from Deal__c where id in :triggerIds])
{
	if( deal.Type__c == 'New' ) {
		projectsForInsert.add(new Project__c
						  (
							Name = deal.Property__r.Name, // this field is giving ID instead of Name
							Property__c = deal.Property__c // This field is giving correct update.
						  )
		);
	}
}
insert projectsForInsert;
}

Test Class
 
@isTest
public class CreateNewRecordTest{
	public static testMethod void CreateNewRecordTestMethod(){
	
	Deal__c DL = new Deal__c (type__c='interested', status__c = 'Quik');
	
	Project__c Proj = new Project__c( Name = 'King size project', Deal__c = 'ultimate');
	
	insert Proj;
	}}}

 
  • December 17, 2018
  • Like
  • 0
<apex:page standardController="Companies__c" sidebar="false">

  <apex:sectionHeader title="Company Information" help="Help for this page" />
  <apex:form >
  
     <apex:pageBlock title=" cmp Information" tabStyle="Account" >
         
         
           
             <apex:pageBlockButtons > 
                       <apex:commandButton value=" Save " action="{!save}" />
                      <apex:commandButton value=" Cancel " action="{!cancel}" />
               
               
              </apex:pageBlockButtons>
       
              
      
           <apex:pageBlockSection columns="2" >
           
            <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Company Name" />
                    <apex:inputfield value="{!Companies__c.name}" /> 
                </apex:pageBlockSectionItem>
                
                
                 <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Company phone" />
                    <apex:inputText value="{!Companies__c.cmpanies_phone__c}" /> 
                </apex:pageBlockSectionItem>
                
                
          
               
            
                  
          
             
                 
                 
                
               
                 
          
           
               
               
                 
           </apex:pageBlockSection>
                  
                  
                  
                      <!--contact Information-->
                      
                      
                        <apex:pageBlockSection columns="2" title="Contact Information">
           
            <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Contact Person"/>
                    <apex:inputfield value="{!Companies__c.Contact_Person__c}" /> 
                </apex:pageBlockSectionItem>
                
                
             
                 <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Contact's Email Address" />
                    <apex:inputText value="{!Companies__c.Contact_s_Email_Address__c}" /> 
                </apex:pageBlockSectionItem>
          
               
              
     
               
                 
           </apex:pageBlockSection>
                  
                  
            
           
        
   
           
        
        
       
     
     </apex:pageBlock>
  
  </apex:form>
  
</apex:page>
  i had created a  custom filed and a custom object and i had created a visualforce page, if  i had saved the record ,it is not getting save , may i know the error in that???
  • December 17, 2018
  • Like
  • 0
public class TypeOfBusinessValidation{
    public static void validate(List<Opportunity> newList){
         List<Opportunity> oppList = new List<Opportunity>();
        Id MSORecordTypeId = Schema.SObjectType.Opportunity.getRecordTypeInfosByName().get('Managed Sales Opportunity').getRecordTypeId();
        
        Map<id,Opportunity> oppMap = new Map<id,Opportunity>();
        for(Opportunity opp : newList){
            oppMap.put(opp.id,opp);
        }
        
        List<OpportunityLineItem> oppLt=[Select id,Product2.Division__c,OpportunityId,Opportunity.Competitive_Status__c,Opportunity.Type_of_business1__c from OpportunityLineItem where Opportunity.RecordTypeId=:MSORecordTypeId and OpportunityId in :newList];
        for(OpportunityLineItem oli: oppLt){
                if(oppMap.get(oli.OpportunityId).Competitive_Status__c== 'Not Competitive' && oli.Product2.Division__c=='END USER COMPUTING'){
                    oppMap.get(oli.OpportunityId).addError('Type of Business should not be blank when Competitive status is NOT COMPETITIVE and Product Division is END USER COMPUTING');
                }
        }    
     }
}
Hi,
I have lightning components that displays images from ContentVersion as thumbnails and also links, when I click on the image its directly downloading the image but I would like it to open as preivew or open the image in a new tab/window. please advice.
below is the current line that displays image thumbnails with link to open big
<aura:iteration items="{!v.items}" var="content">
	       <a href="/sfc/servlet.shepherd/version/download/'+{!content.id}" target="_blank"> <img src="/sfc/servlet.shepherd/version/download/'+{!content.id}" width="100" height="100"/> </a>
	    </aura:iteration>

 
Visual Page:
<li><a href="" onclick="getProduct('{!fa.Family}'); return false;">{!fa.Family}</a></li>
<apex:actionFunction action="{!searchByFamily}" name="getProductFamily" >
           <apex:param name="family" value="" assignTo="{!family}" />
 </apex:actionFunction>
  <script>
  function getProduct(family)
         {
               getProductFamily(family);
         }
    </script>

Controller:
public string family { get;set;}
 public void searchByFamily(){ 
         System.debug(family);
            string searchquery='select ProductCode,Name,ImageName__c,(Select UnitPrice,Pricebook2.Name From PricebookEntries where IsActive=True)  from Product2 where Family=:family '; 
            MyProducts= Database.query(searchquery); 
     }

Log debug:
04:27:26.0 (32330563)|USER_DEBUG|[98]|DEBUG|null

Why actionFuntion can't send parameter?
I am trying write a query 
string query='select id, rating,active__c from account where active__c=' '/';
but it is showing an error 
Extra ';', at '/'.