Hi, I am having an issue with my app, I am g...

(Yee Group) #1

Hi,

I am having an issue with my app, I am getting an error " Value ‘Site Query’ in field ‘Status’ cannot be converted to type 'Enum." I know that this isn’t in the list of allowed values. I thought I could bypass this by adding a valid_if statement for ‘Status’ however this only gets past the ‘Value is invalid’. I also know this can be solved by adding the option to add values to the enum but I don’t want anyone else to be able to do so.

Is there a way to use USEREMAIL() to allow exclusive enum values depending on the email address the user uses? For example:

My Email has the option of ‘Started’, ‘Completed’ and ‘Site Query’.

and other users only have the options of Started and Completed.

I can change status to ‘Query’ through the mySQL database and this runs ok on the app, however I can’t set the value through the app which I want supervisors on site to be able to do. Any help would be appreciated.

Kind Regards

Lee

(Levent KULAÇOĞLU) #2

@RezaRaoofi can you give a hand to @Yee_Group?

(Aleksi Alkio) #3

In the Valid_If you can set the list like IF(USEREMAIL()=“yeegroup@gmail.com”,{Started,Completed,Site Query},{Started,Completed}). Please remember that this example will work only when they are filling the form. If your user needs to modify the record and you have set the value to “Site Query”, they can’t save it because the validation rule is not TRUE.

(Praveen Seshadri (AppSheet)) #4

A comment — if it is an Enum type, then it has a list of allowed values as part of the type definition. It optionally can enable ‘Allow Other Values’. If not, the app will not accept any value other than what is in the list.

Valid_If is a way to further refine what is allowed. For example, if an Enum has values A, B, … Z. You cannot give AA as a value unless you enable the ‘Allow other values’ flag. It does not matter if the Valid_If allows it.

(Aleksi Alkio) #5

One approach for this is using action button(s) to write that value. You can show the Site Query button only for you and others will see only Started or Completed buttons.

(Yee Group) #6

@Aleksi_Alkio This is how I tried to resolve the issue, however as @praveen has mentioned, It will not accept the value due to disabling ‘Allow Other Values’.

My follow on question, is it possible to allow other values using USEREMAIL() or show selected Enum values for general users and the full range of Enum values for one email?

(Aleksi Alkio) #7

You could use an IF statement in Valid_If like… IF(USEREMAIL()=“name@email.com”,{Option1,Option2,…Option10},{Option1,Option6,Option7}). Please aware that if you have chosen Option2 with this email address and then other user opens the record, they can’t save it without changing the value first. They can’t save the existing value because it’s not valid.

(Yee Group) #8

@Aleksi_Alkio I will try this solution, as the idea behind this is : The user does work, the supervisor can query this back to them and they rectify the problem. So they should have to change it once the problem has been rectifies, I will try this now. thank you.

(Aleksi Alkio) #9

You’re welcome