Hello, thank you for your response.
I was able to get a slightly better understanding based off combining this thread (https://forums.adobe.com/thread/1235441) with this one (https://forums.adobe.com/message/10056473). Again; might make perfect sense for some but I'm still growing in coding. I was just happy to get it to work. Now, it could certainly be coded better, but for now, my client seems happy with the solution. As time permits (and if projects EVER slow down enough to allow), I'll try and get a better understanding of what's going on in the code and modify it so that it incorporates some more validation, control, etc.
Here's what I used for each of the buttons for attaching, opening, and removing file(s):
Attach button:
// attach file to form
var myDoc = event.target;
var sFile = "MyAttachedFile";
myDoc.importDataObject({cName: sFile});
var myDataObject = myDoc.getDataObject(sFile);
var sFileName = myDataObject.path;
Main.sfAttachmentRequest.attachmentsList.addItem(sFileName,sFile);
Open button:
// open attachment in separate instance
try{
var myDoc = event.target;
var sFile = Main.sfAttachmentRequest.attachmentsList.rawValue;
myDoc.exportDataObject({ cName: sFile, nLaunch: 2 });
} catch(e) {
app.alert("There are no files to open");
}
Remove button:
// remove attachment from listbox
var myDoc = event.target;
var sFile = Main.sfAttachmentRequest.attachmentsList.rawValue;
app.alert("You have removed the highlighted file from the form",1);
myDoc.removeDataObject(sFile);
Main.sfAttachmentRequest.attachmentsList.deleteItem(Main.sfAttachmentRequest.attachmentsList.selectedIndex);
var myRemoveObject = event.target;
var a = myRemoveObject.getField("Main.sfAttachmentRequest.attachmentsList");
a.deleteItemAt(); // delete current item, and...
a.currentValueIndices = 0;
xfa.layout.relayout();
The example I built this from uses a list box to display the attached files which is great if attaching multiple files, but I'd like to figure out how to modify it for only attaching/displaying single files, as well. Probably a simple change.