You need to sign in to do that
Don't have an account?
Geeta Vaddi
Help needed with Creating visualforce page to create 100 accounts with a button click
Hello Everyone,
I am new to salesforce and I am trying to get a salesforce internship. I was asked to solve and present the following excersice. Can someone tell me how to achieve this?
Create a visualforce page that will mass create 100 account records with a button click. Each account should randomly be assigned to a U.S. state. Visualforce page should then display the state distribution amongst all accounts visually in a table.
Extra Restrictions: Accounts can only have 5 states (business is only done in 5 states). Remove the accounts that are not in 1 of 5 states OR update those accounts with 1 of 5 states using a trigger.
I am new to salesforce and I am trying to get a salesforce internship. I was asked to solve and present the following excersice. Can someone tell me how to achieve this?
Create a visualforce page that will mass create 100 account records with a button click. Each account should randomly be assigned to a U.S. state. Visualforce page should then display the state distribution amongst all accounts visually in a table.
Extra Restrictions: Accounts can only have 5 states (business is only done in 5 states). Remove the accounts that are not in 1 of 5 states OR update those accounts with 1 of 5 states using a trigger.
controller -
make a list<string> variable with all the states in the US and if you want to change the account names, make an array for different names as well
create a for loop that will create the accounts taking names from one array and states from another. Once you have the 100 records then insert them.
You trigger should be a before insert trigger that will go through the list of Account records and change the states that do not comply with the organization and change them before inserting.
Add a button/link to the Account object (or wherever you want the button to be) that will call the VF page with a link.