Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Unanswered

Sales Order expiration date issue !

Posted on by 312

Hi Team, I have a requirement on Sales Order Expiration Date, suppose let's say customer want to create a Sales order while give create date and expired date I should pick manually (suppose let's this particular order only valid for 7 days after that expired means got freeze means that required confirmation button got disables.

pastedimage1641377274113v1.png

please see above, I have created expired date and expire status when ever going to do the expired that time not able to do the order means got freezed.

I have written code, as per the code not going into the expired loop and by default active showing.

can you please help me, regarding the above issue.

Regards,

Vinilkumar.

  • vinilkumar Profile Picture
    vinilkumar 312 on at
    RE: Sales Order expiration date issue !

    Thank Andre for helping, I changed the code and working fine. My mistake was 'wrongly assigned the label'.

    my issue got resolved.

    Regards,

    Vinilkumar.

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,280 Super User 2024 Season 2 on at
    RE: Sales Order expiration date issue !

    Hi Vinilkumar,

    The way you shared your coding is not helpful. There are a lot of line out-commented and you just pasted the coding as part of the text instead of uing the code-applet. You can find this if you use the 'Use rich formatting' function. Can you copy a clean version of the coding? When I try to read it now, then I think there is no where clause on the actual role name or role names.

    You also didn't mention when this coding is executed. What standard method is extended?

  • vinilkumar Profile Picture
    vinilkumar 312 on at
    RE: Sales Order expiration date issue !

    Thank Andre, I have done, but new challenge is here,

    pastedimage1641537124924v1.png

    As per the code, I have set as if expiry status got expired case,  expiry date got disabled means not able to modify.

    Note: by writing code i.e., disable fields on a form for a particular role.

     /*  container roleNames;

    SecurityRole role;

    SecurityUserRole userRole;

    UserInfo userInfo;*/

    //select userRole where userRole.SecurityRole == "System Administrator";

    while select firstonly role

    exists join userRole

    where role.RecId == userRole.SecurityRole

    && userRole.User == curUserId()

    //{

    //roleNames += [role.Name];

    //}

    //if((confind(roleNames, “System Administrator”)) || (confind(roleNames, “SalesTableForExpiryDate”)))

    //if(conFind(roleNames, "System administrator"))

    //|| (conFind(roleNames, "SalesTableForExpiryDate”)))

    if(role)

       {

       salestable_ds.object(fieldNum(SalesTable, ExpiryDate)).allowEdit(true);

       }

       else

       {

       salestable_ds.object(fieldNum(SalesTable, ExpiryDate)).allowEdit(false);

       }

    not worked clearly, what I want to do is I must create a role (customised role) that particular role assigned to the user, then he can able to modify (enable the date field) the date this is my customisation.

    my concern is how to assign that particular role use to the current code.

    Regards,

    Vinilkumar.

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,280 Super User 2024 Season 2 on at
    RE: Sales Order expiration date issue !

    Hi Vinilkumar,

    You have to check the logic in the classes SalesTableType and SalesTableType_Sales to check if the buttons you want to disable are already managed in some methods. In that case, you need to customize those methods as well.

  • vinilkumar Profile Picture
    vinilkumar 312 on at
    RE: Sales Order expiration date issue !

    Thanks for your reply, please see the below code which is I have written in 'SalesTable form' ( init, active method and 'salestable/salesline' datasource init and active method, but no hope, still sales order confirmation button still be enabled.

    pastedimage1641466128871v1.png

    pastedimage1641466344716v2.png

    Note: if I use visible =false will be working fine but enable/disabled not worked here.

    I heard is it will be write in 'SalesTabelType' class ( I have tried but got failed).

    please guide me on the above customisation.

    Regards,

    Vinilkumar.

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,280 Super User 2024 Season 2 on at
    RE: Sales Order expiration date issue !

    Hi Vinilkumar,

    You mentioned that you created some custom coding. Can you share what exactly you have done? Without the details, we don't know what you might need to adjust to fix it.

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!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans