extracting catalog item url values from esc portal

Deepika54
Tera Contributor

Hello experts,

 

When clicked on a catalog item url from esc portal, it is opening as a below link

 

Deepika54_0-1764875682647.png

 

Is there any way by which we can extract the short_descripton value from the URL itself highlighted in yellow via any catalog client script. plz help

1 ACCEPTED SOLUTION

frviuf
Tera Sage

Hi @Deepika54 ,

Here is a catalog client script that runs onLoad extracts the short_description value from the URL:

function onLoad() {
    var short_description = getParmVal('short_description'); //URL parameter
    if (short_description) {
        g_form.setValue('variable_name', short_description); //Set Variable
    }
}

function getParmVal(name) {
    name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    var regexS = "[\\?&]" + name + "=([^&#]*)";
    var regex = new RegExp(regexS);
    var results = regex.exec(top.location);
    if (results == null) {
        return "";
    } else {
        return unescape(results[1]);
    }
}

 

View solution in original post

2 REPLIES 2

frviuf
Tera Sage

Hi @Deepika54 ,

Here is a catalog client script that runs onLoad extracts the short_description value from the URL:

function onLoad() {
    var short_description = getParmVal('short_description'); //URL parameter
    if (short_description) {
        g_form.setValue('variable_name', short_description); //Set Variable
    }
}

function getParmVal(name) {
    name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    var regexS = "[\\?&]" + name + "=([^&#]*)";
    var regex = new RegExp(regexS);
    var results = regex.exec(top.location);
    if (results == null) {
        return "";
    } else {
        return unescape(results[1]);
    }
}

 

Deepika54
Tera Contributor

you are the best