• DeeR
  • NEWBIE
  • 75 Points
  • Member since 2009

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 11
    Replies

Hi all,

 

sorry if my title is not very helpful, I've come across a strange one..

 

When I go to Customize > Opportunities > Buttons and Links, and click New, then select VisualForce Page, I get no pages/content offered to me for that button.

 

I've successfully made a button previously, and this button still works on said page.

 

I've left it for some time, come back, copied the previous code/page and modified and when I go to make a button to use it, no pages.

 

I'm in my Sandbox.

 

I'm using Chrome and thought maybe there was some display issue with the pulldown menu so I tried in Firefox & IE as well. Same result.

 

Any ideas?

 

Regards

 

Dee

 

  • February 18, 2010
  • Like
  • 0
Hi folks,
 
I'm trying to make a custom VF page so that I can see specific Line Item fields not usually visible on the Opportunity page,
 
my attempt at a controller is failing, of course, here it is:
 

public class MyOppLIController {

public String getOpportunityLineItems() {

return [SELECT ServiceDate, Arrangement, Depart__c, Arrival__c, Accommodation__c, Pax__c FROM OpportunityLineItems];

}

 

public Opportunity getOpportunity() {

Id id = System.currentPageReference().getParamteres().get('id');

return null ;

}

}

 

 and the VF page meant to be using this controller:
 
 

<apex:page standardStylesheets="false" showHeader="false" sidebar="false"

controller="MyOppLIController">

<apex:form>

<apex:pageBlock title="Custom Display Page Using MyOppLIController">

<p>Opportunity Name {!Opportunity}</p>

<p>Belonging to Account {!Opportunity.Account.Name}</p>

</apex:pageBlock>

<apex:pageBlock>

<apex:dataTable value="{!OpportunityLineItems}" var="oppLitems" rowClasses="odd,even">

<apex:column headerValue="ServiceDate">

<apex:outputText value="{!oppLitems.ServiceDate}"/>

</apex:column>

<apex:column headerValue="Arrangement">

<apex:inputField value="{!oppLitems.Arrangment__c}"/>

</apex:column>

<apex:column headerValue="Depart__c">

<apex:inputField value="{!oppLitems.Depart__c}"/>

</apex:column>

<apex:column headerValue="Arrival__c">

<apex:inputField value="{!oppLitems.Arrival__c}"/>

</apex:column>

<apex:column headerValue="Accommodation__c">

<apex:inputField value="{!oppLitems.Accommodation__c}"/>

</apex:column>

<apex:column headerValue="Pax__c">

<apex:inputField value="{!oppLitems.Pax__c}"/>

</apex:column>

</apex:dataTable>

</apex:pageBlock>

<apex:detail relatedList="false" />

</apex:form>

</apex:page>

 

edit: ok I've manually inserted "enter" on all the lines and hopefully they will persist this time... :/

 

 I hope someone has the time to help me with what's probably an obvious gaff on my part.
 
Regards
 

Message Edited by DeeR on 29-01-2010 09:42 AM
Message Edited by DeeR on 29-01-2010 09:43 AM
  • January 28, 2010
  • Like
  • 0

The problem is that the Opportunity was given two sets of custom fields: date paid (1 & 2), Amount paid (1 & 2) etc.

 

I've made a custom object, "payments", so that I can have any number of payment entries, but of course now I'd like to try and copy the old data, from the Opportunity, into the new object.

 

Would anyone know of any instruction material online (I've been looking but no joy so far) that might help me code such a project?

 

I'm possibly missing some obvious prebuilt method for doing so but then again, it seems a slightly custom chore.

 

Once I have all of these fields copied over I can delete these fields from the Opportunity.

 

The other reason I thought this piece of machinary (coding) invaluable is in the case that I need to redesign an object, eg. I dsicover I should have built it with Field Tracking or Reporting capabilities, and I then need to make a new object with such.

 

Many Thanks for any advice or links you might know of.

 

Dee

  • January 07, 2010
  • Like
  • 0

Dear people that may be in the know:

 

I noticed recently that my Close date is being automatically adjusted to Today()'s date if the status of the opportunity changes to Full Amount Paid.

 

Or it may simply be that the system notices the amount due becoming 0 but either way the auto changing of the date is causing me some problems.

 

I've looked through the workflows and the like and can't seem to find where this is happening. If it's buried in the system such that I can't change it then I'll be forced to create a [custom] field to use instead of Close Date.

 

This is all brought about by my employers insistance that he doesn't want to use Close date as Final Payment Date for Opportunities.

 

Forgive me for mixing business talk and dev' talk but as a slight newbie to Opportunities and Wheeling and Dealing would it not be fair to say that using the Close Date as Final payment is apt?

 

As noted by the automatic adjustment of the date when all monies owed are paid. The Deal has been Closed.

 

Anyway, I see it that way, I just wish he did too <sigh>

 

Dee

  • January 06, 2010
  • Like
  • 0

Dear  all, forgive the level of newbiness. I'm trying to use the simplest code structures at first to get myself use to Apex coding.

So I am trying to make a Visual Force page that lets me make an Account and Contact in one (or two) page(s).

Essentially I was/am following the Visualforce Developer's Guide but rather than create Account, Contact, Opportunity and Opportunity Contact Role, I only want to create an Account and Contact. I thought that might be simpler :/

 

I found a class (controller) that supposedly does this, rather than chop the VF Dev' Guide example down..especially as the VF Dev' Guide didn't have a test class for their example. :(

 

 

public class newAccContactController {

public Account account { get; set; }
public Contact contact { get; set; }

public newAccContactController() {
account = new Account();
contact = new Contact();
}

public PageReference next() {
return Page.newAccContactStep2;
}

public PageReference previous() {
return Page.newAccContactStep1;
}

public PageReference save() {
Database.insert(account);
contact.accountId = account.id;
ApexPages.StandardController contactController = new ApexPages.StandardController(contact);
return contactController.save();
}
}

  but  I'm unable to find/figure out quite how to test a controller.

 

I found a controller test class for a slightly difference controller but I'm still stuck trying to mangle it to meet my needs. If I run this test below I get 50% coverage, but I'm not even sure it's testing what needs to be tested :/

 

 

@isTest
private class testAccContactController {

static testMethod void myNewAccContactController() {
// TO DO: implement controller test
//Use the PageReference Apex class to instantiate a page
PageReference pageRef = Page.newAccContactStep1;

//In this case, the Visualforce page named 'newAccContactStep1'
//is the starting point of this test method.
Test.setCurrentPage(pageRef);
//Instantiate and construct the controller class.
newAccContactController controller = new newAccContactController();

//Example of calling an Action method. Same as calling any other Apex method.
//Normally this is executed by a user clicking a button or a link from the Visualforce
//page, but in the test method, just test the action method the same as any
//other method by calling it directly.

//The .getURL will return the page url the Save() method returns.
String nextPage = controller.save().getUrl();

//Check that the save() method returns the proper URL.
System.assertEquals('/apex/failure?error=noParam', nextPage);

//Add parameters to page URL
ApexPages.currentPage().getParameters().put('qp', 'yyyy');

//Instantiate a new controller with all parameters in the page
controller = new newAccContactController();

//Example of calling the 'setter' method for several properties.
//Normally these setter methods are initiated by a user interacting with the Visualforce page,
//but in a test method, just call the setter method directly.
//controller.setLastName('lastname');
//controller.setFirstName('firstname');
//controller.setCompany('acme');
//controller.setEmail('firstlast@acme.com');
nextPage = controller.save().getUrl();

//Verify that the success page displays
System.assertEquals('/apex/success', nextPage);
}
}

 

and the results of running this test:

 

 

*** Beginning Test 1: testAccContact.static testMethod void myNewAccContactController()

20100104055728.393:Class.testAccContact.myNewAccContactController: line 13, column 46: returning from end of method public newAccContactController<Constructor>() in 0 ms
20100104055728.393:Class.newAccContactController.save: line 20, column 9: Database.insert(SOBJECT:Account)
20100104055728.393:Class.newAccContactController.save: line 20, column 9: DML Operation executed in 77 ms
System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Name]: [Name]

Class.newAccContactController.save: line 20, column 9
Class.testAccContact.myNewAccContactController: line 21, column 27
External entry point

 

 

 

 

 I'm sure for some this is bleedingly obvious/simple, and I hope that once I get past this stage the light will go on for the subsequent tests that I'll surely be writing.

 

Thank you anyone that can help me here.

 

D

 

 

Message Edited by DeeR on 01-03-2010 11:35 PM
Message Edited by DeeR on 01-03-2010 11:46 PM
  • January 04, 2010
  • Like
  • 0

Apologies for the total newbie status.

 

I've landed a position where I'm being asked to do things with Salesforce when I've never used it before.. <sigh>

Situation:

When looking at an (single) Opporunity page there's  a section entitled  Amount (Billing | Payment)
Which shows various Amounts and percentages, and *two* amounts paid. 

Problem:

We often receive multiple payments and I've been asked if I can't adjust this section so that it has the payments listed horizontaly, similar to the Contact Roles, showing existing payments. 

Hopefully all this with a button to enable addition payments. 
I'm thinking I may need to make a new object or several, one for the page layout, an object, or set of fields premade to catch the additional payments..?
Sorry .. I realise this is a doozie of a question and I'll be lucky not to get beaten up on the playground.

Hope someone has some tips.. I'm reading what I can but I'm drowning a bit.
cheers 

 

 

Message Edited by DeeR on 11-29-2009 03:22 PM
Message Edited by DeeR on 11-29-2009 03:24 PM
Message Edited by DeeR on 11-29-2009 03:25 PM
  • November 28, 2009
  • Like
  • 0

Hi all,

 

sorry if my title is not very helpful, I've come across a strange one..

 

When I go to Customize > Opportunities > Buttons and Links, and click New, then select VisualForce Page, I get no pages/content offered to me for that button.

 

I've successfully made a button previously, and this button still works on said page.

 

I've left it for some time, come back, copied the previous code/page and modified and when I go to make a button to use it, no pages.

 

I'm in my Sandbox.

 

I'm using Chrome and thought maybe there was some display issue with the pulldown menu so I tried in Firefox & IE as well. Same result.

 

Any ideas?

 

Regards

 

Dee

 

  • February 18, 2010
  • Like
  • 0
Hi folks,
 
I'm trying to make a custom VF page so that I can see specific Line Item fields not usually visible on the Opportunity page,
 
my attempt at a controller is failing, of course, here it is:
 

public class MyOppLIController {

public String getOpportunityLineItems() {

return [SELECT ServiceDate, Arrangement, Depart__c, Arrival__c, Accommodation__c, Pax__c FROM OpportunityLineItems];

}

 

public Opportunity getOpportunity() {

Id id = System.currentPageReference().getParamteres().get('id');

return null ;

}

}

 

 and the VF page meant to be using this controller:
 
 

<apex:page standardStylesheets="false" showHeader="false" sidebar="false"

controller="MyOppLIController">

<apex:form>

<apex:pageBlock title="Custom Display Page Using MyOppLIController">

<p>Opportunity Name {!Opportunity}</p>

<p>Belonging to Account {!Opportunity.Account.Name}</p>

</apex:pageBlock>

<apex:pageBlock>

<apex:dataTable value="{!OpportunityLineItems}" var="oppLitems" rowClasses="odd,even">

<apex:column headerValue="ServiceDate">

<apex:outputText value="{!oppLitems.ServiceDate}"/>

</apex:column>

<apex:column headerValue="Arrangement">

