locked
CRM2016: Fix Currency Symbol Display Error on custom attributes RRS feed

  • Question

  • We have a from designed that mixes out-the-box currency values with custom attribute currency values.

    We've recently discovered than when you change the transactioncurrecyid lookup to an alternative currency (rather than the default) the out-the-box attributes are re-painted correctly, but none of the custom attributes are being changed. So to the user it no looks like there are two active currencies being requested.

    Having researched the problem in the forums I can see this isn't a new problem it seems to have affected prior versions. However, some of the fixes suggested don't seem to work with CRM2016.

    Things I've tried unsuccessfully are:

    $.each($("span.ms-crm-Money-CurrencySymbol"), function ()
    {
        this.textContent = "€";
    }

    OR

    Xrm.Page.getControl('transactioncurrencyid').get_editControlBehavior().handleAfterLookup({ items: [obj] })

    Never of these seem to work on the new CRM2016 forms.

    Does anybody know the javascript syntax that exposes the Currency Symbol on a currency value field, because armed with this I should be able to manually swap them control-by-control, but so far I've been unable to locate it in the DOM.

    Many thanks for any help offered.

     
    Wednesday, September 20, 2017 12:53 PM

Answers

  • Just to keep the group appraised of this strange behaviour.

    Last night I decided to delete one of my custom currency fields and recreate it. Once I had done this it started to work normally (i.e. if i changed the transaction currency all money fields changed the currency symbol), with the exception of the original six (now five) fields.

    I started to check the meta-data tables to see if I could detect any difference between the original created fields and the new one just created. I could not find anything. I decide to drop and rebuild all the custom money fields and now the system is functioning as normal.

    I don't know what happend here, but the original fields had been damaged in some way that was undetectable. This has cost a lot of time so it's frustrating to not detect the route cause, but I guess the lesson here is if anything strange starts to happen, consider rebuilding the field.

    *** case closed *** 

    • Marked as answer by lemonje Friday, September 22, 2017 10:05 AM
    Friday, September 22, 2017 10:02 AM

All replies

  • Hello,

    Try following:

    $.each(parent.$("span.ms-crm-Money-CurrencySymbol"), function ()
    {
        this.textContent = "€";
    });


    Dynamics CRM/Business Solutions MVP
    Read My blog

    Wednesday, September 20, 2017 1:32 PM
    Moderator
  • Hi Andrew

    I gave that a try and no luck. Here is the final results on screen, the only difference is top field is custom, bottom field is microsoft.

    As for the code I was already doing this at the top of my javascript file.

    if (typeof ($) === 'undefined')
    {
        $ = parent.$;
        jQuery = parent.jQuery;
    }
    

    Here is the complete code block with the suggested change

        if (currencyInfo != null)
        {
            var currencySymbol = currencyInfo.CurrencySymbol;
            // Looping through all currency controls on the form and sets the currency symbol.
            $.each(parent.$("span.ms-crm-Money-CurrencySymbol"), function ()
            {
                this.textContent = currencySymbol;
            });
        }
    
    Is there any other way of fixing the currency symbol in a curreny/money control?

    Wednesday, September 20, 2017 1:59 PM
  • Code worked for me but I tried it in Dynamics 365 instance.

    I don't know any other way to resolve that issue. And I didn't know about this issue before you posted it.


    Dynamics CRM/Business Solutions MVP
    Read My blog

    Wednesday, September 20, 2017 2:09 PM
    Moderator
  • Hi Andrew

    Many thanks for your time. I was initial puzzled and frustrated by the realisation that it worked for you, but it was your comment "I didn't know about this issue before you posted it" that really got me thinking.

    There was no way I'm the first to find this problem, and if an MVP hasn't spotted it before, then there must be something else wrong. You words prompted me to keep digging... I haven't found the answer but I have found a clue to share with the group.

    I managed to get the debugger to stop inside the "$.each(parent.$("span.ms-crm-Money-CurrencySymbol"), function ()" loop, and from here I was able to get the id value of each control and verify its currency symbol. It was whilst doing this I noticed something strange.

    I actually have 6 custom money fields on the form, but only one can be enabled and visible at any one time. The field I was testing on didn't work, but I also noticed that it did not show up in the class list loop either! Of the six money fields I have only *one* is listed in the class loop, and that one does get a correct currency change swap as instigated by changing the currency.

    So the question now is why does one of the six fields work and the other five don't. So far I cannot see anything in the field design to explain the different behaviour. My next step is to look at the meta data table to compare two of these fields. Other than that I'm out of ideas other than deleting the affected fields and re-creating them.

    This is so bizarre I though it worth sharing with the group... if anybody else have any suggestions that would be good.

    Cheers 

    Thursday, September 21, 2017 12:00 PM
  • Just to keep the group appraised of this strange behaviour.

    Last night I decided to delete one of my custom currency fields and recreate it. Once I had done this it started to work normally (i.e. if i changed the transaction currency all money fields changed the currency symbol), with the exception of the original six (now five) fields.

    I started to check the meta-data tables to see if I could detect any difference between the original created fields and the new one just created. I could not find anything. I decide to drop and rebuild all the custom money fields and now the system is functioning as normal.

    I don't know what happend here, but the original fields had been damaged in some way that was undetectable. This has cost a lot of time so it's frustrating to not detect the route cause, but I guess the lesson here is if anything strange starts to happen, consider rebuilding the field.

    *** case closed *** 

    • Marked as answer by lemonje Friday, September 22, 2017 10:05 AM
    Friday, September 22, 2017 10:02 AM