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

Method

(0) ShareShare
ReportReport
Posted on by

Hi I have a library table, i need to fill the to be return date as maximum date of the books customer subscribed, how can i do that in modified field method..

For example customer subscribed 4 books his return date should be based on the book whose page is maximum.. if it is a small book he can return in 2 weeks and if it is a large book he can take 4 weeks..
Thanks in advance..


*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Ajit Profile Picture
    8,788 on at

    Where you are going to put the criteria? I mean, how many pages will take 2 weeks and 4 weeks? You should set the threshold in parameters form for 2 weeks and 4 weeks and based on that you can calculate the return date.

  • Community Member Profile Picture
    on at

    If the pages of the book is more than 1000 the subscriber can return after 4 weeks, if it is less than 1000 pages the return date would me 2 weeks..

  • Community Member Profile Picture
    on at

    I already calculated the tobereturndate as follows:

    case fieldnum(AX_SubscriberLine,Book_Id):

                   select axbm where axbm.Book_Id==this.Book_Id;

                   this.Book_Name=axbm.Book_Name;

                   if(axbm.Pages>'1000')

                   this.ToBereturnDate=systemdateget()+28;

                   else

                   this.ToBeReturnDate=systemdateget()+14;

                   break;

    Now wat i need to do is if the subscriber subscribed 4 books  means he can't come and return each book separately so I need to set the return date for each subscriber as maximum return date automatically from the subscribed book...

  • Suggested answer
    Chaitanya Golla Profile Picture
    17,225 on at

    Hi,

    There are many ways to accomplish this. One way is to write code on the validateWrite method of table AX_SubscriberLine(i.e when trying to save the customer subscribing book record) to check the books that are already subscribed by the given customer and in that list, if we have at least one book with more than 1000 pages then set the return date for 4 weeks or 2 weeks accordingly.
    Typically your code would look like below.

    Table: AX_SubscriberLine
    Method: ValidateWrite

    public boolean validateWrite()
    {
        AX_SubscriberLine AX_SubscriberLineLocal;
        axbm              axbm;
        boolean ret;
    
        select firstOnly  AX_SubscriberLineLocal
            where AX_SubscriberLineLocal.CustAccount == this.CustAccount
            join axbm
            where axbm.Book_Id == AX_SubscriberLineLocal.Book_Id
            && axbm.Pages > 1000;
        
        if (AX_SubscriberLineLocal.RecId)
        {
            this.ToBereturnDate=systemdateget()+28;
        }
        else
        {
            this.ToBeReturnDate=systemdateget()+14;
        }
            
        ret = super();
    
        return ret;
    }
  • Community Member Profile Picture
    on at

    Thanks Chaitu :)

    Wat i want is i need to update the tobereturndate as maximum return date  of all the subscribed books,

    I dont know how to do tat in case, can you suggest me how to do tat??

    my sample code is:

    case fieldnum(AX_SubscriberLine,ToBereturnDate):

                   select maxof(tobereturndate) from axsl where axsl.Sub_Id==this.Sub_Id;

                   // select forupdate axsl where axsl.ToBereturnDate

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!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 26

#2
imran ul haq Profile Picture

imran ul haq 8

#3
André Arnaud de Calavon Profile Picture

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

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans