• NZArchitect
  • 59 Points
  • Member since 2008

  • Chatter
  • 1
    Best Answers
  • 3
    Likes Received
  • 0
    Likes Given
  • 2
  • 19

These links have dissapeared overnight....
I cannot find any new links, only PDF downloads.



Does anyone else use the HTML Guides?
Or do you use the PDF Downloadable Guides?
If you use the PDF guides, why do you prefer them?
I have preferred the HTML due to the search returning more relevant results. But maybe I could use the PDF search better?

I am trying to get related Object info using S-Control or the like.
Can you please help.
1.   Reason for me doing this is I have reached the limit of 5 cross objects within formulas. SFDC support suggest I use S-Control.
2.   For example I wish to retrieve fields within an "Account" that are related by a "Account Name" lookup to a "Contract", both standard objects. And then place those retrieved fields into my "Contract".
3.   I am current trying to do this with an S-Control that executes when I hit the "EDIT" button on any "Contract Detail page".
4.   I am also trying to bring through multiple "Contact" fields, "Opportunity" fields, and "User" fields. Hence reaching my limit.
5.   I would love to be update these dependant Contract Fields on selecting the lookup parent field, but I am happy with executing on "EDIT"
Q1: This is the type of code I am trying but it fails within S-Control
Q2: Also the related field may contain a picklist, is that a problem.
result = sforce.connection.retrieve("Name,Phone", "Account", [result[0].id]);
  result = sforce.connection.update([contract]);

  if (result[0].getBoolean("success")) {
    log("account with id " + result[0].id + " updated");
  } else {
    log("failed to update account " + result[0]);

These links have dissapeared overnight....
I cannot find any new links, only PDF downloads.



Does anyone else use the HTML Guides?
Or do you use the PDF Downloadable Guides?
If you use the PDF guides, why do you prefer them?
I have preferred the HTML due to the search returning more relevant results. But maybe I could use the PDF search better?

Hi Guys,

I have to update third party using HTTP PATCH method, but in apex class HTTP Request is not allowing me to send a request using req.setMethos('PATCH'). Is there any way that i can send PATCH request to third party system from apex class. Please give me some ideas.

  • April 07, 2016
  • Like
  • 0
We have an OAuth enabled website that is hooked into a Salesforce Community for our customers and partners, that lets them login using their Community username/password (or if they are already logged into the Community it lets them right in). This works correctly.

Internal users, however, cannot login directly to a Community using their Salesforce username/password, and instead have to use a special link built into the Community login page: https://<org>.my.salesforce.com/servlet/networks/session/create?site=XXXXXXX. However, that link ALWAYS takes them to the Community homepage, and not the original URL they typed into the browser. I have read that there is an additional parameter you can add to /networks/session/create called "&url=<url>" to send them to a specific URL, but I do not know how to lookup the original URL since it is wrapped up in the OAuth request, and not present in the Page's URL

For reference the URL shown in the browser is
https://<my community.com>/setup/secur/RemoteAccessAuthorizationPage.apexp?source=YYYYYYY

How do I access the original requested URL so I can append it to /networks/session/create so Internal Users are send to the correct destination URL after logging in?
Little confused on the terminology related to batch Apex,
while reading about batch apex in different places i see two terms BATCHES and TRANSACTIONS that are confusing me,

1) 5 transactions runs for one batch apex Job 
2) the no of records involved in the dml operation will be processed by dividing into 5 batches and by default batch size would be 200,

so i am wondering if the two statements mentioned above are same or different?

Here is an example where i am confused 

I have performed a delete operation on leads containing 250 records exactly,with the below batch apex ,and operation was successful but
while calling the batch apex ,in the execute anonymous window i have mentioned the size as 50 , then my understanding was 5 batches will run with each of them containing 50 records but , i saw total no of batches processed are 6, instead of 5,i wonder why it took 6 batches instead on 5

public class BatchLeadDelete implements database.Batchable<sobject>
    list<lead> llist=new list<lead>();
    public string query='select id,name,Phone from lead';
    public string flag='12345';
    public database.querylocator start(database.BatchableContext bc){
       return database.getQueryLocator(query); 
    public void execute(database.BatchableContext bc,list<lead> le){
        for(lead l:le){

      delete llist;             
    public void finish(database.BatchableContext bc){

I called the above code as below by giving size as 50

BatchLeadDelete l=new BatchLeadDelete();

These links have dissapeared overnight....
I cannot find any new links, only PDF downloads.



Does anyone else use the HTML Guides?
Or do you use the PDF Downloadable Guides?
If you use the PDF guides, why do you prefer them?
I have preferred the HTML due to the search returning more relevant results. But maybe I could use the PDF search better?

Hi all, 
I build a Class and its Unit Test Class as follows but Code Coverage %38. How can i pass %75.

public class AccountTrainerRelaionController {
    public Boolean Show { get; set; }
    public List<Attendees__c> trainerList   { get; set; }
    private ApexPages.StandardController std;
    public Class__c a {get; set;}
    public List<TrainerClass> TrainerClassList {get; set;}
public AccountTrainerRelaionController(ApexPages.StandardController controller) {
    std = controller;

public PageReference Search() {
        a = (Class__c) std.getRecord();
        String TrainerCheck ='name';
        List<Attendees__c> results = [select Class__r.Trainer__r.Name , Class__r.Trainer__r.Id , Class__r.Instruction__r.Name , Class__r.AttendeeCount__c , Class__r.Id , Class__r.Name, 
                                      Class__r.Baslangic_Tarihi__c , Name , Id , Contact__r.Name ,
                                      Contact__r.Id , Contact__r.Title , Contact__r.Email 
                                      from Attendees__c where Contact__r.Account.Id =:a.Account__c and Class__r.Trainer__c !=null order by Class__r.Trainer__r.Name,Class__r.Id ];
        List<ClassClass> cclist = new List<ClassClass>();
        TrainerClassList =  new   List<TrainerClass>(); 
        //TrainerClass tc = new TrainerClass(); 
        List<Attendees__c> attList = new List<Attendees__c>();
        ClassClass cc = new ClassClass();
        List<TrainerClass> tcList = new List<TrainerClass>();
        TrainerClass tc = new TrainerClass();
        for(Attendees__c c : results) 
                 if (TrainerCheck != c.Class__r.Trainer__r.Name )
                 tc = new TrainerClass();
                 tc.TrainerName = c.Class__r.Trainer__r.Name;
                 tc.TrainerId   = c.Class__r.Trainer__r.Id;
                 TrainerCheck = c.Class__r.Trainer__r.Name;
        List<ClassClass> clList = new List<ClassClass>();
        ClassClass cl = new ClassClass();
        List<Attendees__c> atdList = new List<Attendees__c>();
        Attendees__c atd = new Attendees__c();
        for(TrainerClass t : TrainerClassList) 
             for(Attendees__c c : results) 
                if (t.TrainerId  == c.Class__r.Trainer__r.Id )
                cl = new ClassClass();
                cl.ClassName = c.Class__r.Name;
                cl.ClassId = c.Class__r.Id;
                cl.CourseName = c.Class__r.Instruction__r.Name;
                cl.AttendeeCount = c.Class__r.AttendeeCount__c;
                cl.BaslangicTarihi = c.Class__r.Baslangic_Tarihi__c;
                t.Classes = clList;
            clList = new List<ClassClass>();
            for(ClassClass c : t.Classes)
                atdList = new List<Attendees__c>();
                 for(Attendees__c a : results) 
                   if( c.ClassId == a.Class__r.Id )
                c.Attendees = atdList;
        return null;

public class TrainerClass{
   public String TrainerName{get; set;}
   public String TrainerId{get; set;}
   public List<ClassClass> Classes{get; set;}

public class ClassClass{
   public String ClassName{get; set;}
   public String ClassId{get; set;}
   public String CourseName{get; set;}
   public Decimal AttendeeCount{get; set;}
   public Date BaslangicTarihi{get; set;}
   public Integer ClassCount{get; set;}
   public List<Attendees__c> Attendees{get; set;}


My Test Units  
public class AccountTrainerRelaionControllerTest {

  static testMethod void testSearch() {
   Courses__c course = new Courses__c();
   insert course;
   Trainer__c tc = new Trainer__c();
   tc.Egitmen_Adi__c= 'test';
   tc.Egitmen_Soyadi__c = 'deneme';
   insert tc;
    Class__c cl = new Class__c();
    cl.Instruction__c = course.Id;
    cl.Baslangic_Tarihi__c = System.today();
    cl.Bitis_Tarihi__c = System.today();
    cl.Egitim_Suresi__c = 1;
   insert cl;
    ApexPages.StandardController controller = new ApexPages.StandardController(cl);
    AccountTrainerRelaionController cont = new AccountTrainerRelaionController(controller);
    //call method
    //PageReference pageReference = cont.Search();
    //get url
    String url = '/apex/AccountTrainerRelation';
    //is not equal
    System.AssertEquals(url ,pageReference.getUrl());
While developing in Apex, I need to retrieve sandbox name in my code.  How do I do this in Apex?  Thanks in advance.


I created two methods in this class but when saved generates this error message. "Save Error: Entity is not org-accessible"


Is a test method. I'm using isTest(SeeAllData=true) annotation.


So happens when I try to add two more methods class.

Anyone know what can be?





Diego Moreira

I have a custom VF page that is using the standard Opportunity controller and an extension. In the VF page, I'm displaying OpportunityContactRoles in a Data Table so that I can have some additional columns/information displayed that are not options within the standard OpportunityContactRoles related list. My problem is that I have to manually add in the Del link (that appears in the "Action" column on the Opportunity Contact Roles related list) but can't seem to figure out the URL to use.


I see that the Del button links to /setup/own/deleteredirect.jsp with the following parameters:

  • id --> opportunity id
  • delID --> opportunitycontactrole id to delete
  • retURL --> the return URL

What is the confirmation token, and how do I determine it?

If there is an easier way to approach this rather than hacking the URL myself please let me know.

  • May 11, 2011
  • Like
  • 0

This should be simple, but I'm having a hard time with it. I want to create a formula field that gives me the number of minutes between the record's CreateDate and LastModifiedDate. What does that formula need to look like?


Thanks for your help!

In my apex code, system.now() returns the current Datetime based on a GMT calendar. My aim is to get the date time value in my local time zone.Since we have day light saving, I didn't think  about manipulating the time difference.


I would appreciate your suggestions.


Under personal information, I have set the time zone as "Time Zone(GMT-05:00) Eastern Daylight Time (America/New_York)".





We deployed some changes recently and ended up with many of our previous page-layout assignments being lost, i.e.., set back to Unassigned.


Our deployment included a number of Profiles, Record Types, and Page Layouts for Opportunity.  For all the Profiles we deployed, only those layouts  and record types in the package retained their assignments. 


We have 48 record types and about 50 profiles profiles and 30-40 layouts.  We never want to deploy all of these at the same time. In the past, when we only deployed a subset, only what we deployed changed and what was already there remained unchanged.


Anyone know what would cause this?  Is there a change to metadata deployment in '10?



I'm having a problem with the firstname and lastname inputField on my visualforce page designed to create a new Person Account. The input field for the first and last name fields are showing up as non-editable. I have read several posts and am attempting to set the recordTypeID in the controller, but as you will see in my simple example it does not appear to be setting properly.  Any help with the following greatly appreciated.



<apex:page controller="newPersonAccountController" tabStyle="Contact">
<apex:sectionHeader title="New Person Account Header"/>
<apex:form >
<apex:pageBlock title="New Person Account Block">

<apex:facet name="footer">
<apex:commandButton action="{!save}" value="Save" styleClass="btn"/>

<apex:pageBlockSection title="Person Account Section">
<apex:panelGrid columns="1">
<apex:inputField value="{!PersonAccount.phone}"/>
<apex:inputField value="{!PersonAccount.firstname}"/>
<apex:inputField value="{!PersonAccount.lastname}"/>

<apex:outputLabel value="{!PersonAccount.RecordTypeID}"/>
<apex:outputLabel value="{!PersonAccount.isPersonAccount}"/>




* This class is the controller behind the New PersonAccount
* wizard.

public class newPersonAccountController {

// Variables
account PersonAccount;

// Get methods.

public account getPersonAccount() {
if(PersonAccount == null) PersonAccount = new account(RecordTypeId='012A000000006JQ', firstname='Sammy', lastname='Snead');
return PersonAccount;

// This method performs the save for both objects, and
// then navigates the user to the detail page.
public PageReference save() {

// Create the account.
insert PersonAccount;

// Finally, send the user to the detail page

PageReference providerPage = new PageReference('/' + PersonAccount.id);

return providerPage;




The vf page displays with phone as an editable field and firstname and lastname as non-editable fields.  The recordtypeID is displayed, the isPersonAccount field shows as false.  The record DOES save correctly and creates the person account with the correct record type. 


Any thoughts on how to get the firstname and lastname fields to be editable fields, or any relavent sample code greatly appreciated.



Message Edited by ocsden1 on 07-14-2009 09:39 AM
I have custom objects (called CProducts__c)  which are linked to Opportunities via a reference field in CProducts__c called Opportunity__c.

Opportunities as well as CProducts__c have custom fields, both called DOCNO__c.

Now, the DOCNOs in CProducts__c are out of synch with the DOCNOs in Opportunities which they should not.

I need a query to write the DOCNOs from Opportunities in the dependent CProducts__c. I would like to have a update query which I could execute in the SF IDE or so.

Any hint, how to do that?

Thanks for your help.
  • July 23, 2008
  • Like
  • 0