Pass Username and Date to Survey123 Form

483
12
Jump to solution
12-08-2023 10:02 AM
kapalczynski
Occasional Contributor III

From Field Maps and a webhook I can pass the Global ID to a RELGlobalID like so

field:REL_GLOBALID={GLOBALID}&

href="arcgis-survey123://?itemID=cb33fc9a37xxx440146&amp;field:REL_GLOBALID={GLOBALID}&amp;callback=https://fieldmaps.arcgis.app" rel="nofollow ugc" target="_blank">Add Form</a>

 

But Im curious how to pass the Current Date to a date field and the logged in user to a username field

1. Can I use the NOW to denote existing date and time?

           field:SomeDateFiled={NOW};

2. What about the logged in user?

            field:UserName={username};

0 Kudos
1 Solution

Accepted Solutions
GregKeith
Occasional Contributor III
12 Replies
kapalczynski
Occasional Contributor III

Got the date with this 

field:DATETIME={NOW()}&amp;

Now just need the logged in Username

 

0 Kudos
kapalczynski
Occasional Contributor III

I tried the below with no success

 field:UserName={username};

 field:UserName={theusername};

0 Kudos
RyanUthoff
Occasional Contributor III

Does the username have to come from the map? Or can it come from the username of the Survey123 form? If it can come from the form, then you can just add a row to the form with a "username" field type.

0 Kudos
kapalczynski
Occasional Contributor III

No there is no username in the Field Maps data itself... I was trying to push the logged in user from Field Maps into a field value in Survey123... if possible

0 Kudos
abureaux
MVP Regular Contributor

I literally just had this come up yesterday. Unfortunately, I haven't been able to find a way to pass the username to S123.

I assume I have the same setup as you: web map which requires users log in/authenticate to use (in my case, using SSO), then pass that information into S123.

If someone has a solution, it would be appreciated.

0 Kudos
DougBrowning
MVP Esteemed Contributor

The arcade code for this can be picky.  See if this post helps   https://community.esri.com/t5/arcgis-field-maps-questions/get-logged-in-username/m-p/1267104

There is also a field type of username that can do it for you in 123.

GregKeith
Occasional Contributor III

In Survey123:

GregKeith_0-1702312394918.png

 

abureaux
MVP Regular Contributor

I don't think this will work exactly, at least for me. I am thinking Viewer Accounts within a web map. So, more like extract that username, and pass a name into a text field in S123.

0 Kudos
kapalczynski
Occasional Contributor III

Didnt think of that.. as they would have to be logged into S123 as well... I think this will work... going to test ... THANKS

0 Kudos