Button for emailing

Avatar

Avatar
Level 1
creo6746
Level 1

Likes

0 likes

Total Posts

4 posts

Correct reply

0 solutions
View profile

Avatar
Level 1
creo6746
Level 1

Likes

0 likes

Total Posts

4 posts

Correct reply

0 solutions
View profile
creo6746
Level 1

22-12-2017

I have a fillable form and created a button that users can click on to send to a name that is entered in a text field named Manager.  In the script editor I have the following:

Subject.#subform[0].EmailManager::click - (JavaScript, client)

//Create a variable to hold the document object

var oDoc = event.target;

oDoc.mailDoc({

bUI: true,

cTo: Manager.formattedvalue,

cSubject: Location.formattedvalue + Department.formattedvalue + Subj.rawValue

});

(FYI..Location and department are dropdown boxes and subj. is a text box that already has preset value to it)

When I go to test the form, it doesn't email the name that's in the text field.  Does the cTo: have to be a raw.value? 

What am I missing?????? 

Accepted Solutions (0)

Answers (1)

Answers (1)

Avatar

Avatar
Coach
MVP
radzmar
MVP

Likes

397 likes

Total Posts

2,687 posts

Correct reply

492 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile

Avatar
Coach
MVP
radzmar
MVP

Likes

397 likes

Total Posts

2,687 posts

Correct reply

492 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile
radzmar
MVP

02-01-2018

The formattedValue is a field's rawValue modified by a pattern. You'll use those generally on numeric or date fields but not in dropdown lists.

Use the rawValue instead like this way:

// Declare variables

var oDoc = event.target,

cTo = Manager.isNull ? "" : Manager.rawValue, // If field is empty return empty string instead of null

cSub = (Location.isNull ? "" : (Location.rawValue + " ")) + (Department.isNull ? "" : (Department.rawValue + " ")) + (Subj.isNull ? "" : Subj.rawValue);

// Send form

oDoc.mailDoc({

bUI: true,

cTo: cTo,

cSubject: cSub

});