0 Replies Latest reply on Jan 14, 2019 8:24 AM by MattH

    UI Actions - Creating an Email Record

    MattH Rookie

      As a bit of a backstory (and to try and avoid the XY problem), I've been asked to create some form emails our SDAs can send from Incidents. One of the key requirements is that the SDA needs to review the email before it is sent, so using a Send Email quick action is out. Templates for Journal#Email are unfortunately also out because you don't seem to be able to access templates for an extended business object from a view of the group business object. Our Incident layout uses the Activity History child panel, which shows the group BO Journal#, and we don't want to split the Notes and Emails into separate child panels. I know this has been solved by users in the past by using an intermediate object, but this feels like a 'messy' solution to me. My current solution is to use a UI Action.

      UIAction.png

      Unfortunately, I've run into a few niggling issues with this.

       

      1. NewObject command opens in a new tab

      The preference for the new email would be to view it in the same tab as the Incident. However, the documented example for creating a new object will open it in a new tab. Meanwhile, the example for creating a child business object will open it within the current tab.

      The example for Command ID = NewObject uses Scope = ObjectWorkspace, while the example for CommandID = NewChildObject uses Scope = CurrentTab:ObjectWorksspace:ObjectView.

      I've tried using the Scope for NewChildObject in NewObject, however this doesn't work and the Email tab is opened but without a new record. Is it possible to have the NewObject command open within the current tab? Is further documentation available on possible values for Scope with each command?

       

      2. NewChildObject doesn't allow for the passing of fields

      The NewObject command allows for passing values from the current BO to the new BO via the 'Fields' attribute, which is an array of Name/Value pairs. I have tried including a Fields attribute in the NewChildObject command data, but the values were not passed to the newly created business object. Is there an equivalent field in the NewChildObject command?

       

      3. Expression evaluation in CommandData

      The examples of passing data from the current BO to a new BO via the NewObject command include references to the fields of the current BO, e.g. {'Name': 'ParentLink_RecID', 'Value': '$(RecId)'}. The $() syntax suggests that this is being evaluated as an expression, however using anything but a field name results in the expression being unprocessed, e.g. '$(CurrentUserDisplayName())' produces $(CurrentUserDisplayName()). Is it possible to use expressions within the CommandData of a UI Action?

      In particular, our Symptom field is stored as Unicode and I'd want to replace some of the special characters with HTML entities for the body of the email, e.g. replacing line breaks with <br>.