function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
bharath11rbharath11r 

Add new button in Accounts Page

Hello All,

                       I am new to Force.com and have a very simple question. I have two types of accounts Customers/Carriers(Account object with different record type).

I am trying to add a new button call (Update from Webservice) which calls a static method in my class which calls the webservice and updates the account record.

Since its a standard controller could anyhelp me to where to put the code for that button action. I was able to add the button but not able to add action and code behind.

 

 

2) Account object has a custom field with PickList as Type (u,c,a, etc). After the web call out i get some  values for that account and need to assign to it. How should I assign picklist values to the object

 

Account. Country(picklist) = 'USA;CAN,AUS';

 

Can i do the above or do i need to put in a List<SelectOptions> and assign to it i.e

List<SelectOptions> opt  = new List<SelectionOptions>();

opt.add( new select option ('USA',USA);

opt.add( new select option ('CAN',CAN);

opt.add( new select option ('AUS',AUS);

Account. Country(picklist) = opt ;

 

Any help is much appreciiated.

Best Answer chosen by Admin (Salesforce Developers) 
cvuyyurucvuyyuru

Bharath,

 

1) You can add a deatil page button on the pagelayout and execute javascript.

 

You can call an apex class from this button and send the data to Apex class.

 

Ex:

 

sforce.apex.execute("class Name","methodname",{param in method valueto the class}); 

 

2) This question is bit tricky.

 

But you can add values to picklist easily. If you add the values and update every time, the new value will eb added to the picklist values. 

 

In case of list of values, I am not aware of it.

 

All Answers

cvuyyurucvuyyuru

Bharath,

 

1) You can add a deatil page button on the pagelayout and execute javascript.

 

You can call an apex class from this button and send the data to Apex class.

 

Ex:

 

sforce.apex.execute("class Name","methodname",{param in method valueto the class}); 

 

2) This question is bit tricky.

 

But you can add values to picklist easily. If you add the values and update every time, the new value will eb added to the picklist values. 

 

In case of list of values, I am not aware of it.

 

This was selected as the best answer
bharath11rbharath11r

Thanks Charan for the tip for call from Javascript. I followed your tip and followed the below article and that solved the problem

 

http://salesforcesource.blogspot.com/2008/09/how-add-detail-button-to-your-objects.html

 

For the list of pick values..I assigned a string with semicolon and it worked like a charm,