apex-code

Combine multiple objects within a list

我与影子孤独终老i 提交于 2019-12-11 02:39:10
问题 I'm looking to create a single list of records of various sObject types using apex to display to a custom visualforce page. I'm wondering if there is a way to combine multiple objects (case, opportunity, account, etc) within a single list. If not, how do you append the second object to the first in a list using visualforce code? Is there a best practice? Thanks So I could use a little more assistance completing this. I have written this: public class MyController { public List<ContactAndCase>

Execution Confusion in Batch class Apex

断了今生、忘了曾经 提交于 2019-12-10 22:43:53
问题 I am calling a batch class instance and after completing the batch, I am calling two other batch class instances. The finish() method for first batch class is public void finish(Database.BatchableContext BC) { List<Event__c> events = [SELECT Id FROM Event__c]; delete events; System.debug('Executing finish'); for (CalendarSettings__c c: [SELECT Id, Name, CalendarId__c, CalendarQuery__c, FieldToDisplay__c FROM CalendarSettings__c]) { System.debug('Calendar Id is' + c.CalendarId__c);

How to get in a Visualforce page controller a value from a custom component controller?

半城伤御伤魂 提交于 2019-12-10 15:23:41
问题 I'm trying do develop a visualforce custom component which is an entity chooser. This custom component displays a UI which helps browsing some records. It's possible to select one record, and I'd like to get it from outside the component or its controller. I've looked at the standard salesforce binding with assignTo bug it's not bidirectional... Hope someone can help me.. Thanks 回答1: Are you passing an object into the component? Objects are passed by reference, so if your component has an

CSRF safe Custom button linked to Apex method

跟風遠走 提交于 2019-12-09 17:01:03
问题 I'm looking for a technique to execute Apex code from a custom button added to the Opportunity object in a way that protects the user against CSRF. The current approach being used comes from the question - Custom Button or Link to a Visualforce page with a custom controller. Essentially: There is an Opportunity Custom Button with the Content Source set to "Visualforce Page". The Content for this button is set to a Visualforce page that uses Opportunity for the standardController, has an

Apex Code Version Control

爱⌒轻易说出口 提交于 2019-12-09 16:32:34
问题 Is there any way to integrate version control system for Apex & Visualforce code? I can thinking of keeping a separate repository but no way to have it integrated with Salesforce Platform. Thanks in Advance. 回答1: You can do this by using Subversion and the Force.com Eclipse IDE with the Subclipse plugin. Here are a few links to some instructions. Setting up Subversion (Windows) Installing Force.com IDE (Eclipse) Installing Subclipse (Eclipse plugin) Use the update site when installing in

Salesforce.com Id attribute seems to have a 15 and 18 character value, whats the difference?

≡放荡痞女 提交于 2019-12-09 14:49:49
问题 When using the SOAP API to work with salesforce.com (SFDC) it seems that the primary key in the underlying database is Id. Well there seems to be two representations of this value as either a 15 character version or an 18 character version. I have been using the 18 since it is clearly more specific, but what is contained in the last three digits, that they can be dropped, seemingly? Anyone understand what this is all about? 回答1: From the Web Services API Developer's Guide: ID fields in the

Unable to Generate HMac using Salesforce Crypto Class for Google Maps API

你说的曾经没有我的故事 提交于 2019-12-08 01:57:05
问题 My Company recently signed up for Google Maps API for business. To use the API, I need to generte a HMacSHA1 signature, and add it to my HTTP request. Unfortunately, somehow, I am not able to generate the right signature. For testing, I am using the values provided by google to ensure that the algorithm works fine and I get the right result. Here is the code: string url = 'maps/api/geocode/json?address=New+York&sensor=false&client=clientID'; string privateKey = 'vNIXE0xscrmjlyV-12Nj_BvUPaw=';

Debugging Schedulable Job in apex salesforce

老子叫甜甜 提交于 2019-12-06 08:08:55
i am trying to run a schedulable job i never used schedulable jobs in salesforce here is my code global class scheduledMerge implements Schedulable{ global void execute(SchedulableContext SC) { System.debug('Hello World'); } } created a cusom controller public class schedulableMerge{ public schedulableMerge(){ } public PageReference Hello(){ scheduledMerge m = new scheduledMerge(); String sch = '0 10 * * 1-12 ? *'; system.schedule('Merge Job', sch, m); return null; } } and visualforce page is <apex:page controller="schedulableMerge"> <!-- Begin Default Content REMOVE THIS --> <h1

Unable to Generate HMac using Salesforce Crypto Class for Google Maps API

空扰寡人 提交于 2019-12-06 05:49:46
My Company recently signed up for Google Maps API for business. To use the API, I need to generte a HMacSHA1 signature, and add it to my HTTP request. Unfortunately, somehow, I am not able to generate the right signature. For testing, I am using the values provided by google to ensure that the algorithm works fine and I get the right result. Here is the code: string url = 'maps/api/geocode/json?address=New+York&sensor=false&client=clientID'; string privateKey = 'vNIXE0xscrmjlyV-12Nj_BvUPaw='; privateKey = privateKey.replace('-', '+'); privateKey = privateKey.replace('_', '/'); //Blob

Using Apex Data Loader to load records into object with master details relationship

浪子不回头ぞ 提交于 2019-12-06 02:52:19
I need to load data into two objects. I am able to load data into one object using the data loader. The second object has a master-details relationship with the first object so I need to have the unique record id of the records of first object in the CSV file. How can I add those record id's to my CSV file? You could download the "master" records after initial upload and perform some mapping similar to (Name -> Id). In Excel this could be achieved with VLOOKUP. Once you have generated new list of "detail" objects, there should be no problem uploading them. The mapping "ID->uploaded records" is