read value of recurring price cat_item

xlarge74
Tera Expert

hello

 

i would like to read  the value of the recurring_price field (cat_item) in a client script.

there is a value entered, but i dont get it.

i tried with g_form.getValue('recurring_price') and i read about current..... but the script shows an error when current is used.

 

kind regards

Oliver

1 ACCEPTED SOLUTION

@xlarge74 Ok yeah so it looks like you have this set up as a catalog client script. This is looking for a variable on the catalog item called recurring_price, which doesn't exist.

 

I will note that you also need to set the value in Recurring price frequency in order to see that value display alongside the price in the widget on the right of the service catalog. To access the value.

 

What are you trying to do with the recurring price information? If you simply want to display it, just set the frequency and it will display as mentioned above. If you are trying to use the value for manipulation, that will be more complex.

 

I will note that you can technically access the value at $scope.data.sc_cat_item.recurring_price_subtotal. I found this out by CTRL + right-clicking the price widget, logging $scope.data to console, and combing through the data object.

View solution in original post

14 REPLIES 14

jcmings
Mega Sage

First question is what kind of client script is it? Is it an onChange? If so, try using newValue. If it's not an onChange, then can you confirm the value is present when the form is loaded? 

 

I'd recommend trying to console.log your value (console.log(g_form.getValue('field')) in your client script and see what that outputs.

its an onLoad and it writes a blank field at the console

xlarge74_0-1741880532134.png

 

What happens if you use getDisplayValue instead?