<apex:inputField value="{!oppLitems.Arrangment__c}"/>

</apex:column>

<apex:column headerValue="Depart__c">

<apex:inputField value="{!oppLitems.Depart__c}"/>

</apex:column>

<apex:column headerValue="Arrival__c">

<apex:inputField value="{!oppLitems.Arrival__c}"/>

</apex:column>

<apex:column headerValue="Accommodation__c">

<apex:inputField value="{!oppLitems.Accommodation__c}"/>

</apex:column>

<apex:column headerValue="Pax__c">

<apex:inputField value="{!oppLitems.Pax__c}"/>

</apex:column>

</apex:dataTable>

</apex:pageBlock>

<apex:detail relatedList="false" />

</apex:form>

</apex:page>

 

edit: ok I've manually inserted "enter" on all the lines and hopefully they will persist this time... :/

 

 I hope someone has the time to help me with what's probably an obvious gaff on my part.
 
Regards
 

Message Edited by DeeR on 29-01-2010 09:42 AM
Message Edited by DeeR on 29-01-2010 09:43 AM
  • January 28, 2010
  • Like
  • 0

The problem is that the Opportunity was given two sets of custom fields: date paid (1 & 2), Amount paid (1 & 2) etc.

 

I've made a custom object, "payments", so that I can have any number of payment entries, but of course now I'd like to try and copy the old data, from the Opportunity, into the new object.

 

Would anyone know of any instruction material online (I've been looking but no joy so far) that might help me code such a project?

 

I'm possibly missing some obvious prebuilt method for doing so but then again, it seems a slightly custom chore.

 

Once I have all of these fields copied over I can delete these fields from the Opportunity.

 

The other reason I thought this piece of machinary (coding) invaluable is in the case that I need to redesign an object, eg. I dsicover I should have built it with Field Tracking or Reporting capabilities, and I then need to make a new object with such.

 

Many Thanks for any advice or links you might know of.

 

Dee

  • January 07, 2010
  • Like
  • 0

Dear people that may be in the know:

 

I noticed recently that my Close date is being automatically adjusted to Today()'s date if the status of the opportunity changes to Full Amount Paid.

 

Or it may simply be that the system notices the amount due becoming 0 but either way the auto changing of the date is causing me some problems.

 

I've looked through the workflows and the like and can't seem to find where this is happening. If it's buried in the system such that I can't change it then I'll be forced to create a [custom] field to use instead of Close Date.

 

This is all brought about by my employers insistance that he doesn't want to use Close date as Final Payment Date for Opportunities.

 

Forgive me for mixing business talk and dev' talk but as a slight newbie to Opportunities and Wheeling and Dealing would it not be fair to say that using the Close Date as Final payment is apt?

 

As noted by the automatic adjustment of the date when all monies owed are paid. The Deal has been Closed.

 

Anyway, I see it that way, I just wish he did too <sigh>

 

Dee

  • January 06, 2010
  • Like
  • 0

Dear  all, forgive the level of newbiness. I'm trying to use the simplest code structures at first to get myself use to Apex coding.

So I am trying to make a Visual Force page that lets me make an Account and Contact in one (or two) page(s).

Essentially I was/am following the Visualforce Developer's Guide but rather than create Account, Contact, Opportunity and Opportunity Contact Role, I only want to create an Account and Contact. I thought that might be simpler :/

 

I found a class (controller) that supposedly does this, rather than chop the VF Dev' Guide example down..especially as the VF Dev' Guide didn't have a test class for their example. :(

 

 

public class newAccContactController {

public Account account { get; set; }
public Contact contact { get; set; }

public newAccContactController() {
account = new Account();
contact = new Contact();
}

public PageReference next() {
return Page.newAccContactStep2;
}

public PageReference previous() {
return Page.newAccContactStep1;
}

public PageReference save() {
Database.insert(account);
contact.accountId = account.id;
ApexPages.StandardController contactController = new ApexPages.StandardController(contact);
return contactController.save();
}
}

  but  I'm unable to find/figure out quite how to test a controller.

 

I found a controller test class for a slightly difference controller but I'm still stuck trying to mangle it to meet my needs. If I run this test below I get 50% coverage, but I'm not even sure it's testing what needs to be tested :/

 

 

@isTest
private class testAccContactController {

static testMethod void myNewAccContactController() {
// TO DO: implement controller test
//Use the PageReference Apex class to instantiate a page
PageReference pageRef = Page.newAccContactStep1;

//In this case, the Visualforce page named 'newAccContactStep1'
//is the starting point of this test method.
Test.setCurrentPage(pageRef);
//Instantiate and construct the controller class.
newAccContactController controller = new newAccContactController();

//Example of calling an Action method. Same as calling any other Apex method.
//Normally this is executed by a user clicking a button or a link from the Visualforce
//page, but in the test method, just test the action method the same as any
//other method by calling it directly.

//The .getURL will return the page url the Save() method returns.
String nextPage = controller.save().getUrl();

//Check that the save() method returns the proper URL.
System.assertEquals('/apex/failure?error=noParam', nextPage);

//Add parameters to page URL
ApexPages.currentPage().getParameters().put('qp', 'yyyy');

//Instantiate a new controller with all parameters in the page
controller = new newAccContactController();

//Example of calling the 'setter' method for several properties.
//Normally these setter methods are initiated by a user interacting with the Visualforce page,
//but in a test method, just call the setter method directly.
//controller.setLastName('lastname');
//controller.setFirstName('firstname');
//controller.setCompany('acme');
//controller.setEmail('firstlast@acme.com');
nextPage = controller.save().getUrl();

//Verify that the success page displays
System.assertEquals('/apex/success', nextPage);
}
}

 

and the results of running this test:

 

 

*** Beginning Test 1: testAccContact.static testMethod void myNewAccContactController()

20100104055728.393:Class.testAccContact.myNewAccContactController: line 13, column 46: returning from end of method public newAccContactController<Constructor>() in 0 ms
20100104055728.393:Class.newAccContactController.save: line 20, column 9: Database.insert(SOBJECT:Account)
20100104055728.393:Class.newAccContactController.save: line 20, column 9: DML Operation executed in 77 ms
System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Name]: [Name]

Class.newAccContactController.save: line 20, column 9
Class.testAccContact.myNewAccContactController: line 21, column 27
External entry point

 

 

 

 

 I'm sure for some this is bleedingly obvious/simple, and I hope that once I get past this stage the light will go on for the subsequent tests that I'll surely be writing.

 

Thank you anyone that can help me here.

 

D

 

 

Message Edited by DeeR on 01-03-2010 11:35 PM
Message Edited by DeeR on 01-03-2010 11:46 PM
  • January 04, 2010
  • Like
  • 0

Apologies for the total newbie status.

 

I've landed a position where I'm being asked to do things with Salesforce when I've never used it before.. <sigh>

Situation:

When looking at an (single) Opporunity page there's  a section entitled  Amount (Billing | Payment)
Which shows various Amounts and percentages, and *two* amounts paid. 

Problem:

We often receive multiple payments and I've been asked if I can't adjust this section so that it has the payments listed horizontaly, similar to the Contact Roles, showing existing payments. 

Hopefully all this with a button to enable addition payments. 
I'm thinking I may need to make a new object or several, one for the page layout, an object, or set of fields premade to catch the additional payments..?
Sorry .. I realise this is a doozie of a question and I'll be lucky not to get beaten up on the playground.

Hope someone has some tips.. I'm reading what I can but I'm drowning a bit.
cheers 

 

 

Message Edited by DeeR on 11-29-2009 03:22 PM
Message Edited by DeeR on 11-29-2009 03:24 PM
Message Edited by DeeR on 11-29-2009 03:25 PM
  • November 28, 2009
  • Like
  • 0