• Sorna Jenefa
  • NEWBIE
  • 130 Points
  • Member since 2018
  • Sweet Potato Tec

  • Chatter
    Feed
  • 4
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 32
    Replies
Is there anything I can do to the difference between two dates to convert it to a number that could be used in a large calculation (multiply by an integer or a currency field) in a field update for a currency field?
DATE(2019,7,1) – DATE(2019,5,1)

This by itself, as well as in the larger formula where this difference is used to calculate a pro-rated price, gives a "Syntax Error" for a Field Update to a Currency Field
public class AccountWrapper 
{

    public List<WrapperAccounts> wrapItems{set;get;}
    public List<WrapperAccounts> wrapConItems{set;get;}
    public List<WrapperAccounts> selectedItem{set;get;}
    public List<Contact> accContacts{set;get;}
      
    public Set<Id> accId=new Set<Id>();
    public AccountWrapper()
    {
        wrapItems=new List<WrapperAccounts>();
        List<Account> accItem2=new List<Account>([SELECT Name FROM Account limit 10]);
        wrapConItems=new List<WrapperAccounts>();
        for(Account a1:accItem2)
        {    
            boolean check=false;
            wrapItems.add(new WrapperAccounts(check,a1));
            
        }
        if(accId!=null)
        {
            for(Contact cx:conwrap)
            {
                wrapConItems.add(new WrapperAccounts(false,cx));
            }
        }
        
    }
//Defining pagference to perform actionsupport onclick event
public PageReference fetch()
{
    fetchRecords();
    return null;
}
public PageReference fetchCont()
{
    fetchConRecords();
    return null;
}
//Method to define fetchRecords which will fetch Related Contacts
public void fetchRecords()
    {
     accContacts=new List<Contact>(); 
     for(WrapperAccounts wraps : wrapItems)
     {
            if(wraps.selected==true)
            {
                accId.add(wraps.accList.Id);
            }
          System.debug('Selected Accounts:'+wraps);
             
      }
            System.debug('Accounts IDs:accId='+accId); 
          
    
         List<Contact> cons=[Select Name from Contact WHERE AccountId IN:accId];
          
              for(Contact con:cons)
              {
                      
                 accContacts.add(con);  
                
             }
                  System.debug('Contacts Lists:'+accContacts);

     }
 //method to fetch contact's detail page
 public Set<Id> conId=new Set<Id>();
 public void fetchConRecords()
    {
     
     for(WrapperAccounts contwraps : wrapConItems)
     {
            if(contwraps.conSel==true)
            {
                conId.add(contwraps.contLists.Id);
            }
          System.debug('Selected Contacts:'+contwraps);
             
      }
            
          
    
         List<Contact> conx2=[Select Id from Contact WHERE Id IN:conId];
          
          System.debug('Contacts Lists in conx2:'+conx2);

     }   
       
//Wrapper Class
public class WrapperAccounts
    {
        public boolean selected{set;get;}
        public Account accList{set;get;}
        public Contact contLists{set;get;}
        public boolean conSel{set;get;}
        
        public WrapperAccounts(Boolean sel,Account acc)
        {
            this.accList=acc;
            this.selected=sel;         
        }
        public WrapperAccounts(Boolean selec,Contact co)
        {
            this.conSel=selec;
            this.contLists=co;
        }
    }
}

