You need to sign in to do that
Don't have an account?
jaredbaker
Xfdf issues
So, I have the code running to create the .xfdf and attach it to the proper account. Everything looked perfect, until I went to open my file. Instead of the .xfdf opening and overlaying the online form, it instead downloads a new copy of itself. Is there an issue in my xlm? What am I doing wrong here. Below is the code, and I have verified the .xfdf's are coming out correctly.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | public with sharing class CreateIO { DateTime nowDT=System.now(); String formatted=nowDT.format('MM-dd-yyyy'); private String getXmlString(JJSale__c a) { String s = '<?xml version="1.0" encoding="UTF-8"?>' + '<xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve">' + '<f href="https://na11.salesforce.com/resource/1300398748000/IO_JJ"/>' + '<fields>' + '<field name="Acct Rep"><value>' + a.CreatedBy.Name + '</value></field>' + '<field name="Ad Cost"><value>' + a.Ad_Price__c + '</value></field>' + '<field name="Address"><value>' + a.Organization__r.BillingStreet + '</value></field>' + '<field name="Advertiser"><value>' + a.Organization__r.Name + '</value></field>' + '<field name="Bill to"><value>x</value></field>' + '<field name="City"><value>' + a.Organization__r.BillingCity + '</value></field>' + '<field name="Contact"><value>' + a.Contact__r.Name + '</value></field>' + '<field name="Date"><value>' + formatted + '</value></field>' + '<field name="Email"><value>' + a.Contact__r.Email + '</value></field>' + '<field name="Fax"><value>' + a.Contact__r.Fax + '</value></field>' + '<field name="INSERTION DATES AND NOTES 1"><value>' + a.Journal_Issue__r.Name + '</value></field>' + '<field name="INSERTION DATES AND NOTES 2"><value>' + a.Page_Requested__c + ', ' + a.Insertion_Notes__c + '</value></field>' + '<field name="Phone"><value>' + a.Contact__r.Phone + '</value></field>' + '<field name="State"><value>' + a.Organization__r.BillingState + '</value></field>' + '<field name="Todays Date"><value>' + formatted + '</value></field>' + '<field name="Zip"><value>' + a.Organization__r.BillingPostalCode + '</value></field>' + '</fields><ids original="CB86FA72BFC7A2744D5052A67D1686EE" modified="C0A949601A5BB74AB94C1DAA08D65D2F"/>' + '</xfdf>'; return s; } public PageReference XFDFInit() { JJSale__c a = [SELECT Id, CreatedBy.Name, Ad_Price__c, Organization__r.BillingStreet, Organization__r.Name, Organization__r.BillingCity, Contact__r.Name, Contact__r.Email, Contact__r.Fax, Journal_Issue__r.Name, Page_Requested__c, Insertion_Notes__c, Contact__r.Phone, Organization__r.BillingState, Organization__r.BillingPostalCode FROM JJSale__c WHERE id = :ApexPages.currentPage().getParameters().get('id')]; String xmlContent = getXmlString(a); Attachment attachment = new Attachment(); attachment.Body = Blob.valueof(xmlContent); attachment.Name = a.Organization__r.Name + '_' + formatted + '.XFDF'; attachment.ParentId = a.Organization__r.Id; insert attachment; PageReference orgPage = new PageReference('/' + a.Organization__r.id); orgPage.setRedirect(true); return orgPage; } } |
Thank you Ron Hess for solving my problem. Its a browser issue. The file didn't want to open in Chrome. It actually does work!
All Answers
Thank you Ron Hess for solving my problem. Its a browser issue. The file didn't want to open in Chrome. It actually does work!