108 lines
3.1 KiB
OpenEdge ABL
108 lines
3.1 KiB
OpenEdge ABL
public class addController {
|
|
|
|
public List<Account> AccountsList {get; set;}
|
|
|
|
|
|
public string FirstName { set; get; }
|
|
public String LastName { set; get; }
|
|
public String Email { set; get; }
|
|
public String Phone { set; get; }
|
|
public string OpportunityName { set; get; }
|
|
public string StageName { set; get; }
|
|
public string Amount { set; get; }
|
|
public string CloseDate { set; get; }
|
|
public Boolean disabl {set;get; }
|
|
public Boolean Choice1{set;get;}
|
|
public Boolean Choice2{set;get;}
|
|
|
|
Opportunity opp=new Opportunity();
|
|
Contact con = new Contact();
|
|
|
|
//collecting the records from account and opportunity
|
|
|
|
public addController() {
|
|
AccountsList =[SELECT Id,Name,Industry FROM Account];
|
|
disabl=true;
|
|
}
|
|
|
|
|
|
|
|
|
|
// validation for contact
|
|
|
|
|
|
public void change(){
|
|
System.debug('Change is Running now');
|
|
if (String.isNotBlank(FirstName) && String.isNotBlank(LastName) && String.isNotBlank(Email) && String.isNotBlank(Phone)){
|
|
disabl = false; // If all fields are filled, enable the submit button
|
|
} else {
|
|
disabl = true; // If any field is empty, disable the submit button
|
|
}
|
|
}
|
|
|
|
// Save button validation for opp form
|
|
public void change1(){
|
|
System.debug('Change is Running now');
|
|
if (String.isNotBlank(OpportunityName) && String.isNotBlank(StageName) && String.isNotBlank(CloseDate) && String.isNotBlank(Amount)){
|
|
disabl = false; // If all fields are filled, enable the submit button
|
|
} else {
|
|
disabl = true; // If any field is empty, disable the submit button
|
|
}
|
|
}
|
|
|
|
|
|
//saving into contact
|
|
|
|
public void insertCon(){
|
|
try {
|
|
con.FirstName = FirstName;
|
|
con.LastName = LastName;
|
|
con.Email = Email;
|
|
con.Phone = Phone;
|
|
insert con;
|
|
} catch (Exception e) {
|
|
// Handle the exception here
|
|
System.debug('Error: ' + e.getMessage());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// to insert opp
|
|
public void insertOpp(){
|
|
|
|
opp.Name=OpportunityName;
|
|
opp.CloseDate=Date.valueOf(CloseDate);
|
|
opp.Amount=Decimal.valueOf(Amount);
|
|
opp.StageName=StageName;
|
|
insert opp;
|
|
|
|
}
|
|
//to jump choice page
|
|
public PageReference Choicepage(){
|
|
PageReference pageref=new PageReference('/apex/ChoicePage');
|
|
return pageref;
|
|
}
|
|
|
|
|
|
//For Any specific form
|
|
|
|
public PageReference jump(){
|
|
system.debug('@@@@@Choice1'+Choice1);
|
|
system.debug('@@@@@Choice2'+Choice2);
|
|
if(Choice1==True && Choice2==True){
|
|
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.FATAL,'You can select Only one at a time'));
|
|
return null;
|
|
}
|
|
else if(Choice1==True){
|
|
PageReference pageref=new PageReference('/apex/ContactForm');
|
|
return pageref;
|
|
} else {
|
|
PageReference pageref=new PageReference('/apex/OpportunityForm');
|
|
return pageref;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} |