• SMGSFDCDEV
  • NEWBIE
  • 0 Points
  • Member since 2010
  • Solution Architect
  • IBM


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

I am trying to create a Save Method on a Visual Force Page that uses a custom controller.  I am able to create the input text field on the Visualforce page that accepts the value of the Date field I am trying to populate.  However, when I try to save the page (committ the value to the salesforce.com database), I receive the following error:

 

"Visualforce Error

 

System.DmlException: Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id not specified in an update call: []

 

Class.ProductsController.save: line 47, column 1"

    

 

Can someone please help me with this.

 

Here is the ProductsController class:


public class ProductsController {

 public List <Opportunity>getProducts(){



List<Opportunity>opp;


opp = [Select Name, Product_Family__c, StageName, Probability, AUM_Total__c, Product_Client_Demand_Summary__c, Competing_Product_pl__c, Idea_Origination__c, Inception_Date__c, Product_Client_Demand__c, Advisor_Team__c, IOI__c, Target_Launch_Date__c
From Opportunity
Where Product_Family__c != null
Order by Product_Family__c desc, Probability desc
];


return opp;



}

public Date targetlaunch {get; set;}

public void save(){

Opportunity o = new Opportunity(

Target_Launch_Date__c = targetlaunch

);

update o;
}




@istest
static void ProductTest()
{

ProductsController opp = new ProductsController();

opp.getProducts();
}


}

 

 

 

 

Here is the VisualForce Page:

 

 

<apex:page controller="ProductsController" sidebar="true" showheader="true">

<h1>Products Page</h1>

<apex:form >


<apex:pageBlock title="Products Onboarding">

<apex:pageBlockButtons location="top">

<apex:commandButton action="{!save}" value="Save"/>


</apex:pageBlockButtons>

<apex:pageBlockSection title="Sorted by Product Family & Opportunity Stage" >


</apex:pageBlockSection>


<!-- Printout Today's Date -->
<apex:outputText value="Displayed as of -">

</apex:outputText>
{! MONTH(Today())}

<apex:outputText value=" /">

</apex:outputText>
{! DAY(Today())}

<apex:outputText value=" /">

</apex:outputText>
{! YEAR(Today())}


</apex:pageBlock>

<apex:dataTable value="{!products}" var="prod"
cellspacing="0"
cellpadding="3"
columnswidth="100px"
border="3"
style="color:#151B8D; align:right"
styleClass="TableClass"
align="center" >


<apex:column style="font-weight:bold">

<apex:facet name="caption">Product Name</apex:facet>

<apex:facet name="header">Product Name</apex:facet>

<apex:outputField value="{!prod.Name}"/>

</apex:column>

<apex:column >

<apex:facet name="caption">Stage</apex:facet>

<apex:facet name="header">Stage</apex:facet>

<apex:outputField value="{!prod.StageName}"/>

</apex:column>
<apex:column >

<apex:facet name="caption">Probablity</apex:facet>

<apex:facet name="header">Probability</apex:facet>

<apex:outputField value="{!prod.Probability}"/>

</apex:column>

<apex:column >

<apex:facet name="caption">Target Launch Date</apex:facet>

<apex:facet name="header">Target Launch Date</apex:facet>

<apex:inputField value="{!prod.Target_Launch_Date__c}"/>


</apex:column>







<apex:column >

<apex:facet name="caption">Product Family</apex:facet>

<apex:facet name="header">Product Family</apex:facet>

<apex:outputField value="{!prod.Product_Family__c}"/>

</apex:column>







<apex:column >

<apex:facet name="caption">Idea Orgination</apex:facet>

<apex:facet name="header">Idea Origination</apex:facet>

<apex:outputField value="{!prod.Idea_Origination__c}"/>

</apex:column>


<apex:column >

<apex:facet name="caption">Product Client Demand</apex:facet>

<apex:facet name="header">Product Client Demand</apex:facet>

<apex:outputField value="{!prod.Product_Client_Demand_Summary__c}"/>

</apex:column>


<apex:column >

<apex:facet name="caption">Advisor Team</apex:facet>

<apex:facet name="header">Advisor Team</apex:facet>

<apex:outputField value="{!prod.Advisor_Team__c}"/>

</apex:column>


<apex:column >

<apex:facet name="caption">Indication of Interest</apex:facet>

<apex:facet name="header">Indication of Interest</apex:facet>

<apex:outputField value="{!prod.IOI__c}"/>

