I am having a hard time extracting the Customer print management destination emails from the Customer Invoice Print Mgmt Settings.
Here is my code and i have attached screen-shots of the field i am trying to extract.
Any help would be appreciate!
{
CustTable custTable;
PrintMgmtSettings printMgmtSettings;
PrintMgmtDocInstance printMgmtDocInstance;
PrintJobSettings printJobSettings;
while select AccountNum from CustTable
{
while select DocumentType from PrintMgmtDocInstance
join PrintJobSettings from PrintMgmtSettings
where CustTable.RecId==PrintMgmtDocInstance.ReferencedRecId
&& PrintMgmtDocInstance.RecId==PrintMgmtSettings.ParentId
{
PrintJobSettings=new PrintJobSettings(PrintMgmtSettings.PrintJobSettings);
info printJobSettings;
pause;
}
}
}
*This post is locked for comments
Done. Thank again!
Hi,
NP.Could you please mark helpful answers as verified.
Exactly what i did and that worked perfectly!
Thank you so much for that help. Greatly appreciated!
Hi,
Just comment the line, where we specified the customer account in the above code.
This whole line "&& (custTable.AccountNum == "XYZ")".
Hi Chaitanya,
That worked!
One other thing if i may ask. How can i return all the accounts? I am able to specify the customer account but how can i have it return all records?
This jobs looks suitable for the original request, only one comment: instead AccountNum field in the CustTable, maybe the name() display method would fit better to the requester need.
Regards,
István
Hi,
You can use the following job to extract and export the customer email that is set in print management settings related to sales invoice(as highlighted below).
static void CustPrintMgmtMails(Args _args) { CustTable custTable; PrintMgmtSettings printMgmtSettings; PrintMgmtDocInstance printMgmtDocInstance; PrintJobSettings printJobSettings; SRSPrintDestinationSettings srsPrintDestinationSettings; CommaIO commaIO; FileName fileName; #File fileName = @"C:\\Cust.csv"; commaIO = new CommaIO(filename , #io_write); // Writes header commaIO.write("AccountNum", "Email"); while select DocumentType, Name, ReferencedRecId from printMgmtDocInstance where printMgmtDocInstance.DocumentType == PrintMgmtDocumentType::SalesOrderInvoice && printMgmtDocInstance.PrintType == PrintMgmtDocInstanceType::Original join custTable where custTable.RecId == printMgmtDocInstance.ReferencedRecId && printMgmtDocInstance.ReferencedTableId == tableNum(custTable) && (custTable.AccountNum == "XYZ") // specify customer account here, if needed join PrintJobSettings from PrintMgmtSettings where printMgmtDocInstance.RecId == printMgmtSettings.ParentId { srsPrintDestinationSettings = new SRSPrintDestinationSettings(printMgmtSettings.PrintJobSettings); commaIO.write(custTable.AccountNum, srsPrintDestinationSettings.emailTo()); //Outputs data to csv file //info(strFmt("AccountNum: %1, Email: %2", custTable.AccountNum, srsPrintDestinationSettings.emailTo(), printMgmtDocInstance.Name)); } }
I am attempting to export the customer name and account along with the Email that is in the Destination Field on the print management settings for the original invoice. The export can be in text or excel anything really. We are just trying to compile a list of the emails.
Hi,
First comment: using embedded while select is generally not an efficient coding habit, consider using join for the CustTable.
What was the aim of your code? Info requires a text, not a container, so right now I cannot see what do you want to write in the infolog, and why is there a pause? Do you want to have a short break after each line or what?
Regards,
István
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,228 Super User 2024 Season 2
Martin Dráb 230,056 Most Valuable Professional
nmaenpaa 101,156