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?

2 Answers 2

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

1
  • Your answer would be even better with some code that doesn't depending reading on links that may eventually expire.
    – sfdcfox
    Commented Sep 10, 2018 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.

1
  • Time should be non zero Commented Sep 10, 2018 at 5:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .