+ Start a Discussion

S Control to update Record Type

I need to write a S-Control to update the Recordtype field in Opportunity. I have 4 rec types like Unapproved Rec1 ,Unapproved Rec2 , Approved Rec1 , Approved Rec2  associated to 4 different layouts. I have setup an approval process and when the record is approved if the Old Rec type is Unapproved Rec1  , the rectype should change to Approved Rec1 . For this I have created to fields Old Rec and New Rec and populate the New Rec Custom fields with the new rec type name. However now I need to assign this value in New Rec custom field to the Opportunity Record type . How to write an S-control for this. Creating a formula doesn't help because field update for record type will show a picklist to choose , however my requirement is that the new rec type will vary dependign on the previous rec type name.
Any pointers and S-Control code how to achieve this.
You don't need to do that with an Scontrol.  Just put a field update to the desired record type as a Final Approval Action in your approval process.
Well, ok, I see about the previous record type thing.  You could make 2 approval processes depending on the record type you're starting with, or you can create a workflow rule that notes the prior value of the record type and makes a field update to the new one.  In any case an Scontrol is not called for here.
Thanks , that helped to solve my problem
What about situations where we are not using Approvals? I want to switch any Lost or Dropped deals to a Record Type that locks them down and prevents reps from reopening the old opps. Right now I am using the Excel connector to change them after running a query to find them. I'd love to automate this if possible.
Just use a workflow rule to identify the deals you want to switch to that record type and put a field update on that rule that changes it to that rectype.