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 :
Microsoft Dynamics AX (Archived)
Answered

When I am pass this method in data contract class it give error "Not all paths in return a value"

(0) ShareShare
ReportReport
Posted on by 875

Hi All  Users can Any one tell me ,When I am  pass this method   in data contract class it give error "Not all paths in  return a value"

[DataMemberAttribute("Dialog")]
public TransDate paramBox(TransDate _date= t1)
{

TransDate transdate;
Dialog dialog;
DialogField d1;
DialogField d2;
;
t1=_date;
dialog = new Dialog("My Dialog");
dialog.addText("Allocation Date:");
d1=dialog.addField(extendedTypeStr(TransDate));
//d2=dialog.addField(extendedTypeStr(ToDate));
dialog.run();
if (dialog.closedOk())
{

t1=_date;
return t1;
}
}

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    your method has a return type TransDate. Its not void type.  So its must to return some value, always.

    On other hand you  are returning value in case of Dialog is closed (you are returning value only under if statement)

  • Vikas_AX_Blogs Profile Picture
    875 on at

    Hi Sohaib,

    Than what value should  i return .

  • Verified answer
    Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    you have to return value in each case, you are returning value only if anyone clicks Ok on dialog.

    while your method is always looking for a return type.

    you may write following line of code before ending bracket

    return dateNull();

    But remember all it depends upon your requirement.

  • Vikas_AX_Blogs Profile Picture
    875 on at

    Thanks Sohaib ,its working

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans