You need to sign in to do that
Don't have an account?
Mélanie Texereau
Bug with publisher action in Salesforce
Hi,
I would create a post in Chatter with a PDF of my quote, in action for SF1. My code works fine in Salesforce 1 but in Salesforce, when I refresh my details page of my quote, a new post with my PDF is created. Each time I refreshed my page, a new post is created. Can you help me ?
This is my class :
This is my VF page :
Thanks for your help.
I would create a post in Chatter with a PDF of my quote, in action for SF1. My code works fine in Salesforce 1 but in Salesforce, when I refresh my details page of my quote, a new post with my PDF is created. Each time I refreshed my page, a new post is created. Can you help me ?
This is my class :
public with sharing class VFC38_SF1_DevisPDF { public DevisCommande__c devis {get;set;} public VFC38_SF1_DevisPDF(ApexPages.StandardController sc) { devis = (DevisCommande__c) sc.getRecord(); } public void redirect(){ PageReference pageRef = new PageReference('/apex/VFP16DevisPDF?id=' + devis.Id); String stringToBlob = Test.isRunningTest() ? 'test' : EncodingUtil.base64Encode(pageRef.getContent()); system.debug('### TEST 2'); String folderId = [SELECT Id FROM Folder WHERE Name = 'Devis'].Id; FeedItem post = new FeedItem(); /* Create a document */ Document d = new Document(); d.Name = 'Devis ' + String.valueOf(DateTime.now().format('dd/MM/yyyy hh:mm:ss')); d.ContentType = 'application/pdf'; d.Type = 'pdf'; d.FolderId = folderId; d.Body = EncodingUtil.base64Decode(stringToBlob); /* Create a post chatter */ post.ParentId = devis.Id; post.Type = 'ContentPost'; post.ContentData = d.Body; post.ContentFileName = d.Name+'.pdf'; insert post; } }
This is my VF page :
<apex:page docType="html-5.0" sidebar="false" showheader="false" standardController="DevisCommande__c" extensions="VFC38_SF1_DevisPDF" standardStyleSheets="false" action="{!redirect}"> </apex:page>
Thanks for your help.
So I can't call a method in my action VF page in publisher action ?
How can I do otherwise ?
Thanks for your help Jim Jam.