Skip to main content

Notifications

Microsoft Dynamics NAV (Archived)

A field from a record variable was expected

Posted on by 3,027

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
    Brad_P 1,542 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
    jsshivalik 3,027 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
    Brad_P 1,542 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
    jsshivalik 3,027 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
    Brad_P 1,542 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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans