web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Forums / Finance forum / "The placeholder ...
Finance forum

"The placeholder '%4' to strFmt is not used in the format string." in D365

(0) ShareShare
ReportReport
Posted on by 1,089

Hi All,

I am assigning string to container as shown below.

Container infoMessage;

infoMessage += strFmt("Ledger dimension %1-%2 Total number of lines processed %3 with total calculated interest %4", header.DimensionValues[#one], header.DimensionValues[#two], line.RecId, header.TotalCalcInterestAmount);

I am adding all the messages to the container and after the execution I will display the info messages one by one. in the above line of code I am getting "The placeholder '%4' to strFmt is not used in the format string." BP warning can any one please suggest me how can i solve this?

Thanks in advance.

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    301,037 Super User 2025 Season 2 on at

    Hi Guruprasanna,

    I haven't seen this BP before. Have you tried to replace the hardcoded text with a label?

  • Guruprasanna Profile Picture
    1,089 on at

    Hi Andre,

    Thanks for the reply, Yes i have created label and tried still same.

  • Sukrut Parab Profile Picture
    71,710 Moderator on at

    Never saw this BP rule. Is your infolog displays properly or infolog gives placeholder when you display ? Please check best practice settings under VS options if you have any extra rules set up.

  • Guruprasanna Profile Picture
    1,089 on at

    Hi Sukrut,

    Thanks for the reply !

    infolog display properly. but best practice setting under my model all the best practice rules are checked. can you please suggest me which all should marked as check or un-check and is their any procedure we follow to set up the best practice rules.

    Thanks in advance

    Guru

  • nep Profile Picture
    on at

    Hi guruprasanna

    You are not alone - I have the exact same issue.

    The infolog shows the message perfectly, but BP keeps giving the message "The placeholder '%2' to StrFmt is not used in the format string." I use a label which uses both %1 and %2, but only %2 is "punished" by BP.

    The BP Rule is [BPUnusedStrFmtArgument].

    Seems pretty strange - I expect BP checker to be false on this for some reason.

    Please let me know if you found a solution.

  • André Arnaud de Calavon Profile Picture
    301,037 Super User 2025 Season 2 on at

    Probably there is a bug in the best practice check. What exact platform update are you using?

  • nep Profile Picture
    on at

    I am using Update10 (7.0.4641.35168).

    BPSuppressions are my best friend right now :-)

  • Suggested answer
    Fedir Kryvyi Profile Picture
    1,026 on at

    It looks like an odd issue, but technically, you can replace strFmt with string concatenation to resolve this.

    InfoMessage += strFmt("Ledger dimension %1-%2 ", header.DimensionValues[#one], header.DimensionValues[#two]) + strFmt("Total number of lines processed %1", line.RecId) + strFmt(" with total calculated interest %1", header.TotalCalcInterestAmount).

    or you can put this string concatenation inside of another method to make cleaner like

    InfoMessage += this.formatString(header.DimensionValues[#one], header.DimensionValues[#two], line.RecId, header.TotalCalcInterestAmount);

  • Andrew Jones a1x Profile Picture
    136 on at

    Not sure if it's helpful, but the BP check only seems to look at en-us label files, so if you have labels that don't exist in that language, then you will get various label-related BP errors, including the one mentioned above about strFmt.

  • Suggested answer
    Florian Hopfner Profile Picture
    2,461 on at

    Medhi Moalla over in BP Label Error AX 7 posted instructions how you can use the labelc.exe tool to force a regeneration of the label resources .dll. This solved the BP warning BPUnusedStrFmtArgument for me. 

    Here are his instructions:

    1. Open command line with (admin) privilege 
    2. Execute this command : 

      J:\AosService\PackagesLocalDirectory\bin\labelc.exe -metadata="J:\AosService\PackagesLocalDirectory" -output="J:\AosService\PackagesLocalDirectory\<Package Name>\Resources" -modelmodule="<Package Name>"

    Another way to force the regeneration of the label resources .dll is to simply delete it. The next build will recreate them.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Finance

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans