You need to sign in to do that
Don't have an account?
Pritam Shekhawat
trigger for change owner of record
Hello ,
I have one object Project__c . In this there are one picklist Assigned_To__c in this picklist i add manually all user name. So whenever i choose for example Pritam Shekhawat then project owner should be Pritam Shekhawat. Give me a idea what is easy way to do this.
Thanks
I have one object Project__c . In this there are one picklist Assigned_To__c in this picklist i add manually all user name. So whenever i choose for example Pritam Shekhawat then project owner should be Pritam Shekhawat. Give me a idea what is easy way to do this.
Thanks
All Answers
1. Maybe you can create a combinations of these projects and the owners in a LIST custom settings(easy to maintain, and you can add any additional values in future).
2. On a Trigger, use this custom setting values and based on this, populate the AssignedTo value.
or there are another possible way for this?
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_custom_settings.htm
Hope below sample help you...
//Create Custom Setting Object and records
Setup -> Develop -> Custom Settings -> New
Fields -> Name,AssignedTo
//Trigger
Trigger TriggerName on Project__c(before insert, before update) {
Map<String, Project_Custom_Setting__c> csMap = Project_Custom_Setting__c.getAll();
For(Project__c currProj : Trigger.New){
currProj.AssignedTo__c = csMap.get(currProj.Name).AssignedTo__c;
}
}
the code below might help: