• JCompliance
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 7
    Replies

Hey All -

 

I know I have seen this done, but was hoping someone could direct me to an example.

 

I am displaying a list of records on a VF page. When I click on one of those records I would like the detail for the record to display below the list. Is anyone aware of where I can find this?

 

JP

Can someone help me with this error?

 

I just want the date to display "MM/DD/YYY"

 

Below is my code:

public class ArmActivityEvent {
    
    public Arm_Activity__c aaev;
    public String formatedDate;
    public ArmActivityEvent(Arm_Activity__c aa) {
        aaev= aa;
        Datetime endd = aa.Actual_Scheduled_Date_Time__c;
        formatedDate =   a.Actual_Scheduled_Date_Time__c.format('MM/DD/YYYY');
        system.debug(formatedDate);
    }
    
    public Arm_Activity__c getaaev() { return aaev; }
    public String getFormatedDate() { return formatedDate; }
    
}

 Thank you for any assistance you can provide.

 

JP

Greetings All -

 

I am getting the above error when trying to run the following code utilizing a VF Page Buton.

 

VF Page Code:

<apex:page standardController="Protocol_Arm__c"
	extensions="ProtocolScheduleClone"
	action="{!cloneWithItems}">
	<apex:pageMessages />
</apex:page>

 

Class Code:

public class ProtocolScheduleClone {

    //added an instance varaible for the standard controller
    private ApexPages.StandardController controller {get; set;}
    // add the instance for the variables being passed by id on the url
    private Protocol_Arm__c pa {get;set;}
    // set the id of the record that is created 
    public ID newRecordId {get;set;}
 
    // initialize the controller
    public ProtocolScheduleClone(ApexPages.StandardController controller) {
 
        //initialize the stanrdard controller
        this.controller = controller;
        // load the current record
        pa = (Protocol_Arm__c)controller.getRecord();
 
    }
 
    // method called from the VF's action attribute to clone the po
    public PageReference cloneWithItems() {
 
         // setup the save point for rollback
         Savepoint sp = Database.setSavepoint();
         Protocol_Arm__c newPA;
 
         try {
 
              //copy the protocol arm 
             pa = [select Id, Name, Description__c, Protocol__c, Start_Date__c from Protocol_Arm__c where id = :pa.id];
             newPA = pa.clone(false);
             insert newPA;
 
             // set the id of the new pa created for testing
               newRecordId = newPA.id;
  
             // copy over the line items 
             List<Arm_Activity__c> items = new List<Arm_Activity__c>();
             for (Arm_Activity__c aa : [Select aa.Id, aa.Activity_Type__c, aa.Description__c, aa.Protocol_Arm__c, aa.Originally_Scheduled_Date_Time__c, aa.Title__c From Arm_Activity__c aa where Protocol_Arm__c = :pa.id]) {
                  Arm_Activity__c newARA = aa.clone(false);
                  newARA.RecordType.Name = 'Actual';
                  newARA.Protocol_Arm__c = newPA.id;
                  items.add(newARA);
             }
             insert items;
 
         } catch (Exception e){
             // roll everything back in case of error
            Database.rollback(sp);
            ApexPages.addMessages(e);
            return null;
         }
 
        return new PageReference('/'+newPA.id+'/e?retURL=%2F'+newPA.id);
    }
 



}

 Any Help would be appreciated.

I have created the following code. When I try to save I get  "Save Error: expecting a right parentheses, found 'true'"

 

} 

public class CloneProtocalArmActivities{

 

private Protocol_Arm__c contactClone = null;

private final Protocol_Arm__c contactBase = null;

 

public CloneProtocalArmActivities(ApexPages.StandardController controller) {

protocolarmBase = 

[SELECT Id, Protocol__c,

(SELECT Subject, WhoId, WhatId, ActivityDate, Status FROM Tasks)

FROMProtocol_Arm__c

WHERE Id = :ApexPages.currentPage().getParameters().get('Id')];

}

 

public PageReference cloneProtocolArm() {

protocolarmClone = protocolarmBase.clone(

false, // preserve ID

true// deep clone (all fields and relationships)

false, // preserve readonly timestamps

false  // preserve autonumbers

);

insert protocolarmClone;

        

if (!protocolarmBase.Tasks.isEmpty()) {

List<Task> tasks = protocolBase.Tasks.deepClone(

false, // preserve ID

false, // preserve readonly timestamps

false  // preserve autonumbers

);

for (Task t : tasks) { 

t.WhoId = protocolarmClone.Id; 

}

insert tasks;

}

}

PageReference newProtocolArmPage = new ApexPages.StandardController(protocolarmClone).view();

newProtocolArmPage.setRedirect(true);

       

return newProtocolArmPage;

}

 

Please help.

Hey All -

 

I know I have seen this done, but was hoping someone could direct me to an example.

 

I am displaying a list of records on a VF page. When I click on one of those records I would like the detail for the record to display below the list. Is anyone aware of where I can find this?

 

JP

Can someone help me with this error?

 

I just want the date to display "MM/DD/YYY"

 

Below is my code:

public class ArmActivityEvent {
    
    public Arm_Activity__c aaev;
    public String formatedDate;
    public ArmActivityEvent(Arm_Activity__c aa) {
        aaev= aa;
        Datetime endd = aa.Actual_Scheduled_Date_Time__c;
        formatedDate =   a.Actual_Scheduled_Date_Time__c.format('MM/DD/YYYY');
        system.debug(formatedDate);
    }
    
    public Arm_Activity__c getaaev() { return aaev; }
    public String getFormatedDate() { return formatedDate; }
    
}

 Thank you for any assistance you can provide.

 

JP

Greetings All -

 

I am getting the above error when trying to run the following code utilizing a VF Page Buton.

 

VF Page Code:

<apex:page standardController="Protocol_Arm__c"
	extensions="ProtocolScheduleClone"
	action="{!cloneWithItems}">
	<apex:pageMessages />
</apex:page>

 

Class Code:

public class ProtocolScheduleClone {

    //added an instance varaible for the standard controller
    private ApexPages.StandardController controller {get; set;}
    // add the instance for the variables being passed by id on the url
    private Protocol_Arm__c pa {get;set;}
    // set the id of the record that is created 
    public ID newRecordId {get;set;}
 
    // initialize the controller
    public ProtocolScheduleClone(ApexPages.StandardController controller) {
 
        //initialize the stanrdard controller
        this.controller = controller;
        // load the current record
        pa = (Protocol_Arm__c)controller.getRecord();
 
    }
 
    // method called from the VF's action attribute to clone the po
    public PageReference cloneWithItems() {
 
         // setup the save point for rollback
         Savepoint sp = Database.setSavepoint();
         Protocol_Arm__c newPA;
 
         try {
 
              //copy the protocol arm 
             pa = [select Id, Name, Description__c, Protocol__c, Start_Date__c from Protocol_Arm__c where id = :pa.id];
             newPA = pa.clone(false);
             insert newPA;
 
             // set the id of the new pa created for testing
               newRecordId = newPA.id;
  
             // copy over the line items 
             List<Arm_Activity__c> items = new List<Arm_Activity__c>();
             for (Arm_Activity__c aa : [Select aa.Id, aa.Activity_Type__c, aa.Description__c, aa.Protocol_Arm__c, aa.Originally_Scheduled_Date_Time__c, aa.Title__c From Arm_Activity__c aa where Protocol_Arm__c = :pa.id]) {
                  Arm_Activity__c newARA = aa.clone(false);
                  newARA.RecordType.Name = 'Actual';
                  newARA.Protocol_Arm__c = newPA.id;
                  items.add(newARA);
             }
             insert items;
 
         } catch (Exception e){
             // roll everything back in case of error
            Database.rollback(sp);
            ApexPages.addMessages(e);
            return null;
         }
 
        return new PageReference('/'+newPA.id+'/e?retURL=%2F'+newPA.id);
    }
 



}

 Any Help would be appreciated.