Create Action
(:source:) Dim backup As notesdocument Dim tmp_items As notesdocument Set savechanges = Nothing Set backup = New notesdocument(document.parentdatabase) backup.start_time = document.start_time backup.end_time = document.end_time backup.next_action_num = document.next_action_num backup.previous_action = document.previous_action backup.previous_time = document.previous_time backup.status = document.status backup.problem_closure = document.problem_closure backup.problem_type = document.problem_type backup.problem_sub_type = document.problem_sub_type backup.version = document.version backup.problem = document.problem If action.action_num(0) = 1 Then document.start_time = action.start_time End If If action.status(0) = "Closed" Then document.end_time = Cdat(action.start_time(0) + (action.duration(0)/1440)) End If document.next_action_num = document.next_action_num(0) + 1 document.previous_action = action.action_type document.previous_time = action.start_time document.status = action.status document.prev_line = action.line document.problem_closure = closure_val document.problem_type = type_val document.problem_sub_type = sub_type_val document.version = document.version(0) + 1 If document.problem(0) = "" Then document.problem = Trim$(shorten(action.action(0), 100)) & " .." End If Set tmp_items = copy_items(document, "tmp_") Call remove_items(document, "tmp_") If document.save(False, False) Then stop_watch.lslocaltime = next_stop(0) Call remove_items(action, "tmp_") Call action.makeresponse(document) action.act_key = action.universalid action.prob_key = action.ParentDocumentUNID action.reploc = action.parentdatabase.server Print action.parentdatabase.server Call action.save(True, True) lastaction = Format$(action.start_time(0), "Long Date") & " - " & action.engineer(0) & " - " & action.action_type(0) & " - " & Cstr(action.duration(0)) & " min - " & action.status(0) & Chr$(10) & action.action(0) notificationrequired = Not action.engineer(0) = document.responsible_engineer(0) Set savechanges = action Set action = Nothing Else Call backup.copyallitems(document, True) Messagebox "Your changes cannot be saved because this document has been saved by someone else while you have been editing it. " _ & "You must close and reopen the document before you can save it", 16, "Error" End If Call tmp_items.copyallitems(document, True)