Announcing the Global SNUG Board of Directors. Learn more here
‎08-31-2016 02:40 AM
Where i can edit layout of sp-model?
<sp-model form-model="item" mandatory="allMandatory[item.sys_id]"></sp-model>
‎08-31-2016 06:02 AM
Found in other topic:
Hey Jason, the <sp-model> directive is included in the ServiceNow core code and unfortunately can't be changed as of now.
‎07-17-2017 06:05 PM
How can I pass a filter to the table while showing results from the table in sp-model
HTML code:
<form>
<sp-model form-model="::c.data.user" mandatory="::c.data.user._mandatory"></sp-model>
</form>
Server Script :
data.user = {
"_fields" : {
"IO:user_field" : {
"refTable":"sys_user",
"sys_id":"",
"read_only":true,
"max_length":40,
"_class_name":"ReferenceQuestion",
"ed":{
"reference":"u_employee",
"searchField":"name",
"qualifier":"", // Do we give here , but in which format ? I need active employees only.
"name":"user"
}
}
},
"_sections" : [
{"columns": [
{
"fields" : [
{
"name" : "IO:user_field",
"type" : "field"
}
]
}
]
}
],
"_view":[
{
"name" : "IO:user_field",
"type" : "field"
}
],
"client_script":{
"onChange" : []
}
};
Thanks,
Sunil Singh
data.user = { "_fields" : { "IO:user_field" : { "refTable":"sys_user", "sys_id":"", "read_only":true, "max_length":40, "_class_name":"ReferenceQuestion", "ed":{ "reference":"u_employee", "searchField":"name", "qualifier":"", "name":"user" } } }, "_sections" : [ {"columns": [ { "fields" : [ { "name" : "IO:user_field", "type" : "field" } ] } ] } ], "_view":[ { "name" : "IO:user_field", "type" : "field" } ], "client_script":{ "onChange" : [] }
};
data.user = {
"_fields" : {
"IO:user_field" : {
"refTable":"sys_user",
"sys_id":"",
"read_only":true,
"max_length":40,
"_class_name":"ReferenceQuestion",
"ed":{
"reference":"u_employee",
"searchField":"name",
"qualifier":"",
"name":"user"
}
}
},
"_sections" : [
{"columns": [
{
"fields" : [
{
"name" : "IO:user_field",
"type" : "field"
}
]
}
]
}
],
"_view":[
{
"name" : "IO:user_field",
"type" : "field"
}
],
"client_script":{
"onChange" : []
}
};
‎11-01-2018 05:40 PM
Customizations can be made (through an AngularJS "decorator" or by creating a clone of the directive).
Please refer to this article:
‎03-05-2019 03:38 AM
Hi,
Some answer here [work in London] :
You need to retrieve :
-sp_form_field.xml, sp_variable_layout.xml and sp_model.xml from your navigator :
and for each just copy the code in angular ng-templates tables with another name like mysp_form_field.xml, mysp_model.xml ...
Then you have to called your templates in a directive :
Create 3 directives : myspModel, myspVariableLayout and myspFormField and copy this code that extend the initial directive (just adapt code for each directive) :
function(spModelDirective){
return angular.extend({},spModelDirective[0], {
templateUrl : 'mysp_model.xml'
});
}
Now you can modify each template to adapt your form.