You need to sign in to do that
Don't have an account?
BenP
update records within custom object
Let me start by stating that while I can figure out what code does, I am by no means a programmer.
We have a custom object (SVMXP__Service_Group__c) that has around 2,000 records in it. These records almost never get updated, but they have a checkbox that needs to be unchecked when a date field expires. There is currently a workflow for this, but if I understand those correctly they only fire when a record is updated which doesn't happen. I'd like to make a little script that I could call with cronkit which would just check if the date field is less than today and if so change the checkbox.
The object is SVMXP__Service_Group__c
the field to change from true to false is SVMXP__Active__c
the field to check if the date is less than today is PolicyExp__c
I have some documents on apex, but I am overwhelmed right now. It's simple in my mind, but I don't know enough to get anything going.
Have you looked into timed workflows? If the expiry date is not too far in the future, you can simply set up a timed workflow to do a field update at the appropriate time.
Hope this helps.
There is a timed workflow setup that is supposed to change the active field to false one hour before "policyexp". Although I'm still testing this, it seems to not be doing what it should. What keeps getting me is the evaluation criteria that says this will only run "When a record is created, or when a record is edited and did not previously meet the rule criteria". Seeing that these records are almost never edited, this rule may not check the record.
I could be doing something wrong here, so please correct me if so.
luming,
I should be able to call the code with cronkit from what I understand of it. I'd just need the code to call.
So it sounds like you want to do this on existing records. If so, you are out of luck with this solution right now, but you could always just do a 'dummy' update on the existing records to trigger the timed workflow iniitially.
Hope this helps.
Ok, so check me on my understanding.
If I export the records via the data loader and then update them right back in. From then on any record that meets that timed workflow will be acted upon? In other words, when the record is updated the workflow is checked and a "timer" is set that waits for the timed workflow to become true?
If the timed workflow is scheduled for a time that has passed, it will be placed in the queue for immediate operation.
The one potential flaw in your understanding has to do with exporting and updating the records to trigger the workflow. Not sure if there will actually be a workflow-triggering update if the records are just reloaded with the same values.
You should read about timed workflows in the manual, or in Chapter 5 of the Developer Guide, for the comprehensive info you are seeking.
I am also facing the same problem to update all records. I tried with triggers but it is not worked and only one record get updated. You have any solution to update all records?
Please guide me....
Thanks in advance
-Nath
Hope this helps.