locked
Is it possible to use HTML tags inside wokflow? RRS feed

  • Question

  • Hi everyone, i wanna test a workflow that sends email (send mail from workflow with Powershell as HTML) but stuck with one thing.

    Import MP to SCSM with error:

    The management pack import failed. 
    Errors (1):
    Failed to verify module reference [Type=ManagementPackElement=Microsoft.Windows.PowerShellWriteAction in ManagementPack:[Name=Microsoft.Windows.Library, KeyToken=31bf3856ad364e35, Version=7.5.8501.0], ID=RAnotification.WindowsPowerShellScript.0f639244_1316_445c_b72c_5a430a6e0e80.PSWA] in the MemberModules list.
    : Schema validation failed.
    The element 'ScriptBody' cannot contain child element 'b' because the parent element's content model is text only.

    here is the email command:

    send-MailMessage -SmtpServer $smtp -To $to -Cc $cc -From $from -Subject $subject -Body  @"
    <b>Result</b>
    $body
    <p><br>SR Description:</br></p>
    $srdersciption
    "@ -BodyAsHtml -Priority high  -Encoding ([System.Text.Encoding]::UTF8)

    Is it possible to use HTML tags inside wokflow?

    Friday, September 9, 2016 12:59 PM

Answers

  • Abhishek hello.

    I've accedently found the solution here

    The answer is tag <pre>description</pre>

    • Marked as answer by Nikolas Page Wednesday, October 5, 2016 11:43 AM
    Wednesday, October 5, 2016 11:43 AM

