Use Mailtemplates in Script to create content

Hi everyone,

I have created a script that calls an API of my ticketing system to create a ticket based on a process.

I would like to fill the Ticket body with a richmail template i created already already.

I tried to retrieve the dialogrichmail body from the database, but unfortunately, I received the following error: "ParameterValue1 Content trimmed (2000) chars."

Is there any other way to use the mail templates in a script?

Thanks for your help!

  • Can you please explain in more detail where or in what part of your code you retrieve the error?

  • Hey Markus, so this is what I did:

    • I created a Process on Personwantsorg
    • There is a process step "Create Ticket" with the "ScriptComponent - ScriptExec" process task
    • Parameter 1 is defined as the following: 
      Dim f As ISqlFormatter = Session.SqlFormatter()
      
      Dim WhereClause As String = f.UidComparison(Table.DialogRichMailBody.UID_DialogRichMailBody, "myUID")
      
      Dim myQuery As Query = Query.From(Table.ADSAccount).Where(WhereClause).Select(Table.DialogRichMailBody.RichMailBody)
      
      
      Value = Session.Source().GetSingleValue(Of String)(MyQuery)

    Wehen the process is executed i can see the following data in the parameter1 field in the Job queue: 

    ParameterValue1	Content trimmed (2000) chars: Content trimmed (2000) chars: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    	<head>
    		<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8" /><title>
    		</title>
    		<style type="text/css">
    			.cs2663CC92{text-align:left;text-indent:0pt;padding:0pt 0pt 0pt 0pt;margin:0pt 0pt 0pt 0pt}
    			.cs59E7F380{color:#000000;background-color:transparent;font-family:Arial; font-size:12pt; font-weight:normal; font-style:normal; }
    			.cs7AFD2EA8{color:#800000;background-color:transparent;font-family:Arial; font-size:12pt; font-weight:normal; font-style:normal; }
    			.cs162A16FE{}
    			.cs186B70F8{width:115.4pt;padding:0pt 5.4pt 0pt 5.4pt;border-top:none;border-right:none;border-bottom:none;border-left:none}
    			.csE847B720{color:#000000;background-color:transparent;font-family:Arial; font-size:12pt; font-weight:bold; font-style:normal; }
    			.csE7C8ADD9{width:379.9pt;padding:0pt 5.4pt 0pt 5.4pt;border-top:none;border-right:none;border-bottom:none;border-left:none}
    			.csC56FC3F{text-align:left;text-indent:-99pt;padding:0pt 0pt 0pt 0pt;margin:0pt 0pt 0pt 99pt}
    			.csD4ED0E7F{color:#0000FF;background-color:transparent;font-family:Arial; font-size:12pt; font-weight:normal; font-style:normal; text-decoration: underline;}
    			.cs81AE8C05{color:#234B8D;background-color:transparent;font-family:Arial; font-size:9pt; font-weight:bold; font-style:normal; }
    			.cs4E24484E{color:#000000;background-color:transparent;font-family:Arial; font-size:9pt; font-weight:normal; font-style:normal; }
    			.cs7FB95471{color:#0070C0;background-color:transparent;font-family:Arial; font-size:9pt; font-weight:normal; font-style:normal; text-decoration: underline;}
    			.cs2CAA79F6{color:#000000;background-color:transparent;font-family:Arial; font-size:10pt; font-weight:normal; font-style:normal; }
    			.cs8CD80EF5{color:#0000FF;background-color:transparent;font-family:Arial; font-size:10pt; font-weight:normal; f

  • Do you look in the JobHistory with JobQueueInfo or where exactly?

    What version are you using?

  • Exactly, i am looking at the JobHistory in Job Queue Info.

    I am using Version 9.2.0.

  • The parameters stored in the JobHistory are truncated to 2000 characters by default to save storage space. A configuration parameter allows you to change this (Common\ProcessState\JobHistory\TrimLongParameters) but be aware that your database will likely need more storage space if you are dealing with many jobs with largely sized parameters.

    Without knowing the whole customization of yours, can't you load the rich mail template in your script creating the ticket instead of passing it to the script as a parameter.