I want to create a field with a question (e.g. How was the service of employee x) and allow the employer to pick a result (e.g. good, average, bad) as well as to add comments. However, while i believe the question can be part of the description of the field and the data type for the result a picklist, I also want to associate a textbox data type for additional comments. How might I do this? Thanks!
-
1You can create a Picklist to capture result as Good, Avg or Bad and a Text field (text area as per your req) and have validation rule in place to make sure some value is entered if a result is chosen. Or if these fields are in a Custom built page/component you can handle the situation via code.– C. PraveenkumarAug 8, 2022 at 4:36
-
@C.Praveenkumar yes but how might I link both the result and the comment to the question if there are multiple questions on a page.– H4shBrownAug 8, 2022 at 4:47
-
2You just need to create two fields, One as a question with picklist values and a description field(text area) which you can mandate on filling the above picklist field.– C. PraveenkumarAug 8, 2022 at 4:53
-
Sorry if am missing something here, I couldn't understand by linking them.– C. PraveenkumarAug 8, 2022 at 7:34
-
@C.Praveenkumar No worries, I am just a little new with Salesforce and am still trying to figure things out. Thank you for your help!– H4shBrownAug 9, 2022 at 13:11
1 Answer
We cannot create a field with multiple datatype, instead you can create two fields(or multiple as required) and have a validation rule setup to make sure all the field values are captured.
For example:
In the below screenshot, Main Competitor(s)(text field) is mandatory as Stage(picklist) field is populated.
Once the record is saved, it would look something like this
If there are multiple fields, you can align them in one section,
Or, via code you can create a component that can show two input fields(a picklist and a text) with the same Name and on save one can concatenate those two values into one field.
This way you can achieve the requirement.