web
You’re offline. This is a read only version of the page.
close
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,382

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

I have the same question (0)
  • faiz7049 Profile Picture
    2,382 on at

    Please help me

  • André Arnaud de Calavon Profile Picture
    301,020 Super User 2025 Season 2 on at

    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,382 on at

    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
    301,020 Super User 2025 Season 2 on at

    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,382 on at

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

  • Verified answer
    faiz7049 Profile Picture
    2,382 on at

    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

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 646 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 529 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans