• Preethi S
  • NEWBIE
  • 30 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 14
    Replies
Hi all,

I know about workflow,trigger and batchapex.....but i don't know what is the difference between that....could u please tell the difference between workflow ,trigger and batchapex...
i dont know where should i give rendered attribute to hide fields.. could u help for this?
VF page:
<apex:page controller="SuccessController1" showheader="false">
<apex:form id="file1">
<apex:pageMessages id="msg"/>
<apex:pageBlock title="CandidateInformation" mode="edit">
<apex:pageBlockSection title="Information" columns="2">
<apex:inputField value="{!cand.FirstName__c}"/>

<apex:inputField value="{!cand.LastName__c}" />


<apex:inputField value="{!cand.SSN__c}" />


<apex:inputField value="{!cand.city__c}" />


<apex:inputField value="{!cand.Phone__c}"  />
<apex:inputField value="{!cand.Email__c}"  />


<apex:commandButton action="{!save}" value="save"/>
<apex:outputPanel id="file1" rendered="{!hidefn}">
</apex:outputPanel>
</apex:pageBlockSection>
</apex:pageBlock>

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

controller:

public with sharing class SuccessController1 {
public boolean hidefn { get; set; }
    public SuccessController1() {

hidefn=false;
    }
Candidate__c cand = new Candidate__c();
Public Candidate__c getCand()
  {
 
   return Cand;
   }
  public SuccessController1(ApexPages.StandardController controller)
    {

      }
      public PageReference save()
      {
      insert cand;
      PageReference p = apexPages.currentPage();
      ApexPages.Message msg=new ApexPages.Message(ApexPages.Severity.CONFIRM,'Record Created Successfully.Thank you!');
      ApexPages.addMessage(msg);
      return p;
      }
    }

But I don't know where we have to use that "rendered "attribute in vf page...after  clicking save button i want to show  success message with blank page...
If i use that rendered attribute in input field.....that field will be hided before giving input...Anyone can help for this..
hi all,

I created a visualforce page to insert record....then If i click save button that will show success message in the same visualforce page...

this is my visualforce page

<apex:page standardController="Candidate__c" extensions="SuccessController1">
<apex:form >
<apex:pageBlock title="CandidateInformation" mode="edit">
<apex:pageBlockSection title="Information" columns="2">
<apex:inputField value="{!Candidate__c.FirstName__c}"/>
<apex:inputField value="{!Candidate__c.LastName__c}"/>
<apex:inputField value="{!Candidate__c.SSN__c}"/>
<apex:inputField value="{!Candidate__c.city__c}"/>
<apex:inputField value="{!Candidate__c.Phone__c}"/>
<apex:inputField value="{!Candidate__c.Email__c}"/>
<apex:commandButton action="{!save}" value="save"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

I created one controller to call the save method.

public with sharing class SuccessController1 {

    Candidate__c candidate = new Candidate__c();
    public SuccessController1(ApexPages.StandardController controller)
    {
 
     }
  
    public PageReference save() {

      insert candidate;
PageReference pg = new PageReference('/apex/candidate');
pg.setRedirect(true);
ApexPages.AddMessage(new ApexPages.Message(ApexPages.Severity.CONFIRM,'Record Created Successfully.Thank you!'));
return pg;
   }
   }


But the record is not inserted. it shows insertion failed error message.. can u help me for this?
hi all,

Can u tell about sytem.test.starttest and stop test.
If we didn't include that line in test class..what will happened?

Hi all,

I have to create one Opportunity record.When I create that record the another record will be created automatically by using triggers.

This is my code. this is not working properly. It shows null pointer exception...Can u tell about this?

trigger OpprtunityInsertion on Opportunity (after insert) {
List<Opportunity> listOfOpportunities = new List<Opportunity>();
for(Opportunity op : Trigger.new)
{
if(op.StageName == 'Closed Won')
{
Opportunity o= new Opportunity();
o.Name = 'Cloned'+op.Name;
o.StageName=op.StageName+'Cloned';
o.CloseDate=op.CloseDate.addYears(1);
listOfOpportunities.add(o);
}
}
insert listOfOpportunities;
}
Hi all,

I have doubt on this..In opportunity, If select the Account Name from account means that regarding customAccountNumber will be displayed  in that field by using triggers. can u tell me about this?

Hi all,

i am new to apexcode.. If I insert one record in opportunity that opportunity number will be displayed on account number field.  I tried these functionality by using trigger... But it shows Invalid bind expression error in line7.. Can u help me for this?

This is my trigger,

trigger OpportunityInsertion on Opportunity (after insert) {
List<Opportunity> listOfOpportunities = new List<Opportunity>();
for(Opportunity opp : Trigger.new)
{
listOfOpportunities.add(opp);
}
List<Account> accnt= [SELECT CustomAccountNumber__c FROM Account WHERE Id IN:listOfOpportunities];
List<Account> acc = new List<Account>();
for(Opportunity op : listOfOpportunities)
{
for(Account a: accnt)
{
if(a.Name == op.AccountName)
{
a.CustomAccountNumber__c = op.CustomOpportunityNumber__c;
}
acc.add(a);
}
update acc;
}
}
I need to save image in custom object when i click upload button.
Can u tell me?
Hi,
This s my scenario.
1.User click on “Upload Photo” button to attach any image with current record. It will open standard attachment page(vf page).
2.Type the path of the file or click the "Browse" button to find the file
3.Click the "Attach File" to attach that file.
4.Repeat steps 2 and 3 to attach multiple files.
5.When the upload is completed the file information will appear below.
6.Click the Done button to return to the detail view page.

I created a visualforce page but in controller part  I'm struggling.
Please tell what are steps i have to follow.
In this scenario, I created text field to save photo in custom object. how to save the image in this object field?

Hi all,

I know about workflow,trigger and batchapex.....but i don't know what is the difference between that....could u please tell the difference between workflow ,trigger and batchapex...
i dont know where should i give rendered attribute to hide fields.. could u help for this?
VF page:
<apex:page controller="SuccessController1" showheader="false">
<apex:form id="file1">
<apex:pageMessages id="msg"/>
<apex:pageBlock title="CandidateInformation" mode="edit">
<apex:pageBlockSection title="Information" columns="2">
<apex:inputField value="{!cand.FirstName__c}"/>

<apex:inputField value="{!cand.LastName__c}" />


<apex:inputField value="{!cand.SSN__c}" />


<apex:inputField value="{!cand.city__c}" />


<apex:inputField value="{!cand.Phone__c}"  />
<apex:inputField value="{!cand.Email__c}"  />


<apex:commandButton action="{!save}" value="save"/>
<apex:outputPanel id="file1" rendered="{!hidefn}">
</apex:outputPanel>
</apex:pageBlockSection>
</apex:pageBlock>

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

controller:

public with sharing class SuccessController1 {
public boolean hidefn { get; set; }
    public SuccessController1() {

hidefn=false;
    }
Candidate__c cand = new Candidate__c();
Public Candidate__c getCand()
  {
 
   return Cand;
   }
  public SuccessController1(ApexPages.StandardController controller)
    {

      }
      public PageReference save()
      {
      insert cand;
      PageReference p = apexPages.currentPage();
      ApexPages.Message msg=new ApexPages.Message(ApexPages.Severity.CONFIRM,'Record Created Successfully.Thank you!');
      ApexPages.addMessage(msg);
      return p;
      }
    }

But I don't know where we have to use that "rendered "attribute in vf page...after  clicking save button i want to show  success message with blank page...
If i use that rendered attribute in input field.....that field will be hided before giving input...Anyone can help for this..
hi all,

I created a visualforce page to insert record....then If i click save button that will show success message in the same visualforce page...

this is my visualforce page

<apex:page standardController="Candidate__c" extensions="SuccessController1">
<apex:form >
<apex:pageBlock title="CandidateInformation" mode="edit">
<apex:pageBlockSection title="Information" columns="2">
<apex:inputField value="{!Candidate__c.FirstName__c}"/>
<apex:inputField value="{!Candidate__c.LastName__c}"/>
<apex:inputField value="{!Candidate__c.SSN__c}"/>
<apex:inputField value="{!Candidate__c.city__c}"/>
<apex:inputField value="{!Candidate__c.Phone__c}"/>
<apex:inputField value="{!Candidate__c.Email__c}"/>
<apex:commandButton action="{!save}" value="save"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

I created one controller to call the save method.

public with sharing class SuccessController1 {

    Candidate__c candidate = new Candidate__c();
    public SuccessController1(ApexPages.StandardController controller)
    {
 
     }
  
    public PageReference save() {

      insert candidate;
PageReference pg = new PageReference('/apex/candidate');
pg.setRedirect(true);
ApexPages.AddMessage(new ApexPages.Message(ApexPages.Severity.CONFIRM,'Record Created Successfully.Thank you!'));
return pg;
   }
   }


But the record is not inserted. it shows insertion failed error message.. can u help me for this?
hi all,

Can u tell about sytem.test.starttest and stop test.
If we didn't include that line in test class..what will happened?

Hi all,

I have to create one Opportunity record.When I create that record the another record will be created automatically by using triggers.

This is my code. this is not working properly. It shows null pointer exception...Can u tell about this?

trigger OpprtunityInsertion on Opportunity (after insert) {
List<Opportunity> listOfOpportunities = new List<Opportunity>();
for(Opportunity op : Trigger.new)
{
if(op.StageName == 'Closed Won')
{
Opportunity o= new Opportunity();
o.Name = 'Cloned'+op.Name;
o.StageName=op.StageName+'Cloned';
o.CloseDate=op.CloseDate.addYears(1);
listOfOpportunities.add(o);
}
}
insert listOfOpportunities;
}
Hi all,

i am new to apexcode.. If I insert one record in opportunity that opportunity number will be displayed on account number field.  I tried these functionality by using trigger... But it shows Invalid bind expression error in line7.. Can u help me for this?

This is my trigger,

trigger OpportunityInsertion on Opportunity (after insert) {
List<Opportunity> listOfOpportunities = new List<Opportunity>();
for(Opportunity opp : Trigger.new)
{
listOfOpportunities.add(opp);
}
List<Account> accnt= [SELECT CustomAccountNumber__c FROM Account WHERE Id IN:listOfOpportunities];
List<Account> acc = new List<Account>();
for(Opportunity op : listOfOpportunities)
{
for(Account a: accnt)
{
if(a.Name == op.AccountName)
{
a.CustomAccountNumber__c = op.CustomOpportunityNumber__c;
}
acc.add(a);
}
update acc;
}
}
I need to save image in custom object when i click upload button.
Can u tell me?