Custom Form, copy user field data to message body

Status
Not open for further replies.

Scalpel4

New Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
I'm betting this has been covered in here, but I'm not finding it. I've done some VB in the past and am pretty good with macros in Excel and Word, but this one's a little more interesting.

I've got a form I built for help desk with 6 custom fields. I'd like to copy any data entered into the fields to the message body upon hitting send. I've built the form and the fields on page 2, then set the address value in the to field, now I just need to get the data to populate the message body like this example:

Issue:
DATA FROM CUSTOM FIELD 1

Description:
DATA FROM CUSTOM FIELD 2

Steps Taken:

DATA FROM CUSTOM FIELD 3
 

Scalpel4

New Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Just to show I'm not trying to get someone else to write this for me, this is what I've tried without success. I added this code to the send routine which didn't work.

Code:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Function Item_Send()
Body = ""
Body = Body & "Description"&
UserProperties.Find("Description").Value & vbcr
Body = Body & "Preconditions"&
UserProperties.Find("Preconditions").Value & vbcr
Body = Body & "Steps to Recreate"&
UserProperties.Find("Recreate").Value & vbcr
Body = Body & "Actual Results"&
UserProperties.Find("Results").Value & vbcr
Body = Body & "What was expected"&
UserProperties.Find("Expected").Value & vbcr
Body = Body & "Additional Info"&
UserProperties.Find("ExtraInfo").Value & vbcr
End Function
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Shoot, I meant to test this yesterday but got sidetracked. Can you zip up the form and upload it so I dont have to rebuild it? It will save me some time.
I would probably do a before send, but would need to test it to see if it works.
 

Scalpel4

New Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Shoot, I meant to test this yesterday but got sidetracked. Can you zip up the form and upload it so I dont have to rebuild it? It will save me some time.
I would probably do a before send, but would need to test it to see if it works.
Thanks! I stripped out the code above because I couldn't get it going.
 

Attachments

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Sorry for spamming the forms address - I forgot to change it to my address a few times.
I had forgotten about this - Custom Form Security Changes - you need it set to use scripts in custom forms.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Ok... I think it is working now...
You need to set these keys per the article I linked earlier.
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\16.0\Outlook\Forms\TrustedFormScriptList]
"IPM.Note"=""
"IPM.Note.freshservice"=""
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\16.0\Outlook\Security]
"DisableCustomFormItemScript"=dword:00000000


This code works - I also added an item open, in part to change the email address but also to open the form to the Request tab - this works great if the recipient doesn't have the form installed (and its not in the org forms library)
Code:
Function Item_Send()
strNewBody = "Description: " & item.UserProperties.find("Description").Value & vbcrlf
strNewBody = strNewBody  & "Preconditions: " & item.UserProperties.find("Preconditions").Value & vbcrlf
strNewBody = strNewBody & "Steps to Recreate: " & item.UserProperties.find("Recreate").Value & vbcrlf
strNewBody = strNewBody  & "Actual Results: " & item.UserProperties.find("Results").Value & vbcrlf
strNewBody = strNewBody  & "What was expected: " & item.UserProperties.find("Expected").Value & vbcrlf
strNewBody = strNewBody  & "Additional Info: " & item.UserProperties.find("ExtraInfo").Value & vbcrlf
item.body = strNewbody
item.Save
End Function

Sub Item_Open()
  Item.GetInspector.SetCurrentFormPage("Request")
End Sub
2018-10-02_22-46-02.png
 
Last edited:

Scalpel4

New Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
You are a WONDERFUL person! I'll test this out ASAP, and no worries for the spam!
 

Scalpel4

New Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Not having any luck with it. The recipient isn't an outlook client, its an automated system that processes HTML and plain text emails. I'll keep testing, maybe I'm doing something wrong, I probably missed something in the article.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Is the contents of the form being sent correctly? You should see this in your sent folder. If not, did you set the registry keys?

You need to publish the form and use the form name in the registry - AFAIK, you cant use vbscipt in templates any more (due to the security changes last summer).
"IPM.Note.freshservice"=""
 

Scalpel4

New Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Thanks. I'm seeing the data in the fields in my sent log, and if I send the data to a different recipient they get it in the fields, but I'm net getting the data to copy to the message body.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
This is a message in the Sent folder in one of my test sends - The failures only have my signature.
2018-10-04_11-48-23.png
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
You are sending it from your outlook to the freshservice account? If so, it should look like that in your sent folder.
 
