Adding text blocks into Comments in Sales Order Entry

We have (approx. 100) many different standard text blocks which we would like to easily insert and copy into the different comment tabs available in sales order entry. the text blocks are language dependent, the language should be based on the language of the customer-sold-to. You can already apply in comments field the right mouse and choose “Insert text file”, however we can’t use this because we have too many different text blocks. In Windows Outlook you can implement add-ons which allow you to type e.g. 3 or 4 characters and then in Outlook a complete sentence will show up.
Any suggestion, tip or advice is welcome.

We added a dropdown to the form, and populated it with all the “templates”. This dropdown is not bound to any field.

Then use an event to detect the change of the dropdown. When it changes, added the dropdown’s text to the comment.

I can give you the code if you need.

Here’s exactly what I did on PO Entry.

  1. Add an EpiUltraCombo to the sheet, just below the comment textbox. I named mine ucbComTemplates

    1.1 Leave the Binding blank
    1.2 Set the Text property to… Select Comment Template
    1.3 Add the text items you want the user to be able to select (one per line) to the ListItems property. I like to put an asterisk at the beginning of each line
    image
  2. Add the following function (sorry that it’s VB - we copied it over from V8) via the script editor
Private Sub ucbComTemplates_RowSelected(ByVal Sender As Object, ByVal Args As Infragistics.Win.UltraWinGrid.RowSelectedEventArgs) Handles ucbComTemplates.RowSelected
		' ** Place Event Handling Code Here ** 
	    ' GUID of epiTextBox1 (the comments text) 2e5cc17b-e11e-4317-adfe-c45f3722e1da
        
        Dim txtComments as epiTextBox = Ctype(csm.GetNativeControlReference("2e5cc17b-e11e-4317-adfe-c45f3722e1da"),EpiTextBox)
        
        if(ucbComTemplates.Text <> "Select Comment Template") then
            if(len(txtComments.Text) > 0) then
                txtComments.Text = txtComments.Text + chr(13) + chr(10)
            end if
            txtComments.Text = txtComments.Text + ucbComTemplates.Text
        end if 
    End Sub

Some improvements would be:

  • Use UserCodes to populate the dropdown’s itemList. That way editing the template list wouldn’t require updating the customization.
  • Use a Combo instead, and prefix your templates with a code. Then users can type the code and it would jump right to that comment. In the function to add the text, strip off the code.
1 Like

This looks like a good system. I was thinking along similar lines but haven’t had to actually implement anything directly equivalent so didn’t want to jump in before someone who had.

Is there a reason you didn’t use UD tables? You note a possible improvement using UDCodes, but for me, a dedicated UD table would seem to be ideal for this use case. You can even use the keys to sort the language requirement. Key1 = comment code, Key2 = language, Character01 = comment text (or something like). And of course a comment management screen based on the UD table form.

1 Like

The original request from purchasing only had two “items”. So hard coding it in the customization was the fastest (and most short sighted)

You will probably need to go the UD table route. I forgot that UD codes are limited in length.

If you want to have the user be able to start typing the comment (or its code as a prefix), you’ll need to change the event from RowSelected to OnLeave or something that doesn’t fire until the actual comment is reached. If you never want it to be more one of the comments, just have it replace the existing text.

FWIW -
I’m far from an expert here. I’m good at “hacking” my way to a solution. But better ones almost always exist. Knowing that, I post my non-ideal solution in hopes that an expert here will correct me, and then I’ll have learned it too!