Post

2 followers Follow
0
Avatar

Help with formatting a discussion post from a custom action.

I'm trying to create a custom action on the project object for project managers to submit a simple weekly project update. 

I created a CA with a user input dialog box that asks for 2 separate text fields and I want to combine them into a discussion post on the project. Where I am running into issues is with how they discussion posts are displayed. I would to format them but I'm not sure where or how I can do that with the style field. 

Can I use HTML markup with-in the body field for the discussion post Custom Action?

Thanks-

Garret Saarinen Answered

Please sign in to leave a comment.

8 comments

0
Avatar

Thanks for the response Tamir. 

Unfortunately I'm having a hard time downloading the app as we have run out of custom fields (already talking to our AE Syed about it) so I'm un-able to install at this time. Can give me an example of how I would format the text in the $Body field? I've searched through a lot of the documentation but cant seem to find any examples. 

Garret Saarinen 0 votes
Comment actions Permalink
0
Avatar

Hi Garret,

 

Please check out the following example (notification upon new case creation):

'<allowallstyles><b>New Ticket&nbsp; (' +$SYSID+') - ' +$Title+' </b> <table style="width:400px; font-family:arial; font-size:12px; text-align:left; margin-bottom:15px; border:1px solid #cccccc;"> <tbody> <tr> <th colspan="2" style="text-align:left; border-bottom:1px solid #ccc; background:#004280; color:#fff; padding:4px; margin:0;">Details</th> </tr> <tr> <td style="width:120px; font-family:arial; font-size:12px; padding:4px; border-bottom:1px solid #ccc; text-align:left; background:#eeeeee;" valign="top">Title</td> <td style="font-family:arial; font-size:12px; padding:4px; text-align:left; border-bottom:1px solid #ccc;" valign="top">'+GetHyperLink(CurrentObject())+'</td> </tr> <tr> <td style="width:120px; font-family:arial; font-size:12px; padding:4px; border-bottom:1px solid #ccc; text-align:left; background:#eeeeee;" valign="top">Domain</td> <td style="font-family:arial; font-size:12px; padding:4px; text-align:left; border-bottom:1px solid #ccc;" valign="top">'+$C_Domain+'</td> </tr> <tr> <td style="width:120px; font-family:arial; font-size:12px; padding:4px; border-bottom:1px solid #ccc; text-align:left; background:#eeeeee;" valign="top">Description</td> <td style="font-family:arial; font-size:12px; padding:4px; text-align:left; border-bottom:1px solid #ccc;" valign="top">'+$Description+'</td> </tr> <tr> <td style="width:120px; font-family:arial; font-size:12px; padding:4px; border-bottom:1px solid #ccc; text-align:left; background:#eeeeee;" valign="top">Importance</td> <td style="font-family:arial; font-size:12px; padding:4px; text-align:left; border-bottom:1px solid #ccc;" valign="top">'+$Severity+'</td> </tr> <tr> <td style="width:120px; font-family:arial; font-size:12px; padding:4px; border-bottom:1px solid #ccc; text-align:left; background:#eeeeee;" valign="top">Due Date</td> <td style="font-family:arial; font-size:12px; padding:4px; text-align:left; border-bottom:1px solid #ccc;" valign="top">'+ToString(($DueDate),"MM-dd-yyyy hh:mm tt")+'</td> </tr> <tr> <td style="width:120px; font-family:arial; font-size:12px; padding:4px; border-bottom:1px solid #ccc; text-align:left; background:#eeeeee;" valign="top">Owner</td> <td style="font-family:arial; font-size:12px; padding:4px; text-align:left; border-bottom:1px solid #ccc;" valign="top">'+GetHyperLink($Owner)+'</td> </tr> <tr> <td style="width:120px; font-family:arial; font-size:12px; padding:4px; border-bottom:1px solid #ccc; text-align:left; background:#eeeeee;" valign="top">Assigned To</td> <td style="font-family:arial; font-size:12px; padding:4px; text-align:left; border-bottom:1px solid #ccc;" valign="top">'+GetHyperLink($AssignedTo)+'</td> </tr> </tbody> </table> <br> <br> </allowallstyles>'

 

Good luck!

Tamir

Tamir Avital 0 votes
Comment actions Permalink
0
Avatar

This is great! I seemed to have missed adding a ' in front of my HTML. 

I'm getting some errors though when I try to use some of the variables in the body post. Is there a certain way that they need to be formatted in order for them to be ready correctly as a variable from the user input form?

Garret Saarinen 0 votes
Comment actions Permalink
0
Avatar

Hi Garret,

 

The variables might not be available in the context of your Custom Action (those should work on Case custom action). Basically you replace them with the variables that you need and get rid of the rest of the code.

 

Please let me know if it makes sense.

 

Regards,

Tamir

Tamir Avital 0 votes
Comment actions Permalink
0
Avatar

I was able to use the variables previously but it just made the formatting of the post too difficult to consume. I was hoping to use some basic HTML and CSS applied to the variables and then put them in a post. 

Garret Saarinen 0 votes
Comment actions Permalink
0
Avatar

Hi Garret,

 

You can use basic HTML like for example:

'<b><font color=red>'+$ProjectManager+'</font></b>'

 

Is that make more sense?

 

Regards,

Tamir

Tamir Avital 0 votes
Comment actions Permalink