Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

SalesTableType vs SalesQuotationTableType

(0) ShareShare
ReportReport
Posted on by 2,256

Hi Experts,

I made custom workflow for Sales Order as well Sales Quotation.

In Sales Order, after Sales order workflow approved then only confirmation button enable.

The code is given below.

boolean mayConfirmationBeUpdated()
{
    boolean ok;

    ok = (!(salesTable.SalesStatus  == SalesStatus::Invoiced    ||
            salesTable.SalesStatus  == SalesStatus::Delivered   ||
            salesTable.SalesStatus  == SalesStatus::Canceled)
            && (salesTable.mcrOrderStopped == NoYes::No
                || !isConfigurationkeyEnabled(configurationKeyNum(MCRCallCenter)) && (salesTable.CreditLimitApprovalStatus == SalesCreditLimitApprovalStatus::Approved || salesTable.DiscPercent == 0)) //SFA added 23Nov20
            );

    if (ok && salesCycle)
    {
        salesPurchCycle = SalesPurchCycle::findBySalesPurchaseCycle(SalesPurchCycleAction::Confirmation, SalesPurchCycleModuleParameter::Cust, salesTable.CustAccount);

        if(salesPurchCycle)
        {
            if(!salesPurchCycle.Active)
            {
                ok = false;
            }
        }
        else
        {
            if (!SalesPurchCycle::findBySalesPurchaseCycle(SalesPurchCycleAction::Confirmation, SalesPurchCycleModuleParameter::CustParameter, '').Active)
            {
                ok = false;
            }
        }
    }

    return ok;
}

In Sales Quotation, What changes are required to get same as per Sales order means after workflow get approved then only confirmation button enable.

The standard code is given below.

boolean mayConfirmationBeUpdated()
{
    //only if workflow is approved enable send button
    //if sales quotation customer is prospect, should return false
    return (salesQuotationTable.BusRelAccount == '' && !salesQuotationTable.isTemplate() &&
                (salesQuotationTable.QuotationStatus == SalesQuotationStatus::Sent
                 && salesQuotationTable.CustAccount
                 && smmOpportunityTable::find(salesQuotationTable.OpportunityId).Status != smmOpportunityStatus::Postponed
                )
           );
}

Thanks in advance..

Regards,

Faiz

  • Verified answer
    faiz7049 Profile Picture
    2,256 on at
    RE: SalesTableType vs SalesQuotationTableType

    I have achived by method canConfirmationBeUpdated()

    boolean  canConfirmationBeUpdated(DocumentStatus    _documentStatus = DocumentStatus::Confirmation)
    {
    
        boolean  ok = false; //true; SFA added on 21-Feb-2021
    
        if(salesQuotationTable.QuotationApprovalStatus==SalesQuotationApprovalStatus::Approved || salesQuotationTable.DiscPercent ==0)
        {
    
            ok = true;
    
           // SFA ended on 21-Feb-2021
    
        if (_documentStatus == DocumentStatus::Confirmation)
        {
            ok = this.mayConfirmationBeUpdated();
        }
        }
        return ok;
    }
    

    Thanks,

    Faiz

  • faiz7049 Profile Picture
    2,256 on at
    RE: SalesTableType vs SalesQuotationTableType

    Hi André Arnaud de Calavon,

    Thanks for your input. I have been tried as per suggestion but sitll we can generate quotation even workflow not approved.

    Please help me.

    boolean mayConfirmationBeUpdated()
    {
        //only if workflow is approved enable send button
        //if sales quotation customer is prospect, should return false
        return (salesQuotationTable.BusRelAccount == '' && !salesQuotationTable.isTemplate() &&
                    (salesQuotationTable.QuotationStatus == SalesQuotationStatus::Sent
                     && salesQuotationTable.CustAccount
                     && smmOpportunityTable::find(salesQuotationTable.OpportunityId).Status != smmOpportunityStatus::Postponed
                    //added by SFA on 21-feb-2021
                       && salesQuotationTable.QuotationApprovalStatus ==SalesQuotationApprovalStatus::Approved
                    
                    )
               );
    }

  • André Arnaud de Calavon Profile Picture
    294,777 Super User 2025 Season 1 on at
    RE: SalesTableType vs SalesQuotationTableType

    Hi Faiz,

    I don't know which exact field name and enum type name you have used for the quotations, but you can try to add some coding like this:

    boolean mayConfirmationBeUpdated()
    {
        //only if workflow is approved enable send button
        //if sales quotation customer is prospect, should return false
        return (salesQuotationTable.BusRelAccount == '' && !salesQuotationTable.isTemplate() &&
                    (salesQuotationTable.QuotationStatus == SalesQuotationStatus::Sent
                     && salesQuotationTable.CustAccount
                     && smmOpportunityTable::find(salesQuotationTable.OpportunityId).Status != smmOpportunityStatus::Postponed
                     // added WF coding
                     && salesQuotationTable.WorkflowStatus == MyQuotationWFStatus::Approved
                    )
               );
    }

  • faiz7049 Profile Picture
    2,256 on at
    RE: SalesTableType vs SalesQuotationTableType

    Hi André Arnaud de Calavon,

    Yes status fields added to SalesTable and SalesQuotationTable. Status field update based on action  performed means Accept/Reject/Request to change.

    Problem is users can confirm quotation even workflow status not approved. But in Sales order , doing some changes in method mayConfirmationBeUpdated() of SalesTable type , user can not confirm sales order if workfluw status not approved.

    Similar I want to do it in Sales quotation.

    Thanks,

    Faiz

  • André Arnaud de Calavon Profile Picture
    294,777 Super User 2025 Season 1 on at
    RE: SalesTableType vs SalesQuotationTableType

    Hi Faiz,

    Did you add approval status fields on the SalesTable and SalesQuotation table? You need new fields to know the current workflow state and manage the status when submitting the record to the workflow and when a user approves or rejects the workflow instance.

  • faiz7049 Profile Picture
    2,256 on at
    RE: SalesTableType vs SalesQuotationTableType

    Please help me

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 353 Most Valuable Professional

#2
Abhilash Warrier Profile Picture

Abhilash Warrier 276

#3
Jonas "Jones" Melgaard Profile Picture

Jonas "Jones" Melgaard 190 Super User 2025 Season 1

Overall leaderboard

Product updates

Dynamics 365 release plans