0

Something wrong in this script.

let s1 := if Status = 1 then 1 else 0 end;
let s2 := if Status = 2 then 2 else 0 end;
let s3 := if Status = 3 then 3 else 0 end;
let check := dialog("Attention", "Are you sure?", ["Delete", "Cancel"]);
if s1 then
    let reply := dialog(" 🟢 Audit To History", " This Audit was Completed and will be archived and removed from Events", ["Confirmed", "No Confirmed"]);
    if reply = "Confirmed" then
        let me := this;
        let newR := (create 'History Completed');
        newR.('Events Audited' := me);
        newR.('Audit No' := me.'Audit Code');
        newR.('Project Audited' := me.'Projects_>'.'Project Name');
        newR.(Appointment := me.Appointment);
        newR.text(Status := me.text(Status));
        newR.(Auditor := me.'Auditor_>'.('First Name' + " " + 'Last Name'));
        newR.(Audited := me.'To Audit_>'.('First Name' + " " + 'Last Name'));
        alert(" Record Archived");
        sleep(1000)
    else
        if check = "Delete" then delete this end
    end
else
    if s2 then

 

 

When the record is complete on 'Choice' field the record copy to 'Audit To History' works perfect,  but next need to Delete from the Events table this record, (line 4 and line 20),  but first view the option of Delete Record and next the Confirmed Audit  😞 although in the end the execution is correct.

Something wrong 

3 replies

null
    • Fred
    • 9 mths ago
    • Reported - view
     said:
    but first view the option of Delete Record and next the Confirmed Audit

    The logic only deletes if

    1) status = 1

    2) if you click on Delete from line 4

    3) if  you click on Not Confirmed from line 6

    So it sounds like you want to put the delete command above the else for if reply = "Confirmed".

      • Rafael Sanchis
      • Rafael_Sanchis
      • 9 mths ago
      • Reported - view

       

      Hi Fred 

      let s1 := if Status = 1 then 1 else 0 end;
      let s2 := if Status = 2 then 2 else 0 end;
      let s3 := if Status = 3 then 3 else 0 end;
      if s1 then
          let check := dialog("Attention", "Are you sure deleted record ?", ["Delete", "Cancel"]);
          if check = "Delete" then delete this end;
          let reply := dialog(" 🟢 Audit To History", " This Audit was Completed and will be archived and removed from Events", ["Confirmed", "No Confirmed"]);
          if reply = "Confirmed" then
              let me := this;
              let newR := (create 'History Completed');
              newR.('Events Audited' := me);
              newR.('Audit No' := me.'Audit Code');
              newR.('Project Audited' := me.'Projects_>'.'Project Name');
              newR.(Appointment := me.Appointment);
              newR.text(Status := me.text(Status));
              newR.(Auditor := me.'Auditor_>'.('First Name' + " " + 'Last Name'));
              newR.(Audited := me.'To Audit_>'.('First Name' + " " + 'Last Name'));
              alert(" Record Archived")
          end
      else
          if s2 then

      This Work but, first delete the Record, and next copy to 'History Completed', don't feels confortable.

      The lógical, is first copy to 'History Completed' and next Delete the Record. This script is in Trigger after update

      • Fred
      • 9 mths ago
      • Reported - view

      Trigger after update is a server side action so no dialog or alerts will show up to user if they use the browser.

       

       said:
      This Work but, first delete the Record, and next copy to 'History Completed', don't feels confortable.

      I agree that it is a kinda weird to ask to delete then copy, plus wouldn't this delete the record before you can copy it? Move things around to make the work flow better.

Content aside

  • Status Answered
  • 9 mths agoLast active
  • 3Replies
  • 37Views
  • 2 Following