Map the price in the price type field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2024 05:33 AM
Hi,
I have a requirement where I have two string fields on a form, one is "currency code" and other is "value". The user enters currency code in the "currency code" field and price in the "value" field. What I have to do is as soon as user enters data in these two fields, I have to auto populate another field which is of "price" type with both these values.
For example, If user enters, "$" in currency code field and " 42" in value field then the price type field should be auto populated as shown in below screenshot:
The choice in the price should get auto populated with the "$" and value should be captured also in price field.
How can I achieve this requirement? Can you pls assist.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2024 08:19 PM
Hi @SK41 ,
This can be achieved using Client Scripts. It would require 3 client scripts:
- onLoad Client Script to set the value for existing records.
- onChange Client Script for Currency string field to update price when currency is updated.
- onChange Client Script for Price string field to update price when currency is updated.
The following code should work where more currency symbols can be added as per your requirement:
var currency = "";
var priceFinal = "";
switch(g_form.getValue('u_currency')){
case '$':
currency = "USD";
break;
case "£":
currency = "GBP";
break;
}
priceFinal = currency + ";" + g_form.getValue('u_price_string');
g_form.setValue('price', priceFinal);
Thanks,
Nitin Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2024 12:09 AM
Hi,
This is not setting the currency choice and price value in the price type field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2024 07:41 PM
Hi,
Ideally the price type field should be set as follows:
Currency_code;Value
For example, I tried "USD;19.00" or "GBP;25.01" and it worked. Kindly check the backend values of the currency symbols. OOB values are set as $ = USD, £ = GBP etc.