Capture last edit date when a specifc field is edited

Hello Everyone,

I am fairly new to Domino Designer and am requesting your help.

I have a form with several fields. I am having trouble with 2 of my fields.

Field 1 - Is titled “OnlyWarehouse”. This is a radio button with “Yes” and “No” as the options.

Field 2 - Is titled “LastEditedOn”. This field is a computed field.

In field “LastEditedOn” I would like to capture the date anytime field “OnlyWarehouse” is changed.

I have tried several @functions without any luck and I am not familiar with LotusScript at all. I can capture when the entire form is edited, but wish to capture the date when a specific field is updated. Can anyone help me figure this out?

Subject: Capture last edit date when a specifc field is edited

You can also use LS in the OnChange Event

Subject: Capture last edit date when a specifc field is edited

LotusScript is really the only way to fly here. Formula Language can be used, but it involves adding extra fields to the form and can be “confused” by refreshes.

Go to the Declarations section of the Globals object on the form (in the objects/references pane immediately to the left of the Programmer’s Pane in Designer) and create a global variable to hold the value of the OnlyWarehouse field:

Dim oldOnlyWarehouse As String

Then, in the PostOpen event, go to Initialize section and edit it to look like this:

Sub Initialize(Source As NotesUIDocument)

oldOnlyWarehouse = Source.FieldGetText(“OnlyWarehouse”)

End Sub

Finally, in the QuerySave event’s Initialize section, you would add something like this to check the value and add to the LastEditedOn field if necessary:

Sub Initialize(Source As NotesUIDocument, Continue As Variant)

If Not (Source.FieldGetText(“OnlyWarehouse”) = oldOnlyWarehouse) Then

Source.FieldSetText(“LastEditedOn”, Cstr(Now))

End If

End Sub

When you use this sort of technique, LastEditedOn should be computed to itself (that is, the formula should just be the fieldname), otherwise it will try to compute to something other than what the LS is setting it to.

Subject: Capture last edit date when a specifc field is edited

Sounds like you’ll want to use the queryOpen and querySave events on the form.

Try creating a global variable in the (Declarations) section of the forms “Globals”:

Dm szOnlyWarehouseTmp as string

Then on the queryOpen event you’ll need something like:

szOnlyWarehouseTmp = source.Document.OnlyWarehouse(0)

Then, on the querySave event add:

If not szOnlyWarehouseTmp = source.Document.OnlyWarehouse(0) then

source.Document.LastEditedOn = Now()

end if

Have a go at that.

Mike

Subject: Add computed-for-display field

Between ‘OnlyWarehouse’ and ‘LastEditedOn’ add a computed-for-display field, ‘TestField’, with this formula:@if(@IsDocBeingLoaded;OnlyWarehouse;@ThisValue);

Set ‘LastEditedOn’ formula to:

@if(OnlyWarehouse=TestField;@ThisValue;@Today)