Direkt zum Hauptbereich

Posts

Es werden Posts vom Juli, 2015 angezeigt.

Sortieren von Listeneinträgen mit APEX

Eine Visualforce Seite enthält diverse Options-, Checkboxen-, Auswahlfelder deren Inhalt dynamisch vom Controller in Form von Listen list<SelectOption> aufgebaut wird. Die Einträge sind unsortiert. Dummerweise gibt es von Salesforce immer noch keine (brauchbare) Funktion zum Sortieren von SelectOptions nach Label. Die im Internet gefundenen Sort-Funktionen haben auch nur teilweise funktioniert. Abhinav Gupta hat in seinem Blog http://www.tgerm.com/2011/08/salesforce-apex-selectoption-sort.html eine simple Klasse vorgestellt, die ich letztendlich nach einer kleinen Modifikation: opt.getLabel() +    ersetzt durch opt.getLabel().toLowerCase() + ' ' + eingesetzt habe. Aufruf: list<SelectOption> F_lstDepartment = new list<SelectOption>(); lstDepartment.add('id1', 'Dev''); lstDepartment.add('id2', '---Please Choose---'); lstDepartment.add('id3', 'Marketing Services'); SelectOptionSorter.do

Apex Klasse per Custom Button ansprechen

Eine interessante Möglichkeit, eine APEX-Klasse per Custom Button anzusprechen, wird von Shivanath in seinem Artikel " Call Apex Class from custom button (javascript) in Slaesforce " ausführlich erläutert. Klasse: global class MyClass{ webservice static void myMethod() // you can pass parameters{ // Do something } }   Custom Button : {!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")} if({!AAA__c.Name}!=Null){ sforce.apex.execute("MyClass","myMethod",{}"}); alert("This is {!AAA__c.Name}"); }