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, ...
Suggested Answer

Can't find where this variable comes from

(0) ShareShare
ReportReport
Posted on by 148

Hi,

I'm creating a job in order to fix some date values from a field called DueDate in the table CustTrans. Those values are now saved correctly when they go through this process: 

if (! CustPaymSched::exist(salesParmTable.TableId,salesParmTable.RecId))
    {
        custVendPaymSched = CustVendPaymSched::construct(SysModule::Cust,salesParmTable);

        if (specQty.selection() == SalesUpdate::All && CustPaymSched::exist(salesParmTable.salesTable().TableId, salesParmTable.salesTable().RecId))
        {
            custVendPaymSched.copyCustVendPaymSched(CustPaymSched::find(salesParmTable.salesTable().TableId, salesParmTable.salesTable().RecId));
        }
        else
        {
            custVendPaymSched.copyPaymSched(PaymSched::find(salesParmTable.salesTable().PaymentSched));
            salesParmTable.createPaymentSched();
        }
    }

Because I need to correct the previous ones, I'm testing a single record and I want to pass them through the same process like this:

static void CorregirFechaVencimiento(Args _args)
{
    CustTrans custTrans;
    CustVendPaymSched custVendPaymSched;
    SalesParmTable salesParmTable;

    ttsbegin;

    select forupdate custTrans where custTrans.RecId == 5637617829;

    if (custTrans)
    {
        if (! CustPaymSched::exist(salesParmTable.TableId,salesParmTable.RecId))
        {
        custVendPaymSched = CustVendPaymSched::construct(SysModule::Cust,salesParmTable);

        if (specQty.selection() == SalesUpdate::All && CustPaymSched::exist(salesParmTable.salesTable().TableId, salesParmTable.salesTable().RecId))
        {
            custVendPaymSched.copyCustVendPaymSched(CustPaymSched::find(salesParmTable.salesTable().TableId, salesParmTable.salesTable().RecId));
        }
        else
        {
            custVendPaymSched.copyPaymSched(PaymSched::find(salesParmTable.salesTable().PaymentSched));
            salesParmTable.createPaymentSched();
        }
        }

        custTrans.update();
    }

    ttscommit;
}


But I'm getting the error: The specQty variable has not been declared.

I'm trying to naviagte to the definition but I get the message: Cannot navigate to the definition. I also checked the original code where that process was located (it was inside a form called SalesEditLines) and I don't see anywhere the variable declared, neither in the classDeclaration and I don't know why it doesn't give the error there.

I don't know if this has something to do with this, but I found specQty as a method in a class SalesFormLetter but obviously that is the method and not a variable and it doesn't have the method used in the process named selection()

Thanks in advance.

I have the same question (0)
  • Suggested answer
    GirishS Profile Picture
    27,827 Moderator on at

    Hi Daniel,

    I think SpecQty is the control on the form. In the form they will set the Auto declaration property to Yes on that control and use that in the code by mentioning the control name.

    Thanks,

    Girish S.

  • Suggested answer
    Mohit Rampal Profile Picture
    12,565 Moderator on at

    Hi Daniel, You can modify the code in your job, since specQty is a form control and user selects value in it, your job will not have access to it. You need to either hard code the value in code for specQty or create dialog for user selection.

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 565 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans