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
Lakshit AswalLakshit Aswal 

This field is making me go crazy. It won't get changed.

trigger for updating a value depending on another object field.
A very simple trigger.
I want to update by incrementing the total_applicant(Type:Number, object: Job__c) field by 1, which is to be done only after a record is inserted or updated in the Candidate__c object.
I can't figure out why line 7 is always red(errorneous) which leads to no change in the databse.
A little help would be appreciated. A newbiew here by the way.
Best Answer chosen by Lakshit Aswal
Dushyant SonwarDushyant Sonwar
Lakshit,

Did this field level security permission FLS to Total_Applicants__c?

All Answers

Dushyant SonwarDushyant Sonwar
Hi Lakshit,

You forgot to add JoB_Id__c in your candidate object  test data record.

Hope this helps!
Lakshit AswalLakshit Aswal
Marked Field

It's been there since the object creation. It's a master-detail relationship with the Job__c object.
I have tested what is being retrieved from Job_Id__c and its the Record ID, and thats not a problem anyway as the SOQL query is working fine.
The only problem is with the Job__c object's instance (jobs) which is not working as expected.
punith rajpunith raj
i too have facing the same issue, is there any solution,
myfiosgateway (http://myfiosgateway.club)
Priya Gupta 35Priya Gupta 35
Try adding the given line,
update job__c;

To update the record you need to perform a DML operation. Without the DML operation the value won't be updated in the database.

 
Dushyant SonwarDushyant Sonwar
Lakshit,

Did this field level security permission FLS to Total_Applicants__c?
This was selected as the best answer
Lakshit AswalLakshit Aswal
Alas that worked. Thanks Dushyant sir.
And well I achieved this functionality by RollUp summary anyway, but working out with FLS worked, so switching back to trigger.
Cheers,
Lakshit.