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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

wrong type of argument for conversion function

(0) ShareShare
ReportReport
Posted on by 131

I have create a form. I have write all my business logic in my newly created class. Problem is when I am calling class method in button clicked mthod then it is giving below error

ep_5F00_form.png

ep_5F00_form2.png

here is my class code


public void parmmethod(str _brand, str _type,
    str _product,int _percentage,
    date _slabstart, date _slabend,
    SL_SchemeCode   _schemecode,
    int64 slabvaluestart, 
    int64 slabvalueend)
{

    brand = _brand;
    type = _type;
    product = _product;
    percentage = _percentage;
    slabstart = slabvaluestart;
    slabend = slabvalueend;
    schemecode = _schemecode;
    fromdate = _slabstart;
    endate = _slabend;
    
    this.insert_header();
    this.insert_line();
}

Below is my button click method code

void clicked()
{
     Args args = new Args();
    RNI_Scheme2 schemeclass = new RNI_Scheme2();
     schemeclass.parmmethod(RNI_Brand.valueStr(),RNI_Type.valueStr(),RNI_Product.valueStr(),
    rni_percentage.value(),any2date(rni_fromdate.valueStr()),any2date(rni_enddate.valueStr()),
    rni_schemecode.valueStr(),
    rni_slabstart.value(),rni_slabend.value());
    //super();
}

I have the same question (0)
  • Verified answer
    Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Syed,

    I believe these two parameters are causing the issue for you - any2date(rni_fromdate.valueStr()) and any2date(rni_enddate.valueStr()).

    Assuming that the form controls are date controls, you can use the dateValue method instead

    rni_fromdate.dateValue()
    rni_enddate.dateValue()

  • Verified answer
    Martin Dráb Profile Picture
    238,955 Most Valuable Professional on at

    Using valueStr() is wrong. If you use right methods such as dateValue(), you don't need conversion to text and back to the right type.

    For example, use rni_fromdate.dateValue() instead of any2date(rni_fromdate.valueStr()), text() for string fields, selection() for enum fields and so on.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 573

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 573

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 396 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans