When you have a form field that is tied to a dynamic list and is displayed as a drop down, you usually have a display value that is a string description and a value that is an integer value. If this form field is tied to a resource like an email resource, the value that gets mapped to the email resource field is the value of the drop down, not the display value of the drop down.
It would be great if there was a way to specify to always use the display value instead for fields that are displayed as drop downs. Ideally, it would be nice to have a new checkbox in the dynamic list view next to the Required checkbox that said something like "Use Display Value" and would always map to the display value instead of the value of the form field.
At the moment, the only workaround that I know of is to create an additional field that will hold the display value, map that to the email resource and set it before calling sendMail() on the email resource.
Mapping email resource field to form field
Moderators: Jon, Steve, Ian, Dave
-
- Ebase User
- Posts: 649
- Joined: Mon Dec 09, 2013 6:37 pm
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
Re: Mapping email resource field to form field
It's a bit of a tricky problem as there will also be cases when you want to use the return value (which is the actual field's value) e.g. when mapping to a Database Resource. So any solution would need to be something that is configurable as opposed to default system behavior. Maybe the solution would be to have an additional option on a resource field mapping that said whether to use the display or return value for list fields.
This issue applies to all list types, not just Dynamic Lists.
There are probably other cases where you would always want to use the display value e.g. when sorting table columns.
If anyone is wondering how you can obtain the display value at any moment, you can use:
This issue applies to all list types, not just Dynamic Lists.
There are probably other cases where you would always want to use the display value e.g. when sorting table columns.
If anyone is wondering how you can obtain the display value at any moment, you can use:
Code: Select all
var displayValue = fields.myfield.list.getDisplayValue(fields.myfield.value, true);
0 x
-
- Ebase User
- Posts: 649
- Joined: Mon Dec 09, 2013 6:37 pm
Re: Mapping email resource field to form field
Jon,
The solution that I suggested would fix this issue easily.
By default the value, not the display value is returned. If there was a checkbox preference in the DL called "Use Display Value" and it's checked then the display value will be returned instead.
Also, whats the difference between getting the display value using fields.MYFIELD.displayValue vs the line of code that you posted ?
The solution that I suggested would fix this issue easily.
By default the value, not the display value is returned. If there was a checkbox preference in the DL called "Use Display Value" and it's checked then the display value will be returned instead.
Also, whats the difference between getting the display value using fields.MYFIELD.displayValue vs the line of code that you posted ?
0 x
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
Re: Mapping email resource field to form field
But you probably wouldn't want the Display Value if you were inserting a record using a Database resource, you want the return value.
And you're right about field.X.displayValue - it invokes the same code internally as shown above. And it's a much more obvious thing to use.
And you're right about field.X.displayValue - it invokes the same code internally as shown above. And it's a much more obvious thing to use.
0 x
-
- Ebase User
- Posts: 649
- Joined: Mon Dec 09, 2013 6:37 pm
Re: Mapping email resource field to form field
Jon,
You're right. You wouldn't want to save the display value into a DB but you would want to map the display value instead of the value to an email resource
Segi
You're right. You wouldn't want to save the display value into a DB but you would want to map the display value instead of the value to an email resource
Segi
0 x
Who is online
Users browsing this forum: No registered users and 4 guests