RE- Getting a form through a button

Hi Everyone,

I ve created one form called ‘SalesCreateOrder’… Nw another form called ‘Oppurtunity’ is there…

then i ve to bring one button in the ‘Oppurtunity’ form… when i clicked that button means i ve to get the ‘SalesCreateOrder’ form to be opened…

Help me regarding this…

With Regards,

M.Madhan Kumar

Hi Madhan,

Put this code in the clicked method of your button.

Args args;
FormRun formRun;
;

super();
args = new Args(formStr(SalesCreateOrder));
formRun = classFactory.formRunClass(args);
formRun.run();
formRun.detach();

Hope this helps.

Hi Madhan,

Add a Button Group in ‘Opportunity’ Form and add menuitemButoon in the button group.
Go to menuItem button properties
MenuItemType:Display
MenuItemName : ‘SalesCreateOrder’

Hi Everyone,

I ve done those things… But nw i m getting an error in the init method of ‘Oppurtunity’ form.

"Error Executing Code : FormRun object does not have method ’ defaultSalesType’ ".

What i wanna do nw…

Hi Madhan,

What is the code written in init method…compile the form once…

Hi Madhan,

I didnt realize you were calling the standard SalesCreateOrder form.

For that in the code where you call the form, you will have to add extra code.

Create an instance of the SalesCreateOrder class,
set the form’s caller as this class instance. You will have to pass a buffer of SalesTable as well when initializing the SalesTableForm as well.

SalesTableForm salesTableForm;
SalesTable salesTable;
;
salesTableForm = new SalesTableForm(salesTable);
args = new Args(Formstr(SalesCreateOrder));
args.caller(salesTableForm);

Let me know if you need more help.

void init()
{
SalesTable salesTableLocal;
;
super();

if (!element.args().caller())
{
throw error("@SYS22539");
}

salesTableForm = element.args().caller();
salesCreateOrderForm = SalesCreateOrderForm::construct(salesTableForm.defaultSalesType(), salesTableForm.project());

if (salesTableForm.replacementOrder()
&& salesTableForm.returnItemNum())
{
select firstonly salesTableLocal
where salesTableLocal.ReturnItemNum == salesTableForm.returnItemNum()
&& salesTableLocal.SalesType == SalesType::ReturnItem;

if (salesTableLocal
&& salesTableLocal.isInterCompanyOrder()
&& salesTableLocal.InterCompanyDirectDeliveryOrig)
{
error("@SYS120349");
element.close();
}
}

if (salesTableForm.parmReturnStatus() == ReturnStatusHeader::Created)
{
// Create return order
element.design().caption("@SYS104102");
}

TaxVATNumTable::enableLookupVATNum(salesTable_VATNum);

if (salesTableForm.project())
{
salesTable_ProjId.mandatory(true);
}
//
element.enableFieldsActive_IN();
//
}

Hi Madhan,

defaultSalesType is being refrenced in this line,

salesCreateOrderForm = SalesCreateOrderForm::construct(salesTableForm.defaultSalesType(), salesTableForm.project());

It should be fixed with what I suggested earlier.

Hi Zubair Ahmed,

i got it… Thankz a lot…

With Regards,

M.Madhan Kumar