D365 F&SCM - Get the Azure Attachment Document URL via X++
Problem Statement:
The user requires that all invoice-related document attachments be accessible from a single location within the voucher transaction window. Based on their needs, the user should be able to view each document by clicking on its corresponding hyperlink.
Fix:
Introduce one display method for fixing this requirement.
Step 1: Add a single-line text box to the existing voucher transaction window. (FormStringControl: DocValue_AccessInformation)
Step 2: Use the COC to get the document location.
internal final class GeneralJournalEntry_Extension
{
[SysClientCacheDataMethod(true)]
display Str1260 displayVendorTransactionAttachment()
{
DocuValue docuValue;
Str1260 accessInformation ='';
docuValue = this.getDocuAttachment(this.getvendTransTable());
if(docuValue)
{
accessInformation = docuValue.AccessInformation;
}
return accessInformation;
}
Step 3: Set the following Property for the newly added FormStringControl: DocValue_AccessInformation
Data Source as "GENERALJOURNALENTRY"
Data method as "GeneralJournalEntry_Extension.displayVendorTransactionAttachment"
Step 4: Introduce a new EventHandler for enabling the Hyperlink options.
internal final class LedgerTransVouchers_EventHandler
FormControlEventHandler(formControlStr(LedgerTransVouchers, DocValue_AccessInformation), FormControlEventType::JumpRef)]
{
FormStringControl urlControl = sender as FormStringControl;
str documentUrl = urlControl.text();
if (documentUrl && strLen(documentUrl) >0 )
{
Browser browser = new Browser();
browser.navigate(documentUrl, true); // true = open in new tab
}
}
}
Comments
Post a Comment