Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Add text between 2 variables in record producer variable set form

vdnehete
Tera Contributor

I have a requirement to display the text “Please answer the following question” between two variables. Both variables are part of a Multi-Row Variable Set (MRVS), and the application scope is Human Resources: Core.

I tried using Rich Text Label, Label, Container, and html, but these options do not appear to support displaying text between variables within an MRVS.

Could you please confirm whether this requirement is feasible in ServiceNow? If so, what would be the recommended approach to achieve this?

 

5 REPLIES 5

Anand__99
Mega Sage

Hi @vdnehete ,

 

You cannot include the following variable types in an MRVS:

  • Attachment
  • Break
  • Container End
  • Container Start
  • Container Split
  • HTML
  • Label
  • Macro
  • Macro with label
  • Rich Text Label
  • UI Page

 

Refer ServiceNow Doc

 

Try using checkbox field as readOnly, or use tooltip if it's related to the next variable.  

 

If my response answered your query, please mark my response as correct/helpful.

Thanks
Anand

 

sachinvic
Kilo Guru

@vdnehete 

This is a limitation of the MRVS. Variable types such as Label, HTML, Rich Text Label, Container, Break, etc. are not supported inside a Multi-Row Variable Set, so they will not be available when configuring the MRVS.

If the requirement is specifically to display “Please answer the following question” between two variables inside the MRVS, this can be achieved through a UI customization.

One approach is to customize the MRVS rendering and insert a non-input HTML element at the required position. For example:

<div class="mrvs-instruction">
Please answer the following question
</div>

The customization would need to:

Identify the target MRVS.
Identify the two variables/fields between which the message should appear.
Insert the instruction element at that position when the MRVS row is rendered.
Ensure the logic also works when users add additional rows or edit existing rows.
Apply CSS if required for formatting.

I would not recommend using a Catalog Client Script to directly manipulate the OOTB MRVS DOM as the preferred production solution, because the generated HTML structure/selectors can change with ServiceNow releases and may require rework after upgrades.

If this is Service Portal/Employee Center, a custom widget or supported UI customization would be a better place to encapsulate this behavior. If the message needs to appear in every MRVS row, the customization needs to be applied to the row rendering rather than simply adding the message once on the parent form.

As an alternative, if the exact placement is not mandatory, the most maintainable solution is to place the instruction outside the MRVS and keep the MRVS limited to the data-entry variables.

So the requirement is achievable, but there is no OOTB MRVS variable type that can be used for this purpose. The exact implementation/code will depend on the UI being used and whether the message needs to appear once or in every MRVS row.

https://www.servicenow.com/docs/r/yokohama/servicenow-platform/service-catalog/c_ServiceCatalogVaria...

I wanted to add a help text: 'Answer the following questions if the new Organization has different Organizational Assignments than the parent organizationbetween the 2 variables which is What is the U Code and What is the Company if different from the Organization? This is simple help text inside vaiable set. Can you provide a non html script to add this requirement. 

it would be great if you explain where to add that

sachinvic
Kilo Guru

@vdnehete 

Yes, you can achieve this without customization if the text is intended as guidance for the “What is the company name?” variable.

Open the variable within the MRVS and go to Annotation → Show Help and add the required text in the Instructions field:

“Please answer the following question.”

If you want the instruction to remain visible by default, enable Always Expanded.

This is preferable to adding a Label/HTML/Rich Text Label variable, since those variable types are not supported within an MRVS.

If the requirement is for the text to appear as a standalone line between two variables, rather than as help/instruction for one of the variables, then that would require a UI customization.