Below scenario will highlights note button on Sales table and sales table list page while notes added to sales order from the document handling attachment sections
Verify whether documents handling is active for the current user.
/// <summary>
/// returns document handling user setup option for the current user.
/// </summary>
/// <returns>
/// returns true if document handling is been set to active and show attachments status set to true
/// </returns>
public boolean afmIsDocumentHandlingActive()
{
SysUserInfo sysUserInfo;
boolean ret;
select docuHandlingActive,docuToolbarButtonActive from sysUserInfo
where sysUserInfo.Id == curUserId();
if (sysUserInfo.docuHandlingActive && sysUserInfo.docuToolbarButtonActive)
{
ret = true;
}
return ret;
}
-------------------------------------------------------------------------------------------
for sales table list page
write below method in SalesTableListPageInteraction class and call it from selection changed
SalesTableListPageInteraction
// afmMCROrderNotes is the control name on the list page
public void afmFindDocuRefNotes()
{
FormDataSource fds;
SalesTable salestable = this.currentSalesTable();
fds = SalesTable.dataSource();
fds.formRun().control(fds.formRun().controlId('afmMCROrderNotes')).lostFocus();
}
// 'afmMCROrderNotes control on list page lost focus method
public void lostFocus()
{
super();
if(salesTable.afmShowDocuNotesHighlight())
{
afmMCROrderNotes.toggleButton(ToggleButtonStyle::Check);
afmMCROrderNotes.toggleValue(OnOff::On);
}
else
{
afmMCROrderNotes.toggleValue(OnOff::Off);
}
}
-------------------------------------------------------------------------------------------
for salesTable form
// The code which does the required functionality. to be written in salesTable form
void afmDocuNoteHandlingControl()
{
if(salesTable.afmShowDocuNotesHighlight())
{
afmMCROrderNotes.toggleButton(ToggleButtonStyle::Check);
afmMCROrderNotes.toggleValue(OnOff::On);
}
else
{
afmMCROrderNotes.toggleValue(OnOff::Off);
}
}
// afmMCROrderNotes button lostFocus() need to be call the afmDocuNoteHandlingControl() method in salestable form
public void lostFocus()
{
super();
element.afmDocuNoteHandlingControl();
}
// afmMCROrderNotes button clicked
void clicked()
{
Args args;
FormRun formRun;
//Super();
args = new Args(formstr(MCROrderNotes));
args.record(SalesTable);
formRun = classFactory.FormRunClass(args);
formRun.init();
formRun.run();
formRun.wait();
}
__ below method in sales table
/// <summary>
/// To identity the whether sales order table has related record in docuref table or not with type Notes
/// </summary>
/// <returns>
/// return true if sales table has record in docuref of type Note found.
/// </returns>
public boolean afmShowDocuNotesHighlight()
{
DocuRef docuRef;
DocuType docuType;
boolean ret;
SysUserInfo sysUserInfo;
if(sysUserInfo.afmIsDocumentHandlingActive())
{
select firstonly RecId from docuRef
where docuRef.RefCompanyId == this.DataAreaId && docuRef.RefTableId == this.TableId && docuRef.RefRecId == this.RecId
exists join docuType
where docuType.TypeGroup == DocuTypeGroup::Note && docuType.TypeId == docuRef.TypeId;
if(docuRef.RecId)
{
ret = true;
}
}
return ret;
}
__
Verify whether documents handling is active for the current user.
/// <summary>
/// returns document handling user setup option for the current user.
/// </summary>
/// <returns>
/// returns true if document handling is been set to active and show attachments status set to true
/// </returns>
public boolean afmIsDocumentHandlingActive()
{
SysUserInfo sysUserInfo;
boolean ret;
select docuHandlingActive,docuToolbarButtonActive from sysUserInfo
where sysUserInfo.Id == curUserId();
if (sysUserInfo.docuHandlingActive && sysUserInfo.docuToolbarButtonActive)
{
ret = true;
}
return ret;
}
-------------------------------------------------------------------------------------------
for sales table list page
write below method in SalesTableListPageInteraction class and call it from selection changed
SalesTableListPageInteraction
// afmMCROrderNotes is the control name on the list page
public void afmFindDocuRefNotes()
{
FormDataSource fds;
SalesTable salestable = this.currentSalesTable();
fds = SalesTable.dataSource();
fds.formRun().control(fds.formRun().controlId('afmMCROrderNotes')).lostFocus();
}
// 'afmMCROrderNotes control on list page lost focus method
public void lostFocus()
{
super();
if(salesTable.afmShowDocuNotesHighlight())
{
afmMCROrderNotes.toggleButton(ToggleButtonStyle::Check);
afmMCROrderNotes.toggleValue(OnOff::On);
}
else
{
afmMCROrderNotes.toggleValue(OnOff::Off);
}
}
-------------------------------------------------------------------------------------------
for salesTable form
// The code which does the required functionality. to be written in salesTable form
void afmDocuNoteHandlingControl()
{
if(salesTable.afmShowDocuNotesHighlight())
{
afmMCROrderNotes.toggleButton(ToggleButtonStyle::Check);
afmMCROrderNotes.toggleValue(OnOff::On);
}
else
{
afmMCROrderNotes.toggleValue(OnOff::Off);
}
}
// afmMCROrderNotes button lostFocus() need to be call the afmDocuNoteHandlingControl() method in salestable form
public void lostFocus()
{
super();
element.afmDocuNoteHandlingControl();
}
// afmMCROrderNotes button clicked
void clicked()
{
Args args;
FormRun formRun;
//Super();
args = new Args(formstr(MCROrderNotes));
args.record(SalesTable);
formRun = classFactory.FormRunClass(args);
formRun.init();
formRun.run();
formRun.wait();
}
__ below method in sales table
/// <summary>
/// To identity the whether sales order table has related record in docuref table or not with type Notes
/// </summary>
/// <returns>
/// return true if sales table has record in docuref of type Note found.
/// </returns>
public boolean afmShowDocuNotesHighlight()
{
DocuRef docuRef;
DocuType docuType;
boolean ret;
SysUserInfo sysUserInfo;
if(sysUserInfo.afmIsDocumentHandlingActive())
{
select firstonly RecId from docuRef
where docuRef.RefCompanyId == this.DataAreaId && docuRef.RefTableId == this.TableId && docuRef.RefRecId == this.RecId
exists join docuType
where docuType.TypeGroup == DocuTypeGroup::Note && docuType.TypeId == docuRef.TypeId;
if(docuRef.RecId)
{
ret = true;
}
}
return ret;
}
__
Comments
Post a Comment