GS3
Tera Contributor

Guys, this is the solution for that issue:

 

function timelineDialog() {

    ScriptLoader.getScripts('/scripts/classes/GlideModalFormSetWidth.js', function() {
          var sysID = g_form.getUniqueValue(); // get the sys_id value from the change request
         //Create and open the dialog form
         var dialog = new GlideModalForm(new GwtMessage().getMessage("Title to be displayed on the popup message"),'table_name');
         dialog.setSize("modal-lg",300);
         dialog.setPreference('sys_id','-1'); //-1 to get create new record
         dialog.setPreference('sysparm_view', 'name_of_the_view'); //Load 'create' view
         dialog.setPreference('sysparm_query','parent='+sysID); //copy the change sys_id to the parent field
         dialog.setPreference("sysparm_link_less", "true");
         dialog.setPreference('sysparm_view_forced', 'true');
         dialog.setPreference('sysparm_clear_stack', 'true');


        //Fuction called on feedback submit, to add success message and refresh Knowledge Feedback Task related list
        dialog.setCompletionCallback(function(action_verb, sys_id, table, displayValue){
                  location.reload();
                  var feedTaskNum = '<a href="/u_moj_timeline.do?sys_id='+sys_id+'&sysparm_view=">' + displayValue +'</a>';
                  g_form.addInfoMessage( new GwtMessage().getMessage("Successfully created Table Record [name of the table]: {0}",feedTaskNum));
        });

       //Open the dialog
       dialog.render();

      });
}

View solution in original post