You need to sign in to do that
Don't have an account?
Santi Ram Rai
Trigger (By Defultls select the "Inactive" value from picklist)
Hi everybody,
My intension is; by befultls select the "Inactive" value from picklis.
Here is my code:
But, i have thiss error:
My intension is; by befultls select the "Inactive" value from picklis.
Here is my code:
trigger UpdateStatus on Project__c (before insert) { for (Project__c fc: Trigger.new) { if(fc.Project__c=true ) Project__c.Status__c = 'Inactive'; } }
But, i have thiss error:
On line 7 - you are saying IS the field Project__c on the object fc (which is a Project__c) true. You need to not reference this field if it doesn't exist!!
What are you trying to check before you set Status__c to 'Closed' ?
All Answers
Update operator under your IF condition. It would be comparision (==) insteaod assignment (=).
if(fc.Project__c == true){
}
Still same error.
Here:
But values are from Picklist. And is has 3 values(Active, inactive and closed)
You don't have another trigger or apex class called UpdateStatus
You do have a custom object called Project__c
This also has a field called Project__c - which can be evaluated
This object also has a field called Status__c - which can be set (ie isn't a read only formula or rollup)
UpdateStatusis my trigger not apex class.
Yes, Project__c is my custom object.
Actually field called Status__c, picklist field(Inactive, Active, Closed)
No, Project__c is custom object and it has a field called Status__c not Project__c.
and "fc" is the project record, whilst .Project__c is a field on it.
What is it you want to be "true" on the project to set the status?
On line 7 - you are saying IS the field Project__c on the object fc (which is a Project__c) true. You need to not reference this field if it doesn't exist!!
What are you trying to check before you set Status__c to 'Closed' ?
I got the point.