</apex:column>




</apex:dataTable>



</apex:form>



<apex:outputlink value="{! URLFOR($Action.Opportunity.New) }">Create New Product Opportunity</apex:outputlink>






</apex:page>

 

 

Any help given on the Save Method for the Custom Controller would be appreciated.

Can someone please help me wtih this error message on the following Custom Controller:

 

 

Save error: Uknown property 'ProductsController.opp'

 

Here is the custom controller:

 

public class ProductsController {

public List <Opportunity>getProducts(){

List <Opportunity> opp;

opp = [Select Name from Opportunity];

return opp;

}
}

 

 

 

Here is the Visualforce page:

<apex:page controller="ProductsController">

<apex:form >
<apex:dataTable value = "{!opp}" var="prod">
</apex:dataTable>
</apex:form>


</apex:page>

 

 

I am not sure why it is telling me that the opp variable used in the List of my custom controller is an unknown property.

 

Error Message: Save error: Unknown property: 'ProductsController.opp'

Can someone please help me wtih this error message on the following Custom Controller:

 

 

Save error: Uknown property 'ProductsController.opp'

 

Here is the custom controller:

 

public class ProductsController {

public List <Opportunity>getProducts(){

List <Opportunity> opp;

opp = [Select Name from Opportunity];

return opp;

}
}

 

 

 

Here is the Visualforce page:

<apex:page controller="ProductsController">

<apex:form >
<apex:dataTable value = "{!opp}" var="prod">
</apex:dataTable>
</apex:form>


</apex:page>

 

 

I am not sure why it is telling me that the opp variable used in the List of my custom controller is an unknown property.

 

Error Message: Save error: Unknown property: 'ProductsController.opp'

 

Hello Force.com Development community

I am trying to create a trigger that will assign a Date (Redemption_Cutoff_Date__c) from one of my custom objects: Funds__c to the custom field: Redemption_Cutoff_Date__c on the CASE object.  The Trigger compiles without errors, however it is not work where the Redemption Cutoff Date from the Fund object is assigned to the CASE.Redemption_Cutoff_Date__c field.

 

Can someone please let me know where I am going wrong here:

 

trigger UpdateRedemptionCutoffDateonCASE on Case (before update) {

for(Case c: Trigger.new){


if(c.isRedemption__c = true && c.RecordTypeId == '012M00000004MTS'){


List<Funds__c> fund = new List<Funds__c>();
List<Case> cs = new List<Case>();

fund = [Select Funds__c.Id, Redemption_Cutoff_Date__c from Funds__c f
where Funds__c.Id = :c.Fund__c];


if(fund.size()>1){
fund[0].Redemption_Cutoff_Date__c = cs[0].Redemption_Cutoff_Date__c;
}
}
}
}

 

Thanks for your contribution 

Hello Salesforce/Apex Developers
I am receiving the following error when I try to fire a trigger that associates the PrimaryContactRole in a custom contact field on a newly created Opportunity:

"Apex trigger InsertPrimaryContactonOpportunity caused an unexpected exception, contact your administrator: InsertPrimaryContactonOpportunity: execution of AfterInsert caused by: System.FinalException: Record is read-only: Trigger.InsertPrimaryContactonOpportunity: line 11, column 1"

/*
Date: November 14th, 2011
Description: This trigger inserts the Contact to the Opportunity based on the Primary Contact associated on the ContactRole
*/
 
trigger InsertPrimaryContactonOpportunity on Opportunity (after insert, before update) {
 
for(Opportunity o : Trigger.new){
 
   if(o.AssociatecnttoOpp__c = true){
OpportunityContactRole contactRole = 
[Select ContactID from OpportunityContactRole where isPrimary = true and OpportunityID = :o.Id];
if(contactRole != null){
o.Contact__c = contactRole.ContactID;
}
}
 
}
}

This trigger works correctly if I take out the after insert DML operation.  But this does not work if I put the after Insert DML operation.

At first I thought this could be an issue with the Sharing Settings related to the opportunity standard object.  But then I changed all my sharing settings on my sandbox to READ/WRITE I still received the same error.

Does anybody know why this would occur with the AfterInsert DML operation and not the beforeUpdate operation?

I am trying to create a Save Method on a Visual Force Page that uses a custom controller.  I am able to create the input text field on the Visualforce page that accepts the value of the Date field I am trying to populate.  However, when I try to save the page (committ the value to the salesforce.com database), I receive the following error:

 

