How Can We Help?

Search for answers or browse about Sintel Forms.

Set email address from person field

You are here:

Scenario

You want to set the value of text field to the email address of a user selected in a person field.

Solution

This can be accomplished by adding a simple rule within the Logic screen that grabs the value of the person field, retrieves the email address and sets the text field.

  1. Title: Extract email from Person field
  2. Conditions: None
  3. Steps: Execute custom js function

  Code

// Get the value of the field called HostName
const personFieldValue = getValue("HostName");

if (personFieldValue && personFieldValue.length > 0) {
   // As people pickers store their values in an array we need to extract its first element
   setValue("HostEmail", personFieldValue[0].emailAddress);
}
else {
  // if no person is selected - clear the value
   setValue("HostEmail", "");
}

  Example

 

Once you have configured this it should work like this:

   

Was this article helpful?
0 out of 5 stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.
Table of Contents