<apex:page controller="AccountWrapper" sidebar="false">
<apex:form >
<apex:pageBlock >
            <apex:pageBlockButtons >
            <!--<apex:commandButton value="Select" action="{!fetchRecords}" reRender="block2" rerender="block3"/>-->
            </apex:pageBlockButtons>
            <apex:pageBlockSection title="Accounts" columns="3">
            <apex:pageBlockTable value="{!wrapItems}" var="c" id="table">
                <apex:column headerValue="Select">
                   <apex:inputCheckbox value="{!c.selected}"/>
                   <apex:actionSupport event="onclick"  action="{!fetch}"/>
                </apex:column>
                <apex:column value="{!c.accList.Name}" headerValue="Account Name"/>
            </apex:pageBlockTable>
           
            
            <apex:pageBlockTable value="{!accContacts}" var="c1" id="block2">
            <apex:column headerValue="Select">
                   <!--<apex:inputCheckbox value="{!c1.conSel}"/>-->
                   <apex:actionSupport event="onclick"  action="{!fetchCont}"/>
                </apex:column>
            <apex:column value="{!c1.Name}" headerValue="Related Contacts Name"/>
            </apex:pageBlockTable>
            
            
            <apex:pageBlockTable value="{!accContacts}" var="d1" id="block3">
            <apex:column value="{!d1.Name}" headerValue="Contact Detail Page"/>
            </apex:pageBlockTable>
            </apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

 
hello everyone, i just started journey with salesforce ,
i want to do following programms in apex , help me to solve....
Factorial program
program to find HCF and LCM
program to convert decimal to binary
program to find nCr and nPr
program to add n numbers
Swap numbers program
program to reverse a number
palindrome number program.
 
Hi,

Explain about Portal,Portal User,Portal Account? with real-time examples .

Thanks,
Jenefa
Hi,

Customize Compact Layouts

Challenge not yet complete... here's what's wrong:

There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: UHKOWMOX

I have also try in new DE ...

Thanks
 
Hi all,

I'm working on this trail "Create Custom Buttons and Links". When im trying to complete my Challenge, but it occurs the following error.

There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: QPEXNNIB

Thanks in advance.
Is there anything I can do to the difference between two dates to convert it to a number that could be used in a large calculation (multiply by an integer or a currency field) in a field update for a currency field?
DATE(2019,7,1) – DATE(2019,5,1)

This by itself, as well as in the larger formula where this difference is used to calculate a pro-rated price, gives a "Syntax Error" for a Field Update to a Currency Field
Hi gus, pls i need ur help.
i create an object(house) with the checkox(available) and object (client)

The house (available) field should be set to TRUE by default.

If i did it right , i set true in the  Autom.process - Business rules 

If house has at least on prospective client, checbox(Available) must by changed to FALSE automaticaly
How can i do that?
When i search record by name or i change the pagesize or i try to delete a record by clicking the delete link no controller action gets called.
vf Page
=======================
<apex:page controller="pagination" docType="html-5.0">
  
    <apex:form >
        
        search opportunity by name:    <apex:inputText value="{!searchByString}">
                          <apex:actionSupport event="onchange" action="{!searchOpportunity}" reRender="Display"/>
                          </apex:inputText>
        
        opportunities per page:  <apex:input value="{!size}" type="number" id="number_of_days" html-step="10"  html-min="10" html-max="100"> 
                            <apex:actionSupport event="onchange" action="{!afterSizePageChange}" reRender="Display"/>
                            </apex:input>
        
            <apex:sectionHeader title="Pagination"/>
               
                  <apex:pageBlock id="Display" >
                      <apex:inlineEditSupport />
                         <apex:pageBlockButtons >
                             <apex:commandButton value="First" action="{!controller.first}" rendered="{!controller.hasprevious}" reRender="Display"/>
                             <apex:commandButton value="Previous" action="{!controller.previous}"  rendered="{!controller.hasprevious}" reRender="Display"/>
                            <apex:commandButton value="Next" action="{!controller.next}"  rendered="{!controller.hasnext}" reRender="Display"/>
                            <apex:commandButton value="Last" action="{!controller.last}"  rendered="{!controller.hasnext}" reRender="Display"/>
                  
                         </apex:pageBlockButtons>
                      
            <!-- if there is no record than show a message -->
             <apex:outputText rendered="{!IF(wrapperRecordList.size==0,'true','false')}">No Record Found </apex:outputText>
            
       <apex:pageBlockTable value="{!wrapperRecordList}" var="a" rendered="{!IF(wrapperRecordList.size>0,'true','false')}">
            <apex:column >
            <apex:facet name="header"><apex:selectCheckboxes /></apex:facet>
            <apex:selectCheckboxes value="{!a.isSelected}"/>
            </apex:column>
            
            <apex:column headervalue="Action">
                <apex:commandLink value="Delete" action="{!deleteRecord}"  reRender="Display">
                    <apex:param value="{!a.oppRecord.id}" assignTo="{!id}" />
                </apex:commandLink>
             </apex:column>
             <apex:column value="{!a.oppRecord.name}"/>
             <apex:column value="{!a.oppRecord.stagename}"/>
             <apex:column value="{!a.oppRecord.closeDate}"/>
            

        </apex:pageBlockTable><br/><br/>
    <apex:outputText rendered="{!IF(wrapperRecordList.size>0,'true','false')}">{!(controller.pageNumber * size)+1-size}-{!IF((controller.pageNumber * size)>controller.resultsize, controller.resultsize,(controller.pageNumber * size))} of {!controller.resultsize}</apex:outputText>

            </apex:pageBlock>
       
    </apex:form>
 </apex:page>
 
public class pagination {
    
    
    public  ApexPages.StandardSetController controller {set;get;} 
    public string searchByString {set;get;}
    public Integer size {set;get;}
    public string id {set;get;}

    
    public List<opportunity> optyList {set;get;}
   
    
    public List<WrapperClass> wrapperRecordList {set;get;}
    
    public pagination(){
          size=10;
         wrapperRecordList=new List<WrapperClass>();
         optyList=[select name,stagename,closeDate from opportunity order by name ASC];
        
         controller=new Apexpages.StandardSetController(optyList);
         controller.setPageSize(size);
         List<opportunity>  opty=(List<Opportunity>)controller.getRecords();
        for(opportunity op:opty)
        {
            wrapperRecordList.add(new WrapperClass(op, false));
        }
       }
    
    public void afterSizePageChange()
    {
        optyList=[select name,stagename,closeDate from Opportunity order by name ASC];
        
        controller=new Apexpages.StandardSetController(optyList);
        controller.setPageSize(size);
        
        List<opportunity>  opty=(List<Opportunity>)controller.getRecords();
        for(opportunity op:opty)
        {
            wrapperRecordList.add(new WrapperClass(op, false));
        }
    }
    public void searchOpportunity()
    {

        string  name=searchByString+'%';    
        optylist=[select name,stagename,closeDate from Opportunity where name like : name order by name ASC];
        controller=new Apexpages.StandardSetController(optyList);
        controller.setPageSize(size);
        List<opportunity>  opty=(List<Opportunity>)controller.getRecords();
        for(opportunity op:opty)
        {
            wrapperRecordList.add(new WrapperClass(op, false));
        }
    }
    
