visualforce

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

Uncaught TypeError: Cannot call method 'noConflict' of undefined

元气小坏坏 提交于 2019-12-05 06:21:31
I am trying to create a widget using javascript and jquery in SalesForce, I was stuck with a ERROR: Uncaught TypeError: Cannot call method 'noConflict' of undefined Below is my code which i am using (function() { // Localize jQuery variable var $j; /******** Load jQuery if not present *********/ if (window.jQuery === undefined || window.jQuery.fn.jquery !== '1.4.2') { var script_tag = document.createElement('script'); script_tag.setAttribute("type","text/javascript"); script_tag.setAttribute("src", "https://ap1.salesforce.com/resource/go/jquery.min.js"); if (script_tag.readyState) { script_tag

Parsing JSON Object in Salesforce Apex

青春壹個敷衍的年華 提交于 2019-12-04 21:57:39
问题 How do I parse a jsonObject which is in a given format in Apex? I need List<String> from the items array which contains the id attribute. What is some appropriate method? For parsing it, I try to create a class with code: public class JSON2Apex { public class Items { public String kind; public String etag; public String id; public String status; public String htmlLink; public String created; public String updated; public String summary; public String description; public String location;

How to convert Salesforce rich text editor to a “full mode” editor?

强颜欢笑 提交于 2019-12-04 12:29:42
With the spring '12 coming over these days, the old "hack" to convert the rich editor will not work any more. What can be done to retain full CKEditor functionality after spring 12? New CKEditor is object rather than URL based and a new approach is needed. In case anyone needs it, the following script will replace factory editor layout with a full version allowing additional formating options (fonts, colors, etc). Note, I set the height to 600px, adjust for your own needs. Also, as before, this can only work in your own VF pages, you cannot change the behavior of "factory" page layouts. $

How to format a date in VisualForce?

社会主义新天地 提交于 2019-12-04 08:53:08
问题 In Salesforce, if I'm binding a date into a VisualForce page, how do I apply custom formatting to it? Example: <apex:page standardController="Contact"> <apex:pageBlock title="Test"> <p>{!contact.Birthdate}</p> </apex:pageBlock> <apex:detail relatedList="false" /> </apex:page> This will output a date in the default format: Thu Jul 01 09:10:23 GMT 2009 How do I get it (for example) into dd/mm/yyyy format, like this: 01/07/2009 (Hopefully this is a fairly easy question, but to get the Salesforce

Creating a test class for a Select Statement

*爱你&永不变心* 提交于 2019-12-04 06:20:40
问题 I was wondering if you could help me. I am strugging to create a test class for the code below. Any help would be appreciated. Many thanks public class MatchReadyImage { public Match_Day_Check_List__c obj {get; set; } public MatchReadyImage(){ obj = [ Select Id, Match_Day_Ready_Status__c From Match_Day_Check_List__c Where Name = 'Everton V West Ham United Goodison Park EPL 2013-05-12' ]; } } 回答1: You just need to create a test data which will be selected by your code, because the data from

Custom Button or Link to a Visualforce page with a custom controller

微笑、不失礼 提交于 2019-12-04 06:15:53
I have a Visualforce page using a custom controller that is used to edit multiple records under an opportunity. I'd like to create a custom button or link from Opportunities to this Visualforce page. Currently the link looks like: /apex/ExamplePage?oppId={!Opportunity.Id} This works fine in the development sandbox, but when it is deployed as part of a managed package the link breaks as the page reference doesn't have the namespace prefix. I found the post Managed Package Redirecting Problem on the Force.com Discussion Boards which implied it should be possible to use $Page to reference the

CSRF safe Custom button linked to Apex method

て烟熏妆下的殇ゞ 提交于 2019-12-04 04:44:32
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 extension apex class entered and an action for a method in that class The action method returns a

Apex Code Version Control

筅森魡賤 提交于 2019-12-04 04:27:57
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. 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 Eclipse - similar to the instructions here If instead of using Subversion, you wish to use Git (lots of the

How to implement “Cancel” functionality in a VisualForce Page

好久不见. 提交于 2019-12-04 04:02:39
I know that this is how to save a record <apex:commandButton action="{!save}" value="Save"/> I want a button to NOT save the current record (ie. Cancel) and navigate to the list of saved record (ie. list of objects for that object type). Something like this... <apex:commandButton action="{!cancel}" value="Cancel"/> The list view for an object is your base URL / the 3 letter prefix for your object / o, for example: https://na1.salesforce.com/a0C/o So you could just create an action method that returns a Pagereference with the appropriate URL and set to redirect ( pr.setRedirect(true) ).