Status
Not open for further replies.
Thread starter Similar threads Forum Replies Date
G Copy Contact field to Appointment Custom Form Field Outlook VBA and Custom Forms 2
M Copy "To" Address Value from a Newly Created Email to the "To" Address Field of Custom Form Using Outlook 4
I Error saving screenshots in a custom form in outlook 2016, outlook 365 - ok in outlook 2013, outlook 2010 Outlook VBA and Custom Forms 5
M VbScript for Command Button on Contacts Custom Form Using Outlook 1
G Other users can't see P.2 with custom fields in Form Outlook VBA and Custom Forms 0
O Create a custom contact form - questions before messing things up... Outlook VBA and Custom Forms 4
L Custom Form Tutoral? Outlook VBA and Custom Forms 6
D Lost Access to Custom Form Outlook VBA and Custom Forms 4
M vCard does not have user-defined fields from my custom contact form (365) Using Outlook 1
S Outlook Custom Form Scripting only working when clicking on "Run this form" Outlook VBA and Custom Forms 2
Victor_50 Outlook 2013 Custom Contact Form starts with "E-mail 2" Outlook VBA and Custom Forms 2
C Custom Form (seperate layout pages and message reading pane) Outlook VBA and Custom Forms 0
C Reading Pane for Custom Form Outlook VBA and Custom Forms 2
N Custom Form Controls Not Visible To Recipient Outlook VBA and Custom Forms 3
Randy Redekopp How To Merge Contact Info to Email Custom Form Template Using Outlook 2
D Problem with custom form including _DocSiteControl1 Outlook VBA and Custom Forms 0
C Custom Outlook Form - Populate Information from Radio Button / Check Box Using Outlook 0
W Message class changes of a custom form changes to the default form Using Outlook 2
A Possible to hide ribbon with custom appointment form? Outlook VBA and Custom Forms 3
Andrew Quirl Custom form to route requests based on input criteria Outlook VBA and Custom Forms 1
D Using a VBA Custom Form to Send Reoccurring Email Upon Task Completion Outlook VBA and Custom Forms 4
W Setting up a custom form Outlook VBA and Custom Forms 2
A Greyed out checkbox in custom form Outlook VBA and Custom Forms 4
Z Outlook Custom Form: Adding Dropdown(Project Code) at the end of subject Outlook VBA and Custom Forms 0
Z Adding dropdown list using custom form Outlook VBA and Custom Forms 7
J autocomplete function in custom form Using Outlook 1
D Custom form with html hyperlink Outlook VBA and Custom Forms 7
D populating listbox on custom form from Access Outlook VBA and Custom Forms 7
D Custom Form Accept and Reject Command buttons Outlook VBA and Custom Forms 2
D create an html table in outlook custom form 2010 using vba in MsAccess Outlook VBA and Custom Forms 7
Potty Ash MS Outlook 2010 custom form - validation or formula to request user to check a checkbox Outlook VBA and Custom Forms 16
J Custom form code doesn't run Outlook VBA and Custom Forms 2
R Custom Contact Form how to update when loaded. Outlook VBA and Custom Forms 6
S Custom form with dropdown Using Outlook 0
P Custom form reverts from task Outlook VBA and Custom Forms 1
L Create Custom Form Using Outlook 0
L Outlook Custom Form Using Outlook 2
Diane Poremsky The custom form cannot be opened. Outlook will use an Outlook form instead. New Slipstick.com Articles 0
Y Creating custom appointment request form with multiple mail recipients Outlook VBA and Custom Forms 5
J Can Click to Drag Custom Form Field But Cannot Drop When Designing in Outlook 2007 Outlook VBA and Custom Forms 2
A Custom form not showing when recurrence is set for a meeting Using Outlook 0
A Get shared calendar name or id in custom appointment form Using Outlook 0
A Updated custom form not showing with old items Outlook VBA and Custom Forms 2
C Custom Application Form send Email to Another User Using Outlook 1
G Adding a contact to Outlook with a custom form using Access VBA Outlook VBA and Custom Forms 1
A From box in custom outlook Form Outlook VBA and Custom Forms 0
M Recurring icon for custom form task item Outlook VBA and Custom Forms 6
X Help with custom form which is very similar to Tasks Outlook VBA and Custom Forms 6
T Create custom calendar entry form... Outlook VBA and Custom Forms 3
J Best approach for restarting custom task form development after seemingly corrupt form environment Outlook VBA and Custom Forms 0
Similar threads


















































Top