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

  • Verified answer
    Brad_P Profile Picture
    1,549 on at
    RE: A field from a record variable was expected

    Hi,

    Yes you could also do:

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

    However it is a bit less readable.

  • jsshivalik Profile Picture
    3,099 on at
    RE: A field from a record variable was expected

    Hi

     But can't we write Sales Return Type = 1

    Thanks

  • Suggested answer
    Brad_P Profile Picture
    1,549 on at
    RE: A field from a record variable was expected

    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
    RE: A field from a record variable was expected

    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
    RE: A field from a record variable was expected

    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);

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics NAV (Archived)

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans