- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2019 05:43 AM
Would you be able to present the terms and conditions in an alert box, or perhaps a confirm box? You may be able to overwrite the definition of the buttons with your own behaviors, and this simple approach should be easy to control in the script logic with IF conditions, and if you wanted to incorporate a field indicating the user's acceptance of the terms and conditions that also may be simple to incorporate into the script.
Perhaps this may work in the client script:
if(newValue == 'agree'){
confirm('Terms and Conditions \nBy clicking the OK button, you agree to the following Terms and Conditions \n1. Feed the hungry \n2. end global warming \n3. stop eating animal products \n4. Volunteer at school
Well, instead of a silly scrap of code, take a look at this api reference page instead, it contains several code samples which may offer the alternative you seek (opens in new window):
https://developer.servicenow.com/app.do#!/api_doc?v=london&id=SPM-confirm_S
Kind Regards,
Woody
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2019 05:50 AM
Thanks for the link Woody - my brain will try to decipher it slowly (it can't really do much else to be honest) but it looks very helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2019 06:39 AM
Not sure whether it will work on change client script, but it worked for me in the SP widget client controller. But you can give it a try.
function(spModal) {
var c = this;
// more control, passing options
c.onConfirmEx = function() {
c.confirmed = "asking";
var warn = '<i class="fa fa-warning" aria-hidden="true"></i>';
spModal.open({
title: 'Delete this Thing?',
message: warn + ' Are you <b>sure</b> you want to do that?'
}).then(function(confirmed) {
c.confirmed = confirmed;
})
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2019 06:44 AM
If I had a terms and conditions dialog required for a service portal widget, I think I would add a field to the table containing the catalog items of type translated html or translated text, then add the terms and conditions as a value for the appropriate record. Then the field value can be assigned to a variable in the client script for display with the spModal class using the sample code for this method, the cute code that offers terms and conditions for apple (opens in new window):
https://developer.servicenow.com/app.do#!/api_doc?v=london&id=SPM-open_O
The sample code actually incorporates the text of the terms and conditions into the script, which is one approach, which seems much easier than my recommendation for assigning the text to a field, but then if the t & c are unique to different catalog items or different users, then the best approach might be to construct a table to contain the various t & c as records which can then be referenced in the client script. In my case, I am storing the standard language defining a specific service level agreement (SLA) and then when the customer adds a service to the shopping cart, the text of the sla is captured (along with other relevant information including payment codes) for use in a MS Word document template which will be signed by the customer and the provider. The sample code is here:
//HTML template
<button ng-click="c.onAgree()" class="btn btn-default">
Agree
</button>
<div ng-show="c.agree">
You answered {{c.agree}}
</div>
//Client script
function(spModal) {
var c = this;
c.onAgree = function() {
// ask the user for a string
// note embedded html in message
var h = '<h4>Apple likes people to agree to lots of stuff</h4>'
// Line feeds added to the following lines for presentation formatting.
var m = 'Your use of Apple software or hardware products is based
on the software license and other terms and conditions in effect for the
product at the time of purchase. Your agreement to these terms is required
to install or use the product. '
spModal.open({
title: 'Do you agree?',
message: h + m,
buttons: [
{label:'✘ ${No}', cancel: true},
{label:'✔ ${Yes}', primary: true}
]
}).then(function() {
c.agree = 'yes';
}, function() {
c.agree = 'no';
})
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2019 01:47 AM
Thanks - it turns out there is another twist becuase the ts&cs are displayed (currently) from a UI page, so we really are back to the drawing board with this one, and may end up going for a macro variable to display the ts&cs rather than a pop up window.
Joy of joys. thanks for all your feedback though - it actually helped with another bit of the portal whcih needed a confirmation dialog.