function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
dkndkn 

trigger to change record type ....

Hi

 

I have an standard contact object and related custom object application.When the admission status in the application changes to accepted , status on the contact object also changes to accepted.When this change takes place, I need the record type of the contact record to change as well....How can i do this using trigger....Any suggestions to kick start this would be really appreciated....

thank you

 

 

Best Answer chosen by Admin (Salesforce Developers) 
sales4cesales4ce

Dkn,

 

Write a trigger on Application object to modify the record type of contact whenever there is a change to the status.

 

Hope it helps.

 

Sales4ce

All Answers

Pradeep_NavatarPradeep_Navatar

Try the sample code given below :

 

trigger trg on contact(after insert,before update) {

Contact con  = trigger.new[0];

 RecordType Rtype = [Select r.SobjectType, r.Id From RecordType r where r.SobjectType ='Contact' and id =:con.id];

// your logic here

 

Hope this helps.

sales4cesales4ce

Dkn,

 

Write a trigger on Application object to modify the record type of contact whenever there is a change to the status.

 

Hope it helps.

 

Sales4ce

This was selected as the best answer