0

Stopped working for me

if s2 then
        let reply := dialog(" 馃敶 M A J O R - Non Conformities", "This Audit was not compliant. Therefore, major non-conformities will be reviewed within 14 days. Include new Audit Time.", ["Confirmed", "No Confirmed"]);
        if reply = "Confirmed" then
            let today := 'Date Planning' + 14;
            let newRec := duplicate(this);
            openRecord(newRec);
            newRec.('Audit Code' := null);
            newRec.(Status := null);
            newRec.(From := null);
            newRec.(Appointment := null);
            newRec.('Plan Within' := 14);
            newRec.('RE-Schedule Date' := today);
            let me := this;
            newRec.('Audit Code' := me.'Audit Code' + "_" + "x1");
                        sleep(1000);
            openRecord(newRec)
        end
    else

The openRecord(newRec) it stopped working for me.

Some idea ?

3 replies

null
    • John_Halls
    • 4 mths ago
    • Reported - view

    Hi  There a few things here

    Why do you open the record, and then assign new values to it? I would do it the other way round

    Why do you open the record twice?

    Why do you have sleep(1000)?

    Is me meant to store the record newRec is duplicated from?

    Try

    if s2 then
            let reply := dialog("  M A J O R - Non Conformities", "This Audit was not compliant. Therefore, major non-conformities will be reviewed within 14 days. Include new Audit Time.", ["Confirmed", "No Confirmed"]);
            if reply = "Confirmed" then
                let oldRec := this;
                let newRec := duplicate(oldRec);
                newRec.('Audit Code' := null);
                newRec.(Status := null);
                newRec.(From := null);
                newRec.(Appointment := null);
                newRec.('Plan Within' := 14);
                newRec.('RE-Schedule Date' := oldRec.'Date Planning' + 14);
                newRec.('Audit Code' := oldRec.'Audit Code' + "_" + "x1");
                openRecord(newRec)
            end
        else
    

    Regards John

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

       

      Your script work Thanks Johns, I don't know why it stopped working since yesterday. Appreciate 馃憤

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

       

      Hi John.  Why do you open the record, and then assign new values to it?

      In a Choice field I have the options Completed, Major Conformities, Minor Conformities. Audits.

      If option 1 the Audit is completed without Conformities, the audit is archived in the History Completed.

      With options 2 and 3, a new record will be generated since they present Non-Conformities and a new date and time must be generated again.

      If option 2 the Audit presents Major Conformities, the record is duplicated with a new date 14 days from today's date, and a new time is updated, and a new appointment is created by clicking on the appointment button. Here a new code is created with the extension _x1 to differentiate it from the previous one. A new Re-Plan Date is also created. 

      If option 3 the Audit presents Minor Conformities, the record is duplicated with a new date 7 days from today's date, and a new time is updated and a new appointment is created by clicking on the appointment button. Here a new code is created with the extension _x1 to differentiate it from the previous one. A new Re-Plan Date is also created.

      Domains are the topics to be audited and can be from 1 to 3 topics.

Content aside

  • Status Answered
  • 4 mths agoLast active
  • 3Replies
  • 45Views
  • 2 Following