• r999
  • NEWBIE
  • 5 Points
  • Member since 2012

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

Hi All,

I am trying to update a field in the same object after inserting, with the new data - But the outstanding__c field is not updating.

Please check my below trigger and give me any solution for this.

Thanks in advance,

 

trigger feedue on Payment__c (after insert) {
for(Payment__c p:Trigger.New)
{
Payment__c c=[select due__c from payment__c where id=:p.id];
Payment__c m=[select outstanding__c from payment__c where id=:p.id];
c.due__c=m.outstanding__c=c.due__c;
update m;
}
}

  • July 30, 2012
  • Like
  • 0

Hi,

I am not able to solve and not getting any idea how to update a field the last modified value.

Example : I want to calculate "Amount Due" by subtracting the "Paid Amount" value from "Outstanding Amount". And then the "Outstanding Amount" should be updated with the new penidng number. I tried this with Work flows - filed update, but the "outstanding amount" field is getting updated after the due value is calculated and then giviing the result by deducting the new "Outstanding Amount" again .

Please help in me in this if we can do it in any other way?

 

Thanks in advance,

  • June 07, 2012
  • Like
  • 0

I want to count the number of digits in a phone number to restrict the number to 10 digits or some customized number only. I tried this with Len(text), but could not get it. Do we have any other validation already available for this? please let me know if there is any possibility to use count function for this.

Thsnks in advance.

  • May 25, 2012
  • Like
  • 0

Hi,

I am not able to solve and not getting any idea how to update a field the last modified value.

Example : I want to calculate "Amount Due" by subtracting the "Paid Amount" value from "Outstanding Amount". And then the "Outstanding Amount" should be updated with the new penidng number. I tried this with Work flows - filed update, but the "outstanding amount" field is getting updated after the due value is calculated and then giviing the result by deducting the new "Outstanding Amount" again .

Please help in me in this if we can do it in any other way?

 

Thanks in advance,

  • June 07, 2012
  • Like
  • 0

I want to count the number of digits in a phone number to restrict the number to 10 digits or some customized number only. I tried this with Len(text), but could not get it. Do we have any other validation already available for this? please let me know if there is any possibility to use count function for this.

Thsnks in advance.

  • May 25, 2012
  • Like
  • 0

Hi Folks,

               How to update original object fields with update DML statement in trigger after insert event. My code:

 

trigger myTrigger on Account (after insert) {

Account myAccount = trigger.new[0];
myAccount.Type = 'Enterprise Customer';
update myAccount;
}

 

Here the update DML statement throws the exception: System.FinalException: Record is read-only:

 

Please let me know and all suggestions are appreciated with any sample code or correction to above code.

 

Thanks.