public class NW_AttachmentAPIHelper
{
public static void AttachFileFromAPI(Filename _fileName , str _attachment , TableId _tableID , Recid _recid)
{
System.Byte[] reportBytes = new System.Byte[0]();
reportBytes = System.Convert::FromBase64String(_attachment);
System.IO.Stream stream = new System.IO.MemoryStream(reportBytes);
DocumentManagement::attachFile(_tableID, _recid, curExt(), DocuType::typeFile(),stream,
System.IO.Path::GetFileName(_fileName),
System.Web.MimeMapping::GetMimeMapping(_fileName),
System.IO.Path::GetFileNameWithoutExtension(_fileName));
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter