Select to view content in your preferred language

Calculated, Non-Required field causing submission issues

266
7
3 weeks ago
luckachi
Frequent Contributor

I have a field that is not required, but calculated and automatically set to read-only. The field is supposed to select an organization based on the logged in user. If the user doesn't have an associated organization, it should be null - however, the field just has a line through it and it is preventing data from being submitted even though the field isn't required? 

 

It throws a "Failed to calculate" message and when I hit submit the message is "Unable to Submit - 1 attribute failed"

0 Kudos
7 Replies
CodyPatterson
MVP Regular Contributor

Hey @luckachi 

Would you be able to show a screenshot of the submission and the failure? I do know sometimes that a required field will require something in it at least, in mine, I have an else condition at the end which gives a minus symbol or another mark that designated it wasn't entered.

Cody

0 Kudos
luckachi
Frequent Contributor

@CodyPatterson  Sure thing! 

Screenshot_20251113-110707.pngScreenshot_20251113-110704.png

Logs:

Screenshot_20251113-111021.png

It seems to work just fine in the web map and in experience builder and it doesn't throw any issues when I run it in the arcade builder

0 Kudos
CodyPatterson
MVP Regular Contributor

Hey @luckachi 

I see! This is exactly what happened to us as well, do you have these all enabled?

CodyPatterson_0-1763050240975.png

 

It should look like this here:

CodyPatterson_1-1763050249856.png

And this in the map:

CodyPatterson_2-1763050311463.jpeg

Does this match your current setup?

Cody

0 Kudos
luckachi
Frequent Contributor

I do not

Screenshot 2025-11-13 113834.pngScreenshot 2025-11-13 113751.png

but interestingly enough I just changed my arcade script and added $layer into the var user line it worked. Not sure if that would cause any unintended issues.

var user = GetUser($layer);
var username = Lower(user.username);
0 Kudos
luckachi
Frequent Contributor

I wonder if this doesn't work in field maps - to get the logged in username? 

var user = GetUser();
var username = Lower(user.username);

 

0 Kudos
CodyPatterson
MVP Regular Contributor

Hey @luckachi 

The syntax could definitely be it, this is what I have here:

CodyPatterson_0-1763054422138.png

I wonder if the GetUser function you were using was not able to find the origin layer to pull the name from!

Cody

0 Kudos
ChristopherCounsell
MVP Frequent Contributor

There is a known Field Maps defect with GetUser() where you need to specify the portalObject (i.e. the URL)

https://support.esri.com/en-us/bug/the-arcgis-arcade-getuser-function-does-not-work-in-arc-bug-00017...

https://developers.arcgis.com/arcade/function-reference/portal_functions/#getuser

As @CodyPatterson said this will work more reliably:

GetUser($layer).fullName
 
However, only the username will be available offline. I would generally recommend against using fullName if there is any possibility that the maps will need to go offline as the calculation will fail and the edit will need to be discarded.
 
GetUser($layer).username