"Visualforce Error

 

System.DmlException: Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id not specified in an update call: []

 

Class.ProductsController.save: line 47, column 1"

    

 

Can someone please help me with this.

 

Here is the ProductsController class:


public class ProductsController {

 public List <Opportunity>getProducts(){



List<Opportunity>opp;


opp = [Select Name, Product_Family__c, StageName, Probability, AUM_Total__c, Product_Client_Demand_Summary__c, Competing_Product_pl__c, Idea_Origination__c, Inception_Date__c, Product_Client_Demand__c, Advisor_Team__c, IOI__c, Target_Launch_Date__c
From Opportunity
Where Product_Family__c != null
Order by Product_Family__c desc, Probability desc
];


return opp;



}

public Date targetlaunch {get; set;}

public void save(){

Opportunity o = new Opportunity(

Target_Launch_Date__c = targetlaunch

);

update o;
}




@istest
static void ProductTest()
{

ProductsController opp = new ProductsController();

opp.getProducts();
}


}

 

 

 

 

Here is the VisualForce Page:

 

 

<apex:page controller="ProductsController" sidebar="true" showheader="true">

<h1>Products Page</h1>

<apex:form >


<apex:pageBlock title="Products Onboarding">

<apex:pageBlockButtons location="top">

<apex:commandButton action="{!save}" value="Save"/>


</apex:pageBlockButtons>

<apex:pageBlockSection title="Sorted by Product Family & Opportunity Stage" >


</apex:pageBlockSection>


<!-- Printout Today's Date -->
<apex:outputText value="Displayed as of -">

</apex:outputText>
{! MONTH(Today())}

<apex:outputText value=" /">

</apex:outputText>
{! DAY(Today())}

<apex:outputText value=" /">

</apex:outputText>
{! YEAR(Today())}


</apex:pageBlock>

<apex:dataTable value="{!products}" var="prod"
cellspacing="0"
cellpadding="3"
columnswidth="100px"
border="3"
style="color:#151B8D; align:right"
styleClass="TableClass"
align="center" >


<apex:column style="font-weight:bold">

<apex:facet name="caption">Product Name</apex:facet>

<apex:facet name="header">Product Name</apex:facet>

<apex:outputField value="{!prod.Name}"/>

</apex:column>

<apex:column >

<apex:facet name="caption">Stage</apex:facet>

<apex:facet name="header">Stage</apex:facet>

<apex:outputField value="{!prod.StageName}"/>

</apex:column>
<apex:column >

<apex:facet name="caption">Probablity</apex:facet>

<apex:facet name="header">Probability</apex:facet>

<apex:outputField value="{!prod.Probability}"/>

</apex:column>

<apex:column >

<apex:facet name="caption">Target Launch Date</apex:facet>

<apex:facet name="header">Target Launch Date</apex:facet>

<apex:inputField value="{!prod.Target_Launch_Date__c}"/>


</apex:column>







<apex:column >

<apex:facet name="caption">Product Family</apex:facet>

<apex:facet name="header">Product Family</apex:facet>

<apex:outputField value="{!prod.Product_Family__c}"/>

</apex:column>







<apex:column >

<apex:facet name="caption">Idea Orgination</apex:facet>

<apex:facet name="header">Idea Origination</apex:facet>

<apex:outputField value="{!prod.Idea_Origination__c}"/>

</apex:column>


<apex:column >

<apex:facet name="caption">Product Client Demand</apex:facet>

<apex:facet name="header">Product Client Demand</apex:facet>

<apex:outputField value="{!prod.Product_Client_Demand_Summary__c}"/>

</apex:column>


<apex:column >

<apex:facet name="caption">Advisor Team</apex:facet>

<apex:facet name="header">Advisor Team</apex:facet>

<apex:outputField value="{!prod.Advisor_Team__c}"/>

</apex:column>


<apex:column >

<apex:facet name="caption">Indication of Interest</apex:facet>

<apex:facet name="header">Indication of Interest</apex:facet>

<apex:outputField value="{!prod.IOI__c}"/>

</apex:column>




</apex:dataTable>



</apex:form>



<apex:outputlink value="{! URLFOR($Action.Opportunity.New) }">Create New Product Opportunity</apex:outputlink>






</apex:page>

 

 

Any help given on the Save Method for the Custom Controller would be appreciated.

