I am working in ServiceNow and am creating a widget that pulls up a modal window with a form embedded in it. I want to pre-populate some of the fields in the modal form, but am unsure how to do this.
here is my HTML of a button that opens up the modal window:
<div>
<input class="btn btn-support" ng-click="c.onbSupport()" type="button" value="Ask a Question">
</div>
my client script looks like this:
function($scope,spModal) {
/* widget controller */
var c = this;
c.onbSupport = function(){
spModal.open({
title: 'Submit Your Question',
widget: 'form-new',
widgetInput: {table: 'support_tickets'},
buttons: []
}).then(function(){
})
}
}
and finally, here is my server script:
var usr = gs.getUserID();
var gr = new GlideRecord('info');
gr.addQuery('opened_for', usr);
gr.query();
if(gr.next()) {
data.parent = gr.getValue('number');
data.short_description = gr.getValue('short_description');
}
In the modal form, I have two fields (parent_case and category) that I would like to be pre-populated with data.parent and data.short_description respectively. To pass the server script value into HTML, I know you can do {{data.parent}}. However, how do I get those values into the client script that generates the modal form?