Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Add URL in Modal Popup as content in Poral Widget.

Mohammed
Tera Contributor

Hi,

1) I am trying to create a Modal popup which contains a URL as content.

2) When Modal is clicked on "Next" button, it should call a onClick function which is already present eg: OpenModal2();

 

I have written:

HTML
====

<button ng-click="openModal1()" class="btn btn-primary">Modal1</button>
<button ng-click="openModal2()" class="btn btn-primary">Modal2</button>


Client Script
=============

function() {
  /* widget controller */
  var c = this;
  $scope.openModal1= function() {
  var url = '<br><a ng-href= "https://community.servicenow.com/" >Accessories</a>';
  spModal.open({
  title: 'Accessories',
  message: 'Would like to add accessories.?' + url,
  buttons: [{
           label: i18n.getMessage("Next")
           }],
      }).then(function($scope) {
      openModal2();
    })
  }

openModal2() = function() {
     spModal.confirm("Would like to add softwares.?");
  }
	
}

 

 

Any suggestions would be really helpful. ThankYou.

1 ACCEPTED SOLUTION

Abhit
Tera Guru

Hi Mohammed,

 

Try this.

// HTML template 
 <button ng-click="c.onConfirm()" class="btn btn-default"> Confirm </button> 

// Client script

function() {
  var c = this;
  $scope.openModal1= function() {
  var url = '<br><a href= "https://community.servicenow.com/" >Accessories</a>';
  spModal.open({
  title: 'Accessories',
  message: 'Would like to add accessories.? ' + url,
  buttons: [{
           label: i18n.getMessage("Next")
           }],
      }).then(function($scope) {
      spModal.confirm("Modal -2 ");
    })
  }	
}

 

Refer this: LINK

 

Thanks.

View solution in original post

2 REPLIES 2

sachin_namjoshi
Kilo Patron
Kilo Patron

Below solutions should be helpful to you

 

https://serviceportal.io/modal-windows-service-portal/

 

https://community.servicenow.com/community?id=community_question&sys_id=f6c22232db9817042e247a9e0f9619e1

 

Regards,

Sachin

Abhit
Tera Guru

Hi Mohammed,

 

Try this.

// HTML template 
 <button ng-click="c.onConfirm()" class="btn btn-default"> Confirm </button> 

// Client script

function() {
  var c = this;
  $scope.openModal1= function() {
  var url = '<br><a href= "https://community.servicenow.com/" >Accessories</a>';
  spModal.open({
  title: 'Accessories',
  message: 'Would like to add accessories.? ' + url,
  buttons: [{
           label: i18n.getMessage("Next")
           }],
      }).then(function($scope) {
      spModal.confirm("Modal -2 ");
    })
  }	
}

 

Refer this: LINK

 

Thanks.