You need to sign in to do that
Don't have an account?

Editing after insert object
I am trying to figure out how to edit an object after update.
I dont really care if it is before or after, but I need to use the ClosedDate field after the Status = Closed. If I use before update the status of the new object is Closed but the ClosedDate hasn't been generated (I'm guessing because it hasn't been inserted yet so Salesforce hasn't filled in the date yet.
What would the best way to go about doing this, using the newMap field and editing? I get some read only errors when I do this.
ANy help is appreciated
Hi,
If you are setting status as "closed" in trigger itself, then make closeddate field like below while you are updating the status Field to closed
Closeddate = date.Today() which might populate the correct date.
If you are doing status at somewhere and that cause the trigger fire and
IF you want to set the closeddate now then check for the status value in trigger liket Trigger.new[0].status
Then populate the closeddate as Date.Today();
Which might resolve you problem?
If there are only these field updates that are required then you can use Formula field to populate the Closeddate.
If there is some other code then try for above approaches
All Answers
Hi,
If you are setting status as "closed" in trigger itself, then make closeddate field like below while you are updating the status Field to closed
Closeddate = date.Today() which might populate the correct date.
If you are doing status at somewhere and that cause the trigger fire and
IF you want to set the closeddate now then check for the status value in trigger liket Trigger.new[0].status
Then populate the closeddate as Date.Today();
Which might resolve you problem?
If there are only these field updates that are required then you can use Formula field to populate the Closeddate.
If there is some other code then try for above approaches
I mean there is no trigger setting it closed, it is manually done by a user to Close a case.
This is a default field that is a part of all Cases the "ClosedDate" field that is of Date/Time. It is automatically generated by salesforce when a case is closed, I have no workflows or trigger to fill it in.