All replies

  • Try HTML encoding your html tags.

    for example:

    <b>Result</b>

    becomes

    &lt;b&gt;Result&lt;/b&gt;

    Basically, try replacing < with &lt; and > with &gt;

    Friday, September 9, 2016 2:05 PM
  • Already, it has replaced tag < and > but in this case tag <b>  are not working.

    It just shows tags in html letter. I think it is by designt to show tags on the web pages


    Friday, September 9, 2016 2:07 PM
  • found a similar problem, , 

    https://social.technet.microsoft.com/Forums/systemcenter/en-US/c90e28be-b571-4f00-b8d2-cab6a28089f3/scsm-custom-workflows-assign-to-user-adding-notifications-with-html-into-xml?forum=administration

    will try to replace one more time.


    Friday, September 9, 2016 2:33 PM
  • Is anybody know how to handle with displaying description field in the notification?

    When i add SR description and send as html it pasted data in a single line of text while description is multiline.
    If i send notification as simple text SR description show as expect - multiline.
    I thought that if i'll create a Workflow with send mail inside, i shall send whatever i want, but workflow doesn't allow to use tags. Is there any another option to paste multiline Description Field in the default scsm HTML notification
    Sunday, September 11, 2016 3:31 PM
  • Step 3) HTML Body for Email Notification:-

    Just Copy and Paste …for TITLE and Description Insert the value and Tag it

    <html>

    <head>

    <style>

    .flex-container {

        display: -webkit-flex;

        display: flex;

        -webkit-flex-flow: row wrap;

        flex-flow: row wrap;

        text-align: center;

    }

    .flex-container > * {

        padding: 15px;

        -webkit-flex: 1 100%;

        flex: 1 100%;

    }

    .article {

        text-align: left;

    }

    header {background: black;color:white;}

    footer {background: #aaa;color:white;}

    .nav {background:#eee;}

    .nav ul {

        list-style-type: none;

     padding: 0;

    }

      

    .nav ul a {

     text-decoration: none;

    }

    @media all and (min-width: 768px) {

        .nav {text-align:left;-webkit-flex: 1 auto;flex:1 auto;-webkit-order:1;order:1;}

        .article {-webkit-flex:5 0px;flex:5 0px;-webkit-order:2;order:2;}

        footer {-webkit-order:3;order:3;}

    }

    </style>

    </head>

    <body>

    <div>

    <header>

      <h1>Service Request</h1>

    </header>

    <nav>

    <ul>

      <li><a href="#">SR ID</a></li>

     

    </ul>

    </nav>

    <article>

      <h1>Title :- $Context/Property[Type='WorkItem!System.WorkItem']/Title$</h1>

      <p> Description</p>

      <p>$Context/Property[Type='WorkItem!System.WorkItem']/Description$ </p>

     

    </article>

    <footer>Copyright © .com</footer>

    </div>

    </body>

    </html>


    Tuesday, September 13, 2016 8:58 AM
  • Hello Abhishek, it doesn't work
    Tuesday, September 13, 2016 9:33 AM
  • Try with this ....

    Title :- $Context/Property[Type='WorkItem!System.WorkItem']/Title$

    </br></br>

    Description :- $Context/Property[Type='WorkItem!System.WorkItem']/Description$

    Make sure Insert the tag from Properties ... dont test in Test email MBP .

    Just try with simple code 


    Tuesday, September 13, 2016 10:56 AM
  • I did every step that you described, copy\paste your code with one modification, i replaced

    this:$Context/Property[Type='WorkItem!System.WorkItem']/Description$  || not work, no data

    with this: $Context/Property[Type='CustomSystem_WorkItem_Library!System.WorkItem']/Description$

    I 've create SR and assigned it to see (without template tester). Still same result.

    What Properties are you  talking about?

    Make sure Insert the tag from Properties




    • Edited by Nikolas Page Tuesday, September 13, 2016 12:30 PM
    Tuesday, September 13, 2016 11:56 AM
  • you can add only Title and Description and than go insert button add the value 
    Wednesday, September 14, 2016 2:07 AM
  • Hello Abhishek, are we talk about the same?

    Will it make single line (string) text to multi  line (string) for SR.description field?

    This is not work:

    Title :- $Context/Property[Type='CustomSystem_WorkItem_Library!System.WorkItem']/Title$

    </br></br>
    Description :- $Context/Property[Type='CustomSystem_WorkItem_Library!System.WorkItem']/Description$



    • Edited by Nikolas Page Wednesday, September 14, 2016 9:03 AM
    Wednesday, September 14, 2016 8:03 AM
  • Hoping that you are looking in the More Email Notification part that In the same Description field information not fully populated ...

    Show exact snapshot where you exact stuck
    Wednesday, September 14, 2016 8:57 AM
  • It is above. Look at the SR Description field in the SCSM console . And email(html) notification description in the email. 

    I need to make description in html-email notification in multi string, like a see it in the SCSM console or HTML portal.

    Is it possible, and how to do it if it is?

    This is not work in the notification template :

    Title :- $Context/Property[Type='CustomSystem_WorkItem_Library!System.WorkItem']/Title$

    </br></br>
    Description :- $Context/Property[Type='CustomSystem_WorkItem_Library!System.WorkItem']/Description$

    I want to make description field in html notification looks like this:

    • Edited by Nikolas Page Wednesday, September 14, 2016 9:14 AM
    Wednesday, September 14, 2016 9:09 AM
  • Yes you can do that ! write script in HTML code and place into Email Template 

    you can use this link for HTML code testing ... http://onlinehtmltools.com/live-html-editor/ 

     in the editor write your script and find sample example in w3school HTML http://www.w3schools.com/html/html_tables.asp

    I am also designing my Template in the same ...


    Wednesday, September 14, 2016 10:04 AM
  • Did you test it in SCSM notification?

    My english unfortunately not perfect, so try to understand me correct.

    I'm talking not about workflow now, but about standart SCSM notification that can be sent in html or a simple text message to the Affected or Assigned to User. I need to include description field, can you show me example of email with working solution?

    I need notification look like this:

    But with your code 

    <html>
    <head>
    <style>
    .flex-container {
        display: -webkit-flex;
        display: flex;
        -webkit-flex-flow: row wrap;
        flex-flow: row wrap;
        text-align: center;
    }
    .flex-container > * {
        padding: 15px;
        -webkit-flex: 1 100%;
        flex: 1 100%;
    }
    .article {
        text-align: left;
    }
    header {background: black;color:white;}
    footer {background: #aaa;color:white;}
    .nav {background:#eee;}
    .nav ul {
        list-style-type: none;
     padding: 0;
    }
      
    .nav ul a {
     text-decoration: none;
    }
    @media all and (min-width: 768px) {
        .nav {text-align:left;-webkit-flex: 1 auto;flex:1 auto;-webkit-order:1;order:1;}
        .article {-webkit-flex:5 0px;flex:5 0px;-webkit-order:2;order:2;}
        footer {-webkit-order:3;order:3;}
    }
    </style>
    </head>
    <body>
    <div>
    <header>
      <h1>Service Request</h1>
    </header>
    <nav>
    <ul>
      <li><a href="#">SR ID</a></li>
     
    </ul>
    </nav>
    <article>
      <h1>Title :- $Context/Property[Type='WorkItem!System.WorkItem']/Title$</h1>
      <p> Description</p>
      <p>$Context/Property[Type='WorkItem!System.WorkItem']/Description$ </p>
     
    </article>
    <footer>Copyright © .com</footer>
    </div>
    </body>
    </html>

    it still look this way:

    So, if it's true and description with multiline (string) of text can be displayed in html notification in multiline of text it would be nice if you show me an example of code i need to use.

    • Marked as answer by Nikolas Page Monday, September 19, 2016 6:04 AM
    • Unmarked as answer by Nikolas Page Monday, September 19, 2016 6:04 AM
    Wednesday, September 14, 2016 1:40 PM
  • i Just look into this issue in my test lab ....to allow Multi line String ..there is one solution ..

    step 1:-  Download Service Manager Authoring tool ..

    Step 2 :- Import your Service Request management pack and extend with new one...

    Step 3 :- After extended Form ...go to the description string and Select it ..go to the properties and select the Multi line ...

    Step 4 :- Save it and seal it ...

    Customized is only the solution of your question...

     

     
    Monday, September 19, 2016 3:18 AM
  • Hello  Abhishek Pangerkar, i've just looked in the Authoring tool and there is no option to set property to multiline.

    Richtext is also not an option because it's works the same way as description filed in html.

    It look like no one use html notification or not use description filed in it, so maybe i shouldn't too

    Friday, September 23, 2016 1:47 PM

  • Monday, October 3, 2016 4:02 AM
  • Abhishek hello.

    I've accedently found the solution here

    The answer is tag <pre>description</pre>

    • Marked as answer by Nikolas Page Wednesday, October 5, 2016 11:43 AM
    Wednesday, October 5, 2016 11:43 AM