Serviceportal catalog item popup with link

sindu3
Tera Contributor

When we click on in serviceportal catalogitem field choice value yes then should be open a popup message with red color with following other catalog item ,when we click on that link it should be redirect to other catalog item(example:this is not your correct catalog ite please click on this link)

I try it but not redirecting to other catalog item only showing error message

1 ACCEPTED SOLUTION

Murthy Ch
Giga Sage

Hi @sindu3 

You can try below logic in your script and it will work as you expected.

function onLoad() {
    //Type appropriate comment here, and begin script below
    g_form.addErrorMessage("This is not your correct catalog item. Please click on this <a href ='https://www.google.com'> link </a>");
}

//replace with your catalog URL

Hope it helps

Happy new year:)

 

Thanks,
Murthy

View solution in original post

4 REPLIES 4

Murthy Ch
Giga Sage

Hi @sindu3 

You can try below logic in your script and it will work as you expected.

function onLoad() {
    //Type appropriate comment here, and begin script below
    g_form.addErrorMessage("This is not your correct catalog item. Please click on this <a href ='https://www.google.com'> link </a>");
}

//replace with your catalog URL

Hope it helps

Happy new year:)

 

Thanks,
Murthy

sindu3
Tera Contributor

HI @Murthy Ch ,

Happy new year!

Thanks for solution provided, it's working on analyst portal view not on service portal view,please provide the solution solve the issue.

 

Thanks,

Himabindu.

Hi @sindu3 

Can you please share the entire script with screenshots. So that I can help you with the solution.

 

Thanks,
Murthy

sindu3
Tera Contributor

Hi @Murthy Ch ,

Please find scripts,

 

script include:
var datamethod = Class.create();
datamethod.prototype = Object.extendsObject(AbstractAjaxProcessor, {
GetURL:function(){
var message="You might probably be looking/logging ticket in the incorrect Catalog. Your request fits for the 'Shared mailbox creation'. Here's the link to log request under the correct Catalog";


var url="<a href = 'sp?id=sc_cat_item&sys_id=04b7e94b4f7b4200086eeed18110c7fd' > Click <a/>";
return message+"" +""+url;

},

type: 'datamethod'
});

client script:

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var ajax = new GlideAjax("datamethod");
ajax.addParam("sysparm_name","GetURL");
ajax.getXML(callback);
function callback(response){
var answer = response.responseXML.documentElement.getAttribute("answer");
if(newValue =="Yes"){

//g_form.showErrorBox("choice",answer);
g_form.addErrorMessage(answer);
//confirm(answer);
}
}

//Type appropriate comment here, and begin script below
UI policy:
condition:
when field is yes
runscript:
function onCondition() {
g_form.addErrorMessage("You might probably be looking/logging ticket in the incorrect Catalog. Your request fits for the 'Shared mailbox creation'. Here's the link to log request under the correct Catalog <a href='sp_sbc?id=sc_cat_item&sys_id=3b7995481bc468509246ff35464bcb32'>link</a>");


}

Not working in portal view, It not redirecting to another catalog item