Monday, October 17, 2016

Attaching PO report as PO header attachment


/// <summary>
/// this method has logic to add po report pdf as external attachment against the POil
/// </summary>
/// <param name="_purchTable">
/// getting purchase order table as parameter
/// </param>
/// <param name="_fileName">
/// getting file name to attach as external attachment as parameter
/// </param>
//Begin
static void attachPOReport(PurchTable _purchTable, Notes _fileName)
{
    DocuRef docuRef;
    DocuActionArchive archive;
    ;

    if (_purchTable!=null)
    {
        try
        {
            docuRef.clear();
            docuRef.RefRecId = _purchTable.RecId;
            docuRef.RefTableId = tableNum(PurchTable);
            docuRef.RefCompanyId = curext();
            docuRef.Name = _fileName;
            docuRef.TypeId = 'File';
            docuRef.Restriction = DocuRestriction::External;
            docuRef.insert();
            archive = DocuAction::newDocuRef(docuRef);
            archive.add(docuRef, _fileName);
        }
        catch(Exception::CLRError)
        {
            //Access the last CLR Exception
            info(CLRInterop::getLastException().ToString());
            AifUtil::getClrErrorMessage();
            //See AifUtil::getClrErrorMessage for another alternative
            //how to parse the Exception object
        }

    }
}
//End

Since PO confirmation class is running server-side, docuActionArchive class->add method is changed to server-side. Refer this link in my blog: https://www.blogger.com/blogger.g?blogID=3375586050608221914#editor/target=post;postID=7858382166586064691;onPublishedMenu=editor;onClosedMenu=editor;postNum=1;src=postname

No comments:

Post a Comment