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 NAV (Archived)

A field from a record variable was expected

(0) ShareShare
ReportReport
Posted on by 3,099

Hi

  I the below line it gives above error. SCMLine is Sale Credit Header . It should be written like below . Its value in Database is shown as 1.

SCMLine.SETRANGE(SCMLine."Sales Return Type":: Sales Cancellation);

Thanks

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Brad_P Profile Picture
    1,549 on at

    Hi,

    It is a bit misleading to call the header a line variable name, however:

    SCMLine.SETRANGE("Sales Return Type",SCMLine."Sales Return Type":: Sales Cancellation);

  • jsshivalik Profile Picture
    3,099 on at

    Hi

     I have written this but it says  ')' should come here

    SCMLine.SETRANGE("Sales Return Type",SCMLine."Sales Return Type"::Sales Cancellation);

    Thanks

  • Suggested answer
    Brad_P Profile Picture
    1,549 on at

    Hi,

    Due to the space, there needs to be quotes around Sales Cancellation. "Sales Return Type"::"Sales Cancellation".

  • jsshivalik Profile Picture
    3,099 on at

    Hi

     But can't we write Sales Return Type = 1

    Thanks

  • Verified answer
    Brad_P Profile Picture
    1,549 on at

    Hi,

    Yes you could also do:

     SCMLine.SETRANGE("Sales Return Type",1);

    However it is a bit less readable.

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 NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans