Failing widget: 'Standard Ticket Conversations' (a54beb3a87f10010e0ef0cf888cb0bba)

Luiz Lucena
Mega Sage

Hello friends, 

We started using Universal Request a few months ago, we had to customize some of the features in order to attend business requirements. So far, no issues, however, some of the catalog items, those that are called from an Order Guide, insists in fail in the portal.
We use Service Portal and we had to create some page routes from "ticket" page to "standard_ticket" as well as from "sc_request" to "order_status".
All other catalog items are working fine from that Service Portal page "ticket".

But only those generated from the order guide are getting issues like below:
Screenshot 2023-10-12 at 2.54.30 PM.png

 

The failing widget here is OOTB, untouched.

Anyone had any issue like that?

4 REPLIES 4

Mayur2109
Kilo Sage
Kilo Sage

Hi @Luiz Lucena ,

 

Please check below community post.

https://www.servicenow.com/community/itsm-forum/failing-widget-standard-ticket-conversations/m-p/693... 

 

Please check and Mark Helpful and Correct if it really helps you.

Regards,
Mayur Shardul

Hi Mayur, 

I saw that one before, is very similar but the error is slightly different. 
Also, I'm not getting the same error with all Requested Items, just some of them. Still could not find what they have in common. 
For example, the item below loads fine:
Screenshot 2023-10-13 at 10.38.38 AM.png

G_30
Tera Contributor

Hi,

 

Did you able to solve the issue? currently facing issue with Standard Ticket Tab widget

Hi @G_30 ,

Yes, we found a way to workaround this.

 

Here is what we did:

1. Create a variable set for Universal Request, we named "Universal Request Set".

2. Only variable needed is the Universal Request sys_id.

3. For that Variable, we added the Catalog Client script below (you won't need the IF the checks for Generic Request as this is a custom form here):
    

function onLoad() {

    var url = top.location.href;
    var ur_id = new URLSearchParams(url).get("universal_request_sys_id");
    var ur_openedFor = new URLSearchParams(url).get("ur_openedFor");
    try {
        var ur_sd = new URLSearchParams(url).get("ur_sd");
        var ur_desk = new URLSearchParams(url).get("ur_desc");
    } catch (err) {
        console.log("ur_sd and ur_desk doesn't exist");
    }

    //make sure the reload of the already submitted page doesn't populate the UR variable
    var apps = new GlideAjax('UniversalRequest_Utils_BP');
    apps.addParam('sysparm_name', 'checkExistingUR');
    apps.addParam('sysparm_urid', ur_id);
	apps.getXML(checkUR);

    function checkUR(response) {
        var answer = response.responseXML.documentElement.getAttribute('answer');

        if (answer == "true") {
            g_form.clearValue('universal_request_id');
        } else {

            g_form.setValue('universal_request_id', ur_id);

            if (g_form.getUniqueValue() == "ddf753e2db9d47c0ad59d7795e96197f") { //Generic Request

                if (ur_sd != undefined && ur_sd != "") {
                    g_form.setValue('short_description', ur_sd);

                }
                if (ur_desk != undefined && ur_desk != "") {

					var parseDesc = ur_desk.replace(/newLine/g, '\n').replaceAll(/placeword1BP/g, 'id=').replaceAll(/placeword2BP/g, 'sys_id').replaceAll(/placeword3BP/g, '&').replaceAll(/placeword4BP/g, '<').replaceAll(/placeword5BP/g, '>').replaceAll(/placeword6BP/g, '"').replaceAll(/placeword7BP/g, '\'');
					g_form.setValue('description', parseDesc);

                }

            }

            if (ur_openedFor != undefined && ur_openedFor != "") {

                if (g_form.getValue("u_requested_by") != "" && g_form.getValue("u_requested_by") != undefined) {
					
                    g_form.setValue('u_requested_by', ur_openedFor);
                }

            }
        }

    }

}

 

4. the script above calls this script include as well:
    

var UniversalRequest_Utils_BP = Class.create();
UniversalRequest_Utils_BP.prototype = Object.extendsObject(AbstractAjaxProcessor, {

	checkExistingUR: function(){

		var ur = this.getParameter("sysparm_urid");
		var alreadyFilled = false;

		var gr = new GlideRecord("universal_request");
		gr.addQuery("sys_id", ur);
		gr.query();
		if (gr.next()) {

			if(gr.primary_task != ""){
				alreadyFilled = true;
			}

		}
		
		return alreadyFilled;
	},

	type: 'UniversalRequest_Utils_BP'
});


5. we also added a Catalog UI Policy to always hide the Universal Request ID in that variable set as we don't need to show it.


6, Once that's done, the most important is to add that variable set to all catalog items you need.

Let me know if that works.