Spmodal()

alebuc
Tera Expert

Hi,

I have an embedded widget:

HTML Code:

<a class="btn btn-{{options.color}} m-b" ng-click="c.onWidget('cags-requisito-insert-form')" ng-show="data.hidebutton=='0'">{{data.buttonMsg}}</a>

CSS: 

.btn {
width: 100%;
}

Server script:

data.buttonMsg = gs.getMessage(options.button_text || "Aggiungi Requisito");
data.sid = $sp.getParameter("sys_id");

var hide = "1";

if(data.sid != "" && data.sid != "-1"){
var gx = new GlideRecord("u_richiesta_demand");
if(gx.get(data.sid.toString())){
if(gx.u_stato.toString() == "-1"
|| gx.u_stato.toString() == "0"
|| gx.u_stato.toString() == "14")
hide = "0";
}
//gs.addInfoMessage("hide: " + hide);

}
data.hidebutton = hide;

Client controller:

function(spModal, $scope) {
var c = this;
var sid = $scope.data.sid.toString();
var url = window.location.href;
url = url.toString();

//alert("URL: " + url);
if(url.indexOf("crea_demand") > -1)
url = url.replace("crea_demand", "cags_visualizza_demand");

c.onWidget = function(widgetId, widgetInput) {
spModal.open({
title: 'Inserisci un nuovo Requisito',
buttons: [],
widget: widgetId,
widgetInput: {"table": "u_requisiti_demand","sys_id":"-1", "query":"u_richiesta_demand=" + sid}
}).then(function(){
top.window.location = url;
})
};
}

 

The portal page in attachment 02.PNG has the "Aggiungi requisito" button, from this button I have the embedded widget shown in 01.PNG attachment.

Since in this embedded widget I have a Save button that I want to modify, but I can not find where it is. I already know that sp.modal has the functionality to add buttons, but I want to modify the save button.

Any clue?

Thanks,

Alessio

 

1 ACCEPTED SOLUTION

Hi 

For navigation you can use - $location.url = your_url 

OR 

$window.location.href = "/sp";

 

Check the example below - 

https://serviceportal.io/navigating-multiple-service-portals/

 

Regards,

Omkar Mone

View solution in original post

6 REPLIES 6

Omkar Mone
Mega Sage

Hi 

That has nothing to do with the modal, it is the ootb ui action of that form.

 

Let me know if that helps.

 

Regards,

Omkar Mone

I was imagine something like that, but it is strange, since the Save button actually save the form but it redirect to a blank page. How I can hide the Save OOTB button just for the portal page? In this way I can use spmodal functionality to add custom buttons.

 

Thanks,

 

Alessio

Hi alebuc 

 

On the form widget, you should be able to use control+click to open 'Instance Options and select 'Disable UI Actions on Form' (this will not disable the blue 'Save' button). Hope this helps.

 

 

 

Screen Shot 2017-04-11 at 2.29.56 PM.png

 

Check this link as well - https://community.servicenow.com/community?id=community_question&sys_id=e29fac6edb015f443882fb651f96...

 

Regards,

Omkar Mone

I have found the widget in which the save button is edited. Basically is a clone widget of the OOTB Form Service Portal Widget.

I am quite new to html. Do you know how I can put something like action.setriderect(myurl) in the widget.

Please take a look to Form (Service Portal Widget) as example.

 

Thanks,

Alessio