Open Inbox Survey in Edit or View based on username or other survey data value

1623
7
Jump to solution
06-08-2021 01:26 PM
LarryWiebe
Occasional Contributor

Hi All,

Is there a way to open an Inbox survey from the map or list in Edit or View mode based on the username, or possibly any attribute in the survey itself?  

We have a set of Quality Reviewers on our surveys that open/edit surveys once the field users set them to a completed state.  I would still like the field users to be able to open the surveys from the inbox, but only in View mode.

Thanks,

Larry

0 Kudos
2 Solutions

Accepted Solutions
UriGilad_EsriAu
Esri Contributor

Hi Larry,

If you’re using the app (this solution is not applicable in the web version), you can:

  1. Add a list of permitted usernames (to your choices list) that are allowed to edit the survey. You can also have a list of approved users in a csv in the media folder and use the pulldata to check if the user is in the list or not. Bottom line: create a question by which you can differentiate if the user is allowed or not allowed to edit. Let’s call that question ‘edit_permission’. When the survey is opened it will automatically be populated as ‘yes’ or ‘no’ depending on your list of allowed users.
  2. For each question of the survey, add in the readonly field a condition:

${Survey status} = ‘completed’ and ${edit_permission} = ‘no’

This way, after the survey is initially submitted, the survey status becomes ‘completed. Then, next time it opens, if the user is not allowed, the condition above will be filled and the question will be read only. If the user is allowed, the condition will not be filled and the questions will not be read only, so it can be edited.

If this answer solved your question or if you found it helpful please mark it accordingly to help others who have the same question.

View solution in original post

PrachiPatel
New Contributor III

Does this mean that users who have editing permission can edit surveys in the inbox folder, but the submitter can still edit their survey in their Sent folder?

I need to have a process where submitters (who do not have an ESRI account) can edit their own submitted surveys, but not those of other submitters AND my team, as reviewers, can edit all submitted surveys. Is this possible?

View solution in original post

7 Replies
UriGilad_EsriAu
Esri Contributor

Hi Larry,

If you’re using the app (this solution is not applicable in the web version), you can:

  1. Add a list of permitted usernames (to your choices list) that are allowed to edit the survey. You can also have a list of approved users in a csv in the media folder and use the pulldata to check if the user is in the list or not. Bottom line: create a question by which you can differentiate if the user is allowed or not allowed to edit. Let’s call that question ‘edit_permission’. When the survey is opened it will automatically be populated as ‘yes’ or ‘no’ depending on your list of allowed users.
  2. For each question of the survey, add in the readonly field a condition:

${Survey status} = ‘completed’ and ${edit_permission} = ‘no’

This way, after the survey is initially submitted, the survey status becomes ‘completed. Then, next time it opens, if the user is not allowed, the condition above will be filled and the question will be read only. If the user is allowed, the condition will not be filled and the questions will not be read only, so it can be edited.

If this answer solved your question or if you found it helpful please mark it accordingly to help others who have the same question.
LarryWiebe
Occasional Contributor

Thanks for the quick reply!

I have put in this functionality almost exactly as you have described, but the reason I asked to be opened in view mode, is that you can't make the ${Survey status} = ‘completed’ read only within the survey, which then allows the any user to open from the inbox and change the ${Survey status} = ‘inprogress’ and proceed to change the values again, which can undo changes a quality review may have done...  My current solution is that I have another field that I mark as locked or unlocked, a post process see the completed status and set the locked attribute.  A QA user can then edit as required and if need be unlock and set back to inprogress if additional field work is required.  The only gotcha is that the post process is on a 4 hour schedule so there is a time gap where things could get edited when we don't want it edited...  I am tring to get PowerAutomate authorized corporately to close this gap.  

My other solution was to ask if there is a way to force it open in View mode...

Larry

UriGilad_EsriAu
Esri Contributor

Hi Larry, 

It took me a while but I think I found a solution.

1. Add the 'EditDate' field from your feature service as a hidden question (make sure it's a null in esri:type). When the survey is first created, this field will be empty because the feature was never submitted. Upon first submission the field will be populated with the submission time.

2. Add a question 'Are you ready to finalize your survey?' with only one answer in choice list  - 'Yes'.

3. Put a condition in the question's read only field, that if EditDate is not empty (string-length(${EditDate})>0), then it's read only. This way, if the survey is re-opened, the user can't 'unlock' the finalize question. See attached xls as a sample.

Of course in your case your read only condition should be string-length(${EditDate})>0
and ${edit_permission} = 'not allowed'. This way when an editor opens the survey it will be readable, but when a viewer re-opens it both conditions will be filled and the survey will be locked.

Alternatively, you can skip the 'finalize' question and apply these conditions directly to all your questions.

Let me know how it goes, 

Uri

If this answer solved your question or if you found it helpful please mark it accordingly to help others who have the same question.
PrachiPatel
New Contributor III

Does this mean that users who have editing permission can edit surveys in the inbox folder, but the submitter can still edit their survey in their Sent folder?

I need to have a process where submitters (who do not have an ESRI account) can edit their own submitted surveys, but not those of other submitters AND my team, as reviewers, can edit all submitted surveys. Is this possible?

UriGilad_EsriAu
Esri Contributor

Hi @PrachiPatel,

Yes, I'm not sure this trick works with Sent folder. I'd disable the Sent folder and let the survey go to Inbox. Then, if you want to limit what users can see in their inbox, you can add a Query expression on the Inbox (in Survey123 Connect) to show records where the username record = user, or, in the Collaborate tab (in Survey123.com) allow viewers to view only their own submitted records.

If this answer solved your question or if you found it helpful please mark it accordingly to help others who have the same question.
0 Kudos
PrachiPatel
New Contributor III

Hi @UriGilad_EsriAu 

My challenge with putting a query on the inbox where username record = record is that my survey is public because we do not want submitters to have to spend money to get an ESRI account.

Could I let the submitter continue editing by keeping the sent folder active and put a query on the inbox folder where it only lets reviewers download surveys?

0 Kudos
UriGilad_EsriAu
Esri Contributor

Hi @PrachiPatel,

If you know your reviewers' usernames you can apply the solutions above, where you 'lock/read only' the survey to the public, but keep it editable to those on your permitted csv list.

If all your reviewers have something in common, e.g. the same email suffix or an xxx_yourcompany format at the end  of their Esri username, you can set a read only calculation that limits editing based on that. For example, if email field has @yourcompany.com then readonly = 'no', otherwise readonly='yes'.  Public can then still open submitted surveys but won't be able to edit (use the trick with the dateCreated field as shown above). Note that this will only work on the mobile app, not the web version.

Another solution which I think will be easier to manage is to just create a new, duplicate survey (submitting to the same layer or a view layer), where you can define completely different Inbox/Sent, submission, and viewing rules.

If this answer solved your question or if you found it helpful please mark it accordingly to help others who have the same question.
0 Kudos