Editing from Inbox - can I make some fields read-only once they've been previously completed?

3995
10
Jump to solution
04-11-2021 06:38 AM
SaraMiller
New Contributor III

I have a survey with repeats which will use the Inbox to edit and add records to the repeat.  However, I want to prevent the "metadata" that sits outside the repeat from being edited by subsequent users after the initial submission.  I was trying to use an "if" statement in the readonly column, but getting nowhere.  XLS form attached.

 

Fields to become read-only when editing from Inbox:

Region

Site

Other Site Name

Other Site Grid Reference

Platform Name or ID

Platform Map Location

1 Solution

Accepted Solutions
JamieLambert
Occasional Contributor III

Hi @SaraMiller,

Try using the pulldata("@property", 'mode') function. Example image below - where Question 2 is readonly when the record is opened via the Inbox, and editable in a new survey.

The pulldata("@property", 'mode') function. From the Survey123 documentation (Formulas), "This has three possible values, returning new if the user is producing a new survey response (including one copied from an existing survey), returning edit if the user is editing an existing response, and returning view if the user is viewing an existing response in read-only mode."

This can be used for readonly and relevant. I have used this in forms with a required image questions (for a new survey) that is also edited via the Inbox - Survey123 Image Question: Disable 'Required' in In... - Esri Community

Inbox-Read-Only.png


Hope this helps!

Jamie.

View solution in original post

10 Replies
JamieLambert
Occasional Contributor III

Hi @SaraMiller,

Try using the pulldata("@property", 'mode') function. Example image below - where Question 2 is readonly when the record is opened via the Inbox, and editable in a new survey.

The pulldata("@property", 'mode') function. From the Survey123 documentation (Formulas), "This has three possible values, returning new if the user is producing a new survey response (including one copied from an existing survey), returning edit if the user is editing an existing response, and returning view if the user is viewing an existing response in read-only mode."

This can be used for readonly and relevant. I have used this in forms with a required image questions (for a new survey) that is also edited via the Inbox - Survey123 Image Question: Disable 'Required' in In... - Esri Community

Inbox-Read-Only.png


Hope this helps!

Jamie.

SaraMiller
New Contributor III

Thank you so much, @JamieLambert, that's worked!

rachelm
New Contributor III

Hi @JamieLambert 

we're using this with a pulldata function and it does a great job of calculating a new value when mode="new", and of preserving an existing value when mode="edit."

However the field itself is NOT read only in the native app or web form. So while I  get the desired results, it is editable. Is this a bug feature?

LaurenFrick_RES
New Contributor II

Hi Rachel,

I recently saw documentation about this on the Survey123 website. The documentation recommends using the following expression in the readonly column rather than storing the value in a hidden question for the reason you described above:

pulldata("@property", 'mode') = 'edit'

 

This seems to be working for me in both the Survey123 App and online, so it might be worth a try.

0 Kudos
m3
by
Occasional Contributor II

I am not able to place ${survey_mode} = 'edit' into the readonly field, it fails validation restrictions on the cell, is there another method to set a field to edit just once?

0 Kudos
DougBrowning
MVP Esteemed Contributor

It will yell at you but it does work as long and it is true.  

0 Kudos
santamariaa
New Contributor III

It appears that when any of the pulldata("@property", 'mode') settings are placed into the Survey 1,2,3 "read only" field the setting is not honored. As described by @rachelm above. In this case I am using a text field and setting the pulldata("@property", 'mode') = 'edit' in the read only field. The pull data property mode works as expected in the relevant field. The screenshot shows where the expression works and doesn't work. @IsmaelChivite Is this to be expected? 

santamariaa_0-1690810433766.png

 

0 Kudos
IsmaelChivite
Esri Notable Contributor

I was not aware that pulldata("@property", 'mode') was not working in the readonly column when the record is opened from the Inbox. I do not think this is expected. @ZacharySutherby  Thoughts?  This is probably worth documenting as a BUG via Tech Support.

 

As a workaround, you may want to create a calculate question to get the mode, and then reference that value from the readonly column.  Do not forget to set the esriFieldType column to null on the calculate to avoid having that output go into your survey layer.  

santamariaa
New Contributor III

I should have clarified that this is not pulling from an inbox but a brand new survey in creation. So maybe I am misunderstanding the use of the mode. It seemed that the documentation implied that if I put "pulldata("@property", 'mode') = 'edit'" in the read only column it would make that field read only in an editing environment. So workflow 1. survey response is submitted in "new" mode and some fields are hidden using the pulldata property in the relevant column  2. we pass that survey to a dashboard for someone else to review in "edit" mode on fields hidden in the initial survey BUT make the original data submittal fields read only using the pulldata property mode in the read only column. 

 

We are just exploring this workflow as an alternative option to the idea of creating several surveys with hidden fields depending on who/how the end user is accessing the information.

0 Kudos