    public void deleteRecord()
    {
        
        list<opportunity> opp =[select id,name from opportunity where id =:id];
        delete opp;
        optyList=[select name,stagename,closeDate from Opportunity order by name ASC];

 
public class AccountWrapper 
{

    public List<WrapperAccounts> wrapItems{set;get;}
    public List<WrapperAccounts> wrapConItems{set;get;}
    public List<WrapperAccounts> selectedItem{set;get;}
    public List<Contact> accContacts{set;get;}
      
    public Set<Id> accId=new Set<Id>();
    public AccountWrapper()
    {
        wrapItems=new List<WrapperAccounts>();
        List<Account> accItem2=new List<Account>([SELECT Name FROM Account limit 10]);
        wrapConItems=new List<WrapperAccounts>();
        for(Account a1:accItem2)
        {    
            boolean check=false;
            wrapItems.add(new WrapperAccounts(check,a1));
            
        }
        if(accId!=null)
        {
            for(Contact cx:conwrap)
            {
                wrapConItems.add(new WrapperAccounts(false,cx));
            }
        }
        
    }
//Defining pagference to perform actionsupport onclick event
public PageReference fetch()
{
    fetchRecords();
    return null;
}
public PageReference fetchCont()
{
    fetchConRecords();
    return null;
}
//Method to define fetchRecords which will fetch Related Contacts
public void fetchRecords()
    {
     accContacts=new List<Contact>(); 
     for(WrapperAccounts wraps : wrapItems)
     {
            if(wraps.selected==true)
            {
                accId.add(wraps.accList.Id);
            }
          System.debug('Selected Accounts:'+wraps);
             
      }
            System.debug('Accounts IDs:accId='+accId); 
          
    
         List<Contact> cons=[Select Name from Contact WHERE AccountId IN:accId];
          
              for(Contact con:cons)
              {
                      
                 accContacts.add(con);  
                
             }
                  System.debug('Contacts Lists:'+accContacts);

     }
 //method to fetch contact's detail page
 public Set<Id> conId=new Set<Id>();
 public void fetchConRecords()
    {
     
     for(WrapperAccounts contwraps : wrapConItems)
     {
            if(contwraps.conSel==true)
            {
                conId.add(contwraps.contLists.Id);
            }
          System.debug('Selected Contacts:'+contwraps);
             
      }
            
          
    
         List<Contact> conx2=[Select Id from Contact WHERE Id IN:conId];
          
          System.debug('Contacts Lists in conx2:'+conx2);

     }   
       
//Wrapper Class
public class WrapperAccounts
    {
        public boolean selected{set;get;}
        public Account accList{set;get;}
        public Contact contLists{set;get;}
        public boolean conSel{set;get;}
        
        public WrapperAccounts(Boolean sel,Account acc)
        {
            this.accList=acc;
            this.selected=sel;         
        }
        public WrapperAccounts(Boolean selec,Contact co)
        {
            this.conSel=selec;
            this.contLists=co;
        }
    }
}

<apex:page controller="AccountWrapper" sidebar="false">
<apex:form >
<apex:pageBlock >
            <apex:pageBlockButtons >
            <!--<apex:commandButton value="Select" action="{!fetchRecords}" reRender="block2" rerender="block3"/>-->
            </apex:pageBlockButtons>
            <apex:pageBlockSection title="Accounts" columns="3">
            <apex:pageBlockTable value="{!wrapItems}" var="c" id="table">
                <apex:column headerValue="Select">
                   <apex:inputCheckbox value="{!c.selected}"/>
                   <apex:actionSupport event="onclick"  action="{!fetch}"/>
                </apex:column>
                <apex:column value="{!c.accList.Name}" headerValue="Account Name"/>
            </apex:pageBlockTable>
           
            
            <apex:pageBlockTable value="{!accContacts}" var="c1" id="block2">
            <apex:column headerValue="Select">
                   <!--<apex:inputCheckbox value="{!c1.conSel}"/>-->
                   <apex:actionSupport event="onclick"  action="{!fetchCont}"/>
                </apex:column>
            <apex:column value="{!c1.Name}" headerValue="Related Contacts Name"/>
            </apex:pageBlockTable>
            
            
            <apex:pageBlockTable value="{!accContacts}" var="d1" id="block3">
            <apex:column value="{!d1.Name}" headerValue="Contact Detail Page"/>
            </apex:pageBlockTable>
            </apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

 
Hi all,

I'm working on this trail "Create Custom Buttons and Links". When im trying to complete my Challenge, but it occurs the following error.

There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: QPEXNNIB

Thanks in advance.
How to display more than 15 fields in a list view on visualforce?
If i am using <apex:selectlist> or <apex:enhancedlist> I am able to build only 15 but not more than that?

 
when user select an account from the picklist, all opportunities which are related to that account should be displayed in a table with checkbox in a first column of each row, there should be one master checkbox in the header of the table to select or deselect all opportunities in one click.
I would like to convert the pages in google sites into HTML Files or upload directly into Salesforce as Articles.
Is there any API or any tool that helps me in doing this?
Any pointers related to it would be highly appreciated. 
public class SendMailController {

    public String z { get; set; }

    public String y { get; set; }

    public String x { get; set; }

    public void saveMethod() {
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        string[] xyz =new string[] {x};  
        mail.setToAddresses(xyz);
        mail.setSubject(y);
        mail.setHtmlBody(z);    
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});
    }
   
  }