How in a script can you find the currency of a user (not the current one)

Ruth_Porter
Kilo Explorer

Hi there,
Although I can see how to find the currency of the currently logged in user I cannot seem to find any way of getting in a script the currency of user X where x is some other user.
The reason I need this is so that each Approver gets the cost details in their own currency in the email they receive - as far as I can see the system currency seems to apply in emails. The requirement is that these approvals will be handled totally within emails and so the approver will not click a link (which would allow them to see the amount in their own currency) and so needs to see the right currency in the email.

I feel sure I am missing something here so any pointers will be very much appreciated and thanks in advance.

7 REPLIES 7

PeterWiles
Kilo Sage

I can't seem to find anything either.
You could create your own conversation function as a global BR

Function userpriceconvert(baseprice, user)
{
Get user currency ISO code

Lookup currency conversion table for conversation value.

Multiply baseprice by conversion value

Return new value
}

I'm not at my computer to confirm the actual code but the above sudo should work.


Ruth_Porter
Kilo Explorer

It is getting the currency to use rather than the actual conversion where I have the issue as I cannot find how to determine what is the currency for user X


If I have read it correctly, I would do the conversion from the system price which is what the conversion values are based off.

E.g.
User A submits request in Euros.
The base system price is Pounds. (current.price.getReferenceDisplayValue())
Pass pounds into the function.
Get user Y currency code ( the approver) - look up the currency field on their user profile
Lookup conversion rate for base price to users Y currency code
Calculate

Or have I miss understood?


Ruth_Porter
Kilo Explorer

Hi Peter,
Thanks - you say "look up the currency field on their user profile" but as far as I can see there is no OOTB currency field on a user record. I think I am going to end having to put one there but had hoped someone could tell me some method that would mean this was not necessary.

If there is such a field could you please let me know what its column name is - thanks in advance