• cristian.dev
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies

Hi all.

I'm writing my first trigger on SalesForce.

The goal would be: determine the value of a proposal (Proposal__c) updating its field called Proposal_Value__c (Currency), getting the sum of Item_Value__c(currency) that resides in a Proposal child object.

The trigger should be called inserting, updating or deleting a proposal Line_Item

trigger updateProposal on Proposal_Line__c (after delete, after insert, after update) {

Double proposalValue = Proposal__c.Proposal_Value__c;

List proposalLines =
[SELECT j.Proposal_Line_Value__c FROM Proposal_Child__c j FOR UPDATE];

for (Proposal_Child__c pl: proposalLines) {

proposalValue += pl.Proposal_Line_Value__c;
}
update proposalValue ;
}

I have an error declaring proposalValue (the first variable): Illegal assignment from Schema.SObjectField to Double

I've also checked in the schema explorer that says this variable is of Double type.

 

Thanks for any suggestion.