Discussions

Expand all | Collapse all

Not redirecting back after creating child records

  • 1.  Not redirecting back after creating child records

    Silver
    Contributor
    Posted 05-22-2017 14:24
    Hi there,

    I want to create multiple timecards on basis of a date range and have successfully achieved this with the help of Dan's Hylo Technique.

    Now, I am facing a problem the button does not redirect back after creating the child records and giving me an error "It has probably been deleted" like this because it is a connected table and key field is RecordID#2.

    It works find if I use a simple table.

    [iol] & "moduleParents.js" & [/iol]
    &
    "<a class='QBU_SansDialog Vibrant Success' " &
    "  data-rid='" & [Record ID#] & "'" &
    "  data-basedate='" & [Base Date] & "'" &
    "  data-frequency='" & [Frequency] & "'" &
    "  data-number='" & [Number] & "'" &
    ">Sans Dialog</a>" &
    "&nbsp;&nbsp;&nbsp;" &
    "<a class='QBU_WithDialog Vibrant Success' " &
    "  data-rid='" & [Record ID#] & "'" &
    ">With Dialog</a>"


    I have replaced that [Record ID#] with [Record ID#]2 and it does not redirect back but it successfull creates the timecards.

    Thank you in advance.

    Gaurav


  • 2.  RE: Not redirecting back after creating child records

    Silver
    Contributor
    Posted 05-23-2017 18:37
    Hi Dan,

    I know you are busy at Empower 2017. But, if you can take a look at this issue that will be much appreciated.

    Thanks,

    Gaurav


  • 3.  RE: Not redirecting back after creating child records

    Silver
    Contributor
    Posted 06-06-2017 09:37
    Can anyone help me on this?

    Thanks,
    Gaurav


  • 4.  RE: Not redirecting back after creating child records

    Top
    Contributor
    Posted 06-06-2017 09:48
    I would have to see the code in moduleParents.js to offer an opinion. If you post code please run it through jsBeautifier using two space indentation and use a code pasting service such as PasteBin:

    jsBeautifier
    http://jsbeautifier.org/

    PasteBin 
    https://pastebin.com/

    If you ever post code (including formulas) directly in the forum please format it using the pre icon in the toolbar.



    This makes is much easier for our robot to scrape formulas and automatically enter them into our Formula Corpus.


  • 5.  RE: Not redirecting back after creating child records

    Silver
    Contributor
    Posted 06-06-2017 09:52
    (function() {   var dbid = "bmjapiifh";   var dbidParents = "bmjapiigh";   var dbidChilds = "bmjapiigj";    var apptoken = "wbrknmxxxs87dx9jmrhbqz89qs";   $.ajaxSetup({     data: {       apptoken: apptoken     }   });    var fidsChilds = "17.54";    $("a.QBU_SansDialog").on("click", function(event) {      var rid = this.dataset.rid;     var basedate = this.dataset.basedate;     var frequency = this.dataset.frequency;     var number = this.dataset.number;      var csvData = "";     require(["moment"], function(moment) {       var d = moment(basedate);       for (var i = 0; i < number; i++) {         if (frequency == "Daily") {           d.add(1, "day");         } else if (frequency == "Weekly") {           d.add(1, "weeks");         } else if (frequency == "Monthly") {           d.add(1, "months");         } else if (frequency == "Quarterly") {           d.add(1, "quarters");         } else if (frequency == "Yearly") {           d.add(1, "years");         }         csvData += d.format("YYYY-MM-DD") + "," + rid + "\n";       }        $.post(dbidChilds, {         act: "API_ImportFromCSV",         records_csv: csvData,         clist: fidsChilds,       }).then(function(xml) {         document.location.href = dbidParents + "?a=dr&rid=" + rid;       });     });    });    $("a.QBU_WithDialog").on("click", function(event) {      var rid = this.dataset.rid;      var markup = '';     markup += '<table>';     markup += '  <tr>';     markup += '    <td><label for=QBU_BaseDate><b>Base Date</b></label></td>';     markup += '    <td><input id=QBU_BaseDate name=QBU_BaseDate type=text></td>';     markup += '  </tr>';     markup += '  <tr>';     markup += '    <td><label for=QBU_Frequency><b>Frequency</b></label></td>';     markup += '    <td>';     markup += '      <select name=QBU_Frequency id=QBU_Frequency>';     markup += '        <option>Daily</option>';     markup += '        <option>Weekly</option>';     markup += '        <option>Monthly</option>';     markup += '        <option>Quarterly</option>';     markup += '        <option>Yearly</option>';     markup += '      </select>';     markup += '    <td>';     markup += '  </tr>';     markup += '  <tr>';     markup += '    <td><label for=QBU_Number><b>Number of Timecards</b></label></td>';     markup += '    <td><input id=QBU_Number name=QBU_Number type=text></td>';     markup += '  </tr>';     markup += '</table>';      $("<div id=QBU_Dialog>").dialog({       title: "Automate Timecards Creation",       modal: true,       width: 400,       resizable: false,       buttons: {         OK: function() {           var basedate = $("#QBU_BaseDate").val();           var frequency = $("#QBU_Frequency").val();           var number = $("#QBU_Number").val();            $(this).dialog("close");           $("#QBU_Dialog").remove();            var csvData = "";           require(["moment"], function(moment) {             var d = moment(basedate);             for (var i = 0; i < number; i++) {               if (frequency == "Daily") {                 d.add(1, "day");               } else if (frequency == "Weekly") {                 d.add(1, "weeks");               } else if (frequency == "Monthly") {                 d.add(1, "months");               } else if (frequency == "Quarterly") {                 d.add(1, "quarters");               } else if (frequency == "Yearly") {                 d.add(1, "years");               }               csvData += d.format("YYYY-MM-DD") + "," + rid + "\n";             }              $.post(dbidChilds, {               act: "API_ImportFromCSV",               records_csv: csvData,               clist: fidsChilds,             }).then(function(xml) {               document.location.href = dbidParents + "?a=dr&rid=" + rid;             });           });          },         Cancel: function() {           $(this).dialog("close");         }       },       open: function(event, ui) {         $(this).html(markup);         $("#QBU_BaseDate").datepicker();       },       close: function(event, ui) {         //do something       }     });    }); })();


  • 6.  RE: Not redirecting back after creating child records

    Silver
    Contributor
    Posted 06-06-2017 16:52
    Dan, did you get a chance to look at this?