Solved

Extract email address from People control

  • 28 January 2022
  • 6 replies
  • 720 views

Userlevel 2
Badge +9

I am trying to extract the email address of the People Control from a form within NWC.  I noticed the control is a collection variable so I used the loop to capture the item and I dropped that information into a variable where I displayed it in the log. I needed to see what it really was. Ultimately, I want to take this email address and perform Create Item with on Prem Sharepoint.  If I am able to extract the email address from this control, I will be able to drop it into a People column in Sharepoint.  So here is what I see when I drop the contents into a variable.

{"lastName":"XXXX","mail":"email.address@XXXX.org","firstName":"XXXX","displayName":"XXXX XXXX","id":"auth0|614269949dab75006817515c","tooltip":" XXXX XXXX Email: email.address@XXXX.org Login: auth0|614269949dab75006817515c","source":"vibranium"}

 

This is my first foray into NWC.  In Nintex for Sharepoint, the process is quite simple.  I'm sure I am just missing how to do this.  I'm thinking get string might be the way to get to what I am looking for, but I am just unsure how to set up the formula.  I'm hoping someone knows the best way to get to this information. Thank you.

icon

Best answer by leighburke 28 January 2022, 01:36

View original

6 replies

Userlevel 5
Badge +13

@brianknight If you use the  loop for each action(https://help.nintex.com/en-US/nwc/Content/Designer/Actions/LoopforEach.htm) you will have access to the different properties of the collection(see below).



 

Userlevel 4
Badge +12

Hi @brianknight ,


couple of other ways in addition to the for each from @leighburke 


 


Get item from collection action with an index of 0 (zero), will get you the first item in the collection and can set it to a variable.


The other method and probably the better way given it does not use additional workflow actions is to use a variable on the form.


Euan previously did a video on this one. https://youtu.be/gAP7asv7YDg 


 


Basically it's still a collection on the form use a converttostring function wrapped around the control variable to set the value of a form variable.


 



 


That way the property will be a start form variable in your workflow.


 

Userlevel 2
Badge +9

Thank you. I knew it was probably a simple process and I was just missing something.

Userlevel 2
Badge +9

This is a great video explaining the control.  Thank you very much for pointing it out to me.

Badge

In order to extract just the email address from that variable, you can use the parse() function to convert the string into a JSON object, and then use the dot notation to access the mail property. For example, parse(yourVariable).mail would return "email.address@XXXX.org".

You can then use this extracted email address in your Create Item action with on-prem SharePoint. To set the value of the People column in SharePoint, you would need to use the setFieldValue() function and pass in the extracted email address as the value. For example, setFieldValue("PeopleColumn", parse(yourVariable).mail).

This should work, but the exact formula might vary depending on the specific version of LATERC you are using. Let me know if you need further assistance.

Userlevel 2
Badge +6

@brianknight, if you have the Azure Active Directory connection set up, you can use it to extract info too. That’s what I do.

Reply