You need to sign in to do that
Don't have an account?

write trigger to update a field of same object
want to update a autonumber field from a another custom formula field of sam object..
here name is autonumer field and Program_Name__c is formula field.. when i create a record i need to update name field by Program_Name__c field...
pl help me
trigger updatename on Course_Program__c (after insert, after update) {
for(Course_Program__c cp: trigger.new)
{
if(cp.Program_Name__c != null)
{
cp.name=cp.Program_Name__c;
}
}
}
getting error:Field is not writeable: Course_Program__c.Name at line 7 column 1
here name is autonumer field and Program_Name__c is formula field.. when i create a record i need to update name field by Program_Name__c field...
pl help me
trigger updatename on Course_Program__c (after insert, after update) {
for(Course_Program__c cp: trigger.new)
{
if(cp.Program_Name__c != null)
{
cp.name=cp.Program_Name__c;
}
}
}
getting error:Field is not writeable: Course_Program__c.Name at line 7 column 1
https://help.salesforce.com/HTViewSolution?id=000005315
All Answers
https://help.salesforce.com/HTViewSolution?id=000005315
please any other solution..
You can create a Text field instead of Auto Number field.
I dont want this autonumber field but if change the field then.. then i need to enter a program name.. but i have already custom formula filed called Course_Program__c.. which i am using as name.. so now i need update name field this Course_Program__c....
The design does not look good to me !!
1.there is object called course program... and the its standard field is autonumber field i,e Name
2. I am having a field called course program name.. which is formula field(date+some picklistvalue)..eg..java13/05/2014
3. I am having attendence object which will used to update attendence for perticular course.
4.now I am creating a console to update attendence..but in attendance page i need to desplay this course program name instead of autonumber..
I can change the field type but again i need to change wsdl...
1.) Being a standard field,you can't remove it from Standard layout.The only option I think is to change the field type and generate a new WSDL file.
2.) If it's a VF page for attendance then you can make it hidden.
I will go with 1st option..
Thanks vinit