



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




public class CreateAccount { public String name {get; set;} public String phoneNumber {get; set;} public String selectedname {get; set;} public String websiteURL {get; set;} public List lstnamesel {get; set;} public CreateAccount(ApexPages.StandardController controller) { lstnamesel = new List(); lstnamesel.add(new selectOption('','- None - ')); lstnamesel.add(new selectOption('IT','IT')); lstnamesel.add(new selectOption('MECH','MECH')); lstnamesel.add(new selectOption('CHEM','CHEM')); lstnamesel.add(new selectOption('PHARMA','PHARMA')); } public PageReference createAccount() { System.debug('teset create'); if(!String.isEmpty(name)) { Account accountRecord = new Account(Name = name, Phone = phoneNumber, Industry = selectedname, Website = websiteURL); INSERT accountRecord; PageReference pg = new PageReference('/'+accountRecord.Id); pg.setRedirect(true); return pg; } else { ApexPages.addmessage(new ApexPages.message(ApexPages.severity.CONFIRM,'Please enter Account Name')); } return NULL; } public PageReference cancelAccount() { PageReference pg = new PageReference('/'+Schema.SObjectType.Account.getKeyPrefix()+'/o'); return pg; } }
Step No 1: Create new org: https://developer.salesforce.com/signup Step No 2: After signup, loging using following URl https://login.salesforce.com/
Step No 5: Click on file then Select Apex class and write a code Step No 6: Select tabs section (for creating GUI)
Step No 7: Open pages
Step No 9: Program Screenshots Output