• Mustapha Elmadi 14
  • 15 Points
  • Member since 2019

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 2
Hi there, I've got a very specific design outcome I'm trying to achieve in Lightning and I can't find any info relating to this on any of the usual channels.

I want to present a flow as a modal dialog box from a list view. This would mean a user could select multiple records, and run through the flow for each of the items. I have built a version that meets these criteria with the exception of presenting the flow in a modal dialog over the current list. Although this final requirement isn't critical to the functionality of the process, it is important to keep the experience consistent with other lightning processes.

I understand this could be completed through JS if I was using Classic, but our org has migrated to Lightning a while back and won't be moving.

Also, interestingly I can get the desired modal display using an Action, but this can't be added to a list view (only a detail view) in my understanding.

Does anyone have any suggestions as to how this could be achieved? Thanks in advance!

This is the current process:

Visualforce Page, launched by list view button
<apex:page standardController="Contact" lightningStyleSheets="true" tabStyle="Contact" recordSetVar="AllContacts" >
        <!-- Add below each field you reference in your Flow -->   
        <apex:repeat value="{!AllContacts}" var="row" rendered="false">
        <!-- Runs your Flow -->   
        <flow:interview name="Outbound_Call_Flow_Contact_v2" 
            finishLocation="{!URLFOR($Action.Contact.Tab, $ObjectType.Contact)}">
            <apex:param name="selectedContacts" value="{!Selected}"/>

Button settings
User-added image

List view
User-added image

Flow once launched (takes its own page, when I would like it to present modally)
User-added image

Desired presentation of flow
User-added image 
Hi all,

I need to create a pdf (with the lead information) when a lead is created, this pdf is saved as document.

I wrote an apex class with an invocable method which fire in a process builder after 
a lead creation, and a visualforce page to insert the lead information.

This system doesn't work for the lead that fired the process builder, instead it works 
if I insert an id of existing lead.

Which is the problem?

Apex class:
public class PdfLead {
@InvocableMethod(label='PDF' description='creo dei pdf')   
public static list<Document> pagePdf(){
    Lead l = [select id, name from lead order by CreatedDate desc limit 1];
    PageReference pdf = Page.PageOfLead;
    pdf.getParameters().put('id', l.Id);
    Blob body;
    // returns the output of the page as a PDF
    body = pdf.getContent();
    } catch (VisualforceException e) {
      body = Blob.valueOf('Some Text');
    List<Document> doc = new List<Document>();
    Document d = new Document(); 
        d.Name = l.Name; 
        d.Body = body; 
        d.ContentType = 'application/pdf';
        d.Type = 'pdf';
    insert doc;
    return doc;


Visualforce page:
<apex:page StandardController="Lead" renderAs="pdf">  
  <h2>Gentile {! Lead.Name }</h2>
  Ci risulta che lei lavora presso {!Lead.Company}<br/>
  Siamo riusciti a creare il file pdf con i suoi dati<br/>
  Grazie per aver richiesto informazioni per i nostri prodotti<br/>