- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2025 12:10 PM
Spent an afternoon dealing with record not found errors when setting a valid sys_id. I wanted to put some exposer on it because it seems there is a limited number of posts on this forum in regards to GlideModalForm. The overall issue was that a query cannot be passed when trying to pull up an existing record with .setSysID().
For example I was passing both a query and a sys id:
var id = '<sys_id>';
var query = 'state=' + g_form.getValue('state');
query += '^route=' + g_form.getValue('route');
query += '^work_start=' + g_form.getValue('work_start');
var gModalForm = new GlideModalForm('TITLE', 'TABLE');
gModalForm.setSysID(id);
gModalForm.setPreference('sysparm_query',query);
gModalForm.addParm('sysparm_view', "VIEW");
gModalForm.render(); // will render modal with No record found error
My solution to pull up an existing record for updating:
var id = <sys_id>;
var gModalForm = new GlideModalForm('TITLE', 'TABLE');
gModalForm.setSysID(id);
gModalForm.addParm('sysparm_view', "VIEW");
gModalForm.render(); // renders correct record in modal
To my understanding, passing a query would be used to create new record/form with pre-populated values.
Hope this helps others dealing with modal forms!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2025 12:11 PM
My solution to pull up an existing record for updating:
var id = <sys_id>;
var gModalForm = new GlideModalForm('TITLE', 'TABLE');
gModalForm.setSysID(id);
gModalForm.addParm('sysparm_view', "VIEW");
gModalForm.render(); // renders correct record in modal
To my understanding, passing a query would be used to create new record/form with pre-populated values.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2025 12:11 PM
My solution to pull up an existing record for updating:
var id = <sys_id>;
var gModalForm = new GlideModalForm('TITLE', 'TABLE');
gModalForm.setSysID(id);
gModalForm.addParm('sysparm_view', "VIEW");
gModalForm.render(); // renders correct record in modal
To my understanding, passing a query would be used to create new record/form with pre-populated values.