Error:Apex trigger UpdateCountyInfo2 caused an unexpected exception, contact your administrator: UpdateCountyInfo2: execution of AfterUpdate caused by: System.NullPointerException: Attempt to de-reference a null object: Trigger.UpdateCountyInfo2: line 20, column 74

 

I recieved the following error when trying to save a record.  Hoping someone could help/provide some insight on this?  Below is my trigger.

 

trigger UpdateCountyInfo2 on Lead(after insert,after update) {
Set<Id> assIdSet=new Set<Id>();

   for(Lead l:Trigger.new)
   {
       if(l.Postal_Code_LookUp_Field__c != null) {
     
        assIdSet.add(l.Name);
        }
    }
   

       if(assIdSet.size()>0){
      Map<Id,sundog_deprm2__Postal_Code__c> assMap = new Map<Id,sundog_deprm2__Postal_Code__c>([Select Id,Name,sundog_deprm2__County__c from sundog_deprm2__Postal_Code__c where Id IN: assIdSet]);
     
         for(Lead LD:Trigger.new)
         {
           if(LD.Postal_Code_LookUp_Field__c !=null) 
           {
               LD.County__c = assMap.get(LD.Postal_Code_LookUp_Field__c).sundog_deprm2__County__c; 

          }

         else{

                   LD.County__c=null;

                 }
                 }
                 }
                 }

Can someone please help me wtih this error message on the following Custom Controller:

 

 

Save error: Uknown property 'ProductsController.opp'

 

Here is the custom controller:

 

public class ProductsController {

public List <Opportunity>getProducts(){

List <Opportunity> opp;

opp = [Select Name from Opportunity];

return opp;

}
}

 

 

 

Here is the Visualforce page:

<apex:page controller="ProductsController">

<apex:form >
<apex:dataTable value = "{!opp}" var="prod">
</apex:dataTable>
</apex:form>


</apex:page>

 

 

I am not sure why it is telling me that the opp variable used in the List of my custom controller is an unknown property.

 

Error Message: Save error: Unknown property: 'ProductsController.opp'

 

Hello Force.com Development community

I am trying to create a trigger that will assign a Date (Redemption_Cutoff_Date__c) from one of my custom objects: Funds__c to the custom field: Redemption_Cutoff_Date__c on the CASE object.  The Trigger compiles without errors, however it is not work where the Redemption Cutoff Date from the Fund object is assigned to the CASE.Redemption_Cutoff_Date__c field.

 

Can someone please let me know where I am going wrong here:

 

trigger UpdateRedemptionCutoffDateonCASE on Case (before update) {

for(Case c: Trigger.new){


if(c.isRedemption__c = true && c.RecordTypeId == '012M00000004MTS'){


List<Funds__c> fund = new List<Funds__c>();
List<Case> cs = new List<Case>();

fund = [Select Funds__c.Id, Redemption_Cutoff_Date__c from Funds__c f
where Funds__c.Id = :c.Fund__c];


if(fund.size()>1){
fund[0].Redemption_Cutoff_Date__c = cs[0].Redemption_Cutoff_Date__c;
}
}
}
}

 

Thanks for your contribution 

Hello Salesforce/Apex Developers
I am receiving the following error when I try to fire a trigger that associates the PrimaryContactRole in a custom contact field on a newly created Opportunity:

"Apex trigger InsertPrimaryContactonOpportunity caused an unexpected exception, contact your administrator: InsertPrimaryContactonOpportunity: execution of AfterInsert caused by: System.FinalException: Record is read-only: Trigger.InsertPrimaryContactonOpportunity: line 11, column 1"

/*
Date: November 14th, 2011
Description: This trigger inserts the Contact to the Opportunity based on the Primary Contact associated on the ContactRole
*/
 
trigger InsertPrimaryContactonOpportunity on Opportunity (after insert, before update) {
 
for(Opportunity o : Trigger.new){
 
   if(o.AssociatecnttoOpp__c = true){
OpportunityContactRole contactRole = 
[Select ContactID from OpportunityContactRole where isPrimary = true and OpportunityID = :o.Id];
if(contactRole != null){
o.Contact__c = contactRole.ContactID;
}
}
 
}
}

This trigger works correctly if I take out the after insert DML operation.  But this does not work if I put the after Insert DML operation.

At first I thought this could be an issue with the Sharing Settings related to the opportunity standard object.  But then I changed all my sharing settings on my sandbox to READ/WRITE I still received the same error.

Does anybody know why this would occur with the AfterInsert DML operation and not the beforeUpdate operation?