• MT0478
  • NEWBIE
  • 0 Points
  • Member since 2011

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

Hi,

 

I would like to update a Standard Field value (Text) with formula value that is created after saving a record.

First i tried with Workflow Rule and Field Update, but it didn't work.

Is it possible to deal with this matter with standard customization?

If the Trigger or something is required, please advise me how to write the code.

 

Thanks in advance.

Hi,

 

I'm new to Apex, and please advise me about Apex Trigger.

I could create a trigger for custom object to find duplicates and check a checkbox.

Below is my code. This trigger can check the checkbox of new record.

But I want to check the existing record's one.

How can i do this?

 

trigger CheckIsRevised on No__c (before insert, before update) {
   if (Trigger.isInsert)
   {
   	      for (No__c no : Trigger.new){
     
         No__c[] nos= [select id from No__c where Ano__c = :no.Ano__c ];
     
         if (nos.size() > 0) {
             no.revised_flag__c=true;
         }  
      }
   }
   else if (Trigger.isUpdate)
   {
       for (No__c no : Trigger.new)
       {
          No__c oldNo=Trigger.oldMap.get(no.id);
          if (no.Ano__c != oldNo.Ano__c)
          {
             No__c[] nos= [select id from No__c where Ano__c = :no.Ano__c];
     
             if (nos.size() > 0) 
             {
                no.revised_flag__c=true;
             }
              
          }
       }
   }	
}

 Thanks in advance!

Hi,

 

I would like to update a Standard Field value (Text) with formula value that is created after saving a record.

First i tried with Workflow Rule and Field Update, but it didn't work.

Is it possible to deal with this matter with standard customization?

If the Trigger or something is required, please advise me how to write the code.

 

Thanks in advance.

Hi,

 

I'm new to Apex, and please advise me about Apex Trigger.

I could create a trigger for custom object to find duplicates and check a checkbox.

Below is my code. This trigger can check the checkbox of new record.

But I want to check the existing record's one.

How can i do this?

 

trigger CheckIsRevised on No__c (before insert, before update) {
   if (Trigger.isInsert)
   {
   	      for (No__c no : Trigger.new){
     
         No__c[] nos= [select id from No__c where Ano__c = :no.Ano__c ];
     
         if (nos.size() > 0) {
             no.revised_flag__c=true;
         }  
      }
   }
   else if (Trigger.isUpdate)
   {
       for (No__c no : Trigger.new)
       {
          No__c oldNo=Trigger.oldMap.get(no.id);
          if (no.Ano__c != oldNo.Ano__c)
          {
             No__c[] nos= [select id from No__c where Ano__c = :no.Ano__c];
     
             if (nos.size() > 0) 
             {
                no.revised_flag__c=true;
             }
              
          }
       }
   }	
}

 Thanks in advance!