• Tester6789
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies
Hi All,

I have to add an attachment(resume) in my flow in one of the screens.The flow is on contact object.I have embedded the flow in a visual force page and and created its controller too,but Im confused how to call the VF page in my flow to add the attachment.

Here is the page:

<apex:page controller="InlineFlowAttachment" sidebar="false">

    
    <flow:interview name="Upload_Resume" interview="{!myFlow}"></flow:interview>
    
    <apex:outputPanel rendered="{!if(VarAttachmentParentID !='',true,false)}">
    <apex:pageMessages />
    <apex:form >
    <apex:pageBlock title="Upload an Attachment">
        <apex:pageBlockButtons >
            <apex:commandButton action="{!upload}" value="Save"/>
        </apex:pageBlockButtons>
    
    <apex:pageBlockSection showHeader="false" columns="2" id="block1">
    
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="File Name" for="FileName"/>
            <apex:inputText value="{!attachment.name}" id="FileName"/>
        </apex:pageBlockSectionItem>
    
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="File" for="File"/>
            <apex:inputfile value="{!attachment.body}" filename="{!attachment.name}" id="File"/>
        </apex:pageBlockSectionItem>
        
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="Description" for="Description"/>
            <apex:inputTextArea value="{!attachment.Description}" id="Description"/>
        </apex:pageBlockSectionItem>
    
    </apex:pageBlockSection>
    </apex:pageBlock>
     </apex:form>   
    </apex:outputPanel>
  </apex:page>
                                      

Here is the controller:

public with sharing class InlineFlowAttachment{

    public InlineFlowAttachment(ApexPages.StandardController controller) {

    }


    public Flow.Interview.Upload_Resume myflow{get;set;}
    
    public InlineFlowAttachment(){
    
        myflow=new Flow.Interview.Upload_Resume(new map<string,object>());
    
    }
    
    public string VarAttachmentParentID;
    
    public string getVarAttachmentParentID(){
      
        if(VarAttachmentParentID==null){
        VarAttachmentParentID='';
        return VarAttachmentParentID;
        }
        return myflow.VarAttachmentParentID;    
     }

    public Attachment attachment{
        get{
            if(attachment==null)
              attachment=new attachment();
              return attachment;  
        }
        set; 
    }

    public PageReference upload(){
    
        attachment.Ownerid=UserInfo.getUserID();
        Attachment.isPrivate=true;
        Attachment.parentid=getVarAttachmentParentID();
        
        try{
            insert attachment;
        }
    
        catch(DMLexception e){
            ApexPages.AddMessage(new ApexPages.Message(APexPages.Severity.Error,'Error'));
            return null;
            }
            
         finally{
             attachment=new attachment();
         }
         
         ApexPages.AddMessage(new ApexPages.Message(APexPages.Severity.INFO,'Success'));
         VarAttachmentParentID='';   
         return null;
    }
}

Any help will be appreciated.Thanks.
I have a simple flow in which I want to check whether atleast 2 out of 3 questions are anwered on one screen.Is there a way to check using validation rule in flow? 
I have used the following formula on one of the three fields but its not working.I think for validation rule in flow,the error message is displayed if the formula evaluates to false.Even if I put NOT() before the fields,it doesnt work.Please help.

NOT(AND(ISNULL({!HighAchieverAnswer}),OR(ISNULL({!ChangeAgentAnswer}),ISNULL({!SelfAwarenessAnswer}))))


Here is my flow. its being accessed by a button.User-added image

Thanks.
Hi All,

I have to add an attachment(resume) in my flow in one of the screens.The flow is on contact object.I have embedded the flow in a visual force page and and created its controller too,but Im confused how to call the VF page in my flow to add the attachment.

Here is the page:

<apex:page controller="InlineFlowAttachment" sidebar="false">

    
    <flow:interview name="Upload_Resume" interview="{!myFlow}"></flow:interview>
    
    <apex:outputPanel rendered="{!if(VarAttachmentParentID !='',true,false)}">
    <apex:pageMessages />
    <apex:form >
    <apex:pageBlock title="Upload an Attachment">
        <apex:pageBlockButtons >
            <apex:commandButton action="{!upload}" value="Save"/>
        </apex:pageBlockButtons>
    
    <apex:pageBlockSection showHeader="false" columns="2" id="block1">
    
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="File Name" for="FileName"/>
            <apex:inputText value="{!attachment.name}" id="FileName"/>
        </apex:pageBlockSectionItem>
    
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="File" for="File"/>
            <apex:inputfile value="{!attachment.body}" filename="{!attachment.name}" id="File"/>
        </apex:pageBlockSectionItem>
        
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="Description" for="Description"/>
            <apex:inputTextArea value="{!attachment.Description}" id="Description"/>
        </apex:pageBlockSectionItem>
    
    </apex:pageBlockSection>
    </apex:pageBlock>
     </apex:form>   
    </apex:outputPanel>
  </apex:page>
                                      

Here is the controller:

public with sharing class InlineFlowAttachment{

    public InlineFlowAttachment(ApexPages.StandardController controller) {

    }


    public Flow.Interview.Upload_Resume myflow{get;set;}
    
    public InlineFlowAttachment(){
    
        myflow=new Flow.Interview.Upload_Resume(new map<string,object>());
    
    }
    
    public string VarAttachmentParentID;
    
    public string getVarAttachmentParentID(){
      
        if(VarAttachmentParentID==null){
        VarAttachmentParentID='';
        return VarAttachmentParentID;
        }
        return myflow.VarAttachmentParentID;    
     }

    public Attachment attachment{
        get{
            if(attachment==null)
              attachment=new attachment();
              return attachment;  
        }
        set; 
    }

    public PageReference upload(){
    
        attachment.Ownerid=UserInfo.getUserID();
        Attachment.isPrivate=true;
        Attachment.parentid=getVarAttachmentParentID();
        
        try{
            insert attachment;
        }
    
        catch(DMLexception e){
            ApexPages.AddMessage(new ApexPages.Message(APexPages.Severity.Error,'Error'));
            return null;
            }
            
         finally{
             attachment=new attachment();
         }
         
         ApexPages.AddMessage(new ApexPages.Message(APexPages.Severity.INFO,'Success'));
         VarAttachmentParentID='';   
         return null;
    }
}

Any help will be appreciated.Thanks.
I have a simple flow in which I want to check whether atleast 2 out of 3 questions are anwered on one screen.Is there a way to check using validation rule in flow? 
I have used the following formula on one of the three fields but its not working.I think for validation rule in flow,the error message is displayed if the formula evaluates to false.Even if I put NOT() before the fields,it doesnt work.Please help.

NOT(AND(ISNULL({!HighAchieverAnswer}),OR(ISNULL({!ChangeAgentAnswer}),ISNULL({!SelfAwarenessAnswer}))))


Here is my flow. its being accessed by a button.User-added image

Thanks.