HTML code within a snippet

Hi,

I am trying to create a snippet which makes it easier to format tickets in ServiceNow.
I want to be able to run this snippet:

{formmenu: default=Red; Orange; Yellow; Green; Blue;name=steps}
{if: steps="Red"; trim=right}
{formparagraph: name=Type text here:; default=; cols=60; rows=7}
{elseif: steps="Orange"; trim=right}
{formparagraph: name=Type text here:; default=; cols=60; rows=7}
{elseif: steps="Yellow"; trim=right}
{formparagraph: name=Type text here:; default=; cols=60; rows=7}
{elseif: steps="Green"; trim=right}
{formparagraph: name=Type text here:; default=; cols=60; rows=7}
{elseif: steps="Blue"; trim=right}
{formparagraph: name=Type text here:; default=; cols=60; rows=7}
{endif: trim=right}

But have the text inserted by the author paste into this code:

[code]<p style="color:red;">"Insert required text"</p>[/code]

This would mean we can choose the colour we want and the text required without the analysts needing to be familiar with code.

Unsure if this is possible but it would be really handy to have.
Thanks in advance!

Hi Oliver, welcome to the forums. :slight_smile:

That's possible for sure, I simplified the snippet and customized it to your needs as follows:

[code]<p style="color: {formmenu: default=Red; Orange; Yellow; Green; Blue; name=color; formatter=(value) -> lower(value)};">"{formparagraph: name=text; default=; cols=60; rows=7}"</p>[/code]

As the form may look a bit confusing to the analysts, I enabled the "quick entry" option for that snippet.

Please let me know if you need more help on this.

1 Like

Hi Abdalla,

This has the desired effect and is working as I wanted, thank you!

1 Like