0

I have an object named EXAM, exams have a unique Autonumber ID that starts from 0 and goes up to 10000. But this auto number is recorded as a TEXT by default.

I want to create a loop, that goes in to all the exams, checks if it has passed a expiration_date, and set it's exam_status to expired.

how do, set and get functions work on apex?

0

Try using Batch Class, Schedule the Batch class on the daily basis.

Batch Class Doc: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_batch_interface.htm

Scheduling a Batch Class: https://help.salesforce.com/articleView?id=code_schedule_batch_apex.htm&type=5

| improve this answer | |
  • Your answer would be even better with some code that doesn't depending reading on links that may eventually expire. – sfdcfox Sep 10 '18 at 4:40
0

I would probably do this as a time-based workflow. The condition would be that the expiration date is not null, and the time would be 0 minutes before the expiration. From there just add a field update to set the status to "expired." This will let you enable and disable it as needed, and may be easier to change in the future.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.