• cradiya
  • NEWBIE
  • 25 Points
  • Member since 2013

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

I am trying to fetch data from description fied and update that in other field called "Email Sub". I am getting following errors

 

1. system.finalexception record is read-only

 

I have also tried before insert trigger, but field is not getting updated

 

 

trigger ParseBodySubject on BMCServiceDesk__Incident__c (after Insert, before update) {

    for(BMCServiceDesk__Incident__c incident : Trigger.new){

              String  description = String.valueof([Select id, BMCServiceDesk__incidentDescription__c from BMCServiceDesk__Incident__c where id=:trigger.new limit 1]);                                System.debug('Desc:'+description );

              String Sub = description.substringAfterLast('Subject:');              

              System.debug('Sub:' +Sub);

              incident.Email_Subject__c= Sub;    // Error Line       

       }

}

 

Appreciate your help

I am trying to fetch data from description fied and update that in other field called "Email Sub". I am getting following errors

 

1. system.finalexception record is read-only

 

I have also tried before insert trigger, but field is not getting updated

 

 

trigger ParseBodySubject on BMCServiceDesk__Incident__c (after Insert, before update) {

    for(BMCServiceDesk__Incident__c incident : Trigger.new){

              String  description = String.valueof([Select id, BMCServiceDesk__incidentDescription__c from BMCServiceDesk__Incident__c where id=:trigger.new limit 1]);                                System.debug('Desc:'+description );

              String Sub = description.substringAfterLast('Subject:');              

              System.debug('Sub:' +Sub);

              incident.Email_Subject__c= Sub;    // Error Line       

       }

}

 

Appreciate your help