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.

How to display the case number in portal widget

Sri56
Tera Contributor

Hi Team,

 

I have created one widget which i'm mapping to standard ticket tab config.

in that widget, i need to display the "current case number"in html link.

like <p><a href="https://xyz.com(guid='',reference_number='<case_number>')" target="_blank">Process Link</a></p>

How can i display?

 

Please help!

 

Thanks!

6 REPLIES 6

@Sri56 

You can try something like this 

 

<div id="widgetBody">
    <!-- Widget body content -->

    <script>
        var currentCaseNumber = "12345"; // Replace with your actual case number

        // Construct the link using the current case number
        var link = "https://xyz.com?guid=''&reference_number=" + currentCaseNumber;

        // Create the HTML link
        var htmlLink = '<p><a href="' + link + '" target="_blank">Process Link</a></p>';

        // Insert the link into the widget body
        var widgetBody = document.getElementById('widgetBody');
        widgetBody.innerHTML += htmlLink;
    </script>
</div>

 

Kindly mark helpful/accepted if it helps you.

Thanks

Sri56
Tera Contributor

Hi Maddy,

 

Since i'm using this widget in tab configuration.

the case number should be dynamic (not fixed/static)

 

Please help here!

 

Thanks!

Sri