Catalog Variable - how to display a read only text box if option is YES.

Matt D
Tera Contributor

We are trying to convert a very simple e-form from our intranet into SN and we are 90% of the way there.

We have created Service Catalog item with 3 variables (2 x select box / 1 x YES / NO).

We simply need extra read only text to display if the user selects YES to the last question.

To put some context around it, it's an application form for BYOD phone device for work emails.  The Yes/No question asks them if they wish to apply for financial reimbursement (default: NO).

If the person selects 'YES' on the form we want to display another few paragraphs of text to give them more information about their choice.

Fairly simple request, but I've been looking at all the variable templates (incl help text / annotation) but I can't get some simple logic (with a catalog UI policy) to display more text if the user selects 'Yes'. The conditions of the UI policy work fine, it's more so the actions we need it to take once those conditions are met.

Any tips that don't involve a macro or code?

Cheers,

Matt

1 ACCEPTED SOLUTION

Raf1
Tera Guru

Hi Matt,

You can use display message.

In your UI policy you should be able to execute similar script as below:

find_real_file.png

 

More info on the link below:

https://docs.servicenow.com/bundle/madrid-application-development/page/script/useful-scripts/referen...

If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.

 

If you are viewing this from the community inbox you will not see the correct answer button. If so, please review How to Mark Answers Correct From Inbox View.

View solution in original post

5 REPLIES 5

amaradiswamy
Kilo Sage

Hi,

Yes, you need to create a macro type variable , UI macro and a widget.

1. Navigate to system ui --> ui macros, create new

give paragraphs in XML

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<p>My text</p>
<p>My tex2t</p>
</j:jelly>

2. Navigate to Service Portal--> widgets, create new and write something like below in HTML

<div>
<p>My text</p>
<p>My tex2t</p>
</div>

3. Now, in macro variable select the macro created in #1 and widget created in #2

Raf1
Tera Guru

Hi Matt,

You can use display message.

In your UI policy you should be able to execute similar script as below:

find_real_file.png

 

More info on the link below:

https://docs.servicenow.com/bundle/madrid-application-development/page/script/useful-scripts/referen...

If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.

 

If you are viewing this from the community inbox you will not see the correct answer button. If so, please review How to Mark Answers Correct From Inbox View.

Matt D
Tera Contributor

Hi Raf,

Thanks for the additional information on this method.

We closely investigated and tested both suggestions on this forum post and we found that your option meant not having to duplicate the text in two different areas, and also not having to create both a macro (GUI) and a widget for the portal.

The only thing we are stuck on is how to separate paragraphs in the SHOWFIELDMSG parameters.  It ignores </p> tags and the only way we can separate 6 paragraphs is to use multiple SHOWFIELDMSG tags in the script.

We have been trying to Google a tag that would allow paragraph separation within the one section (as you can visibly notice different sections each time you add another SHOWFIELDMSG in the script.

 

Thanks

Matt

Matt D
Tera Contributor

Many thanks for the fast replies folks.

I am going to test those two options right now in my PDI and find out what would be the best option for our scenario.

I will post back some results.

Thanks again,

Matt