• Sujata Tiwari 3
  • NEWBIE
  • 0 Points
  • Member since 2016

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

I have a requirement to display the link of the uploaded file in the field.

I have created a formula field (View file) and using this hyperlink
HYPERLINK("#/ContentDocument/0690E000000Qfy1QAC/view?fv0=" &CORE_Tech_File_Link__c, "_self")

where ContentDocumentId - 0690E000000Qfy1QAC, CORE_Tech_File_Link__c is text field

but its throwing an error : No syntax errors in merge fields or functions. (Compiled size: 156 characters)
Also I want to make this hyperlink as dynamic.

Really appreciate your help.!!
Hi I want to create Upload file button, once the file is attached I want to create task which should be displayed in Activity timeline.
Also, I want to display the Link/URL of the file which was uploaded.

I have created file upload component, but not sure how to create a task. Also, how to display the link of file in activity timeline section (Open activity).
My lightning component:- 
UploadFileComponent<aura:component controller="UploadFile_Controller" implements="force:appHostable,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global"> 
    <aura:attribute name="multiple" type="Boolean" default="true"/>
    <aura:attribute name="disabled" type="Boolean" default="false"/>
<div class="wrapper">
    <lightning:fileUpload  name="fileUploader"
                           label= "Upload Files"
                           multiple="{!v.multiple}"
                           recordId="{!v.recordId}"
                           onuploadfinished="{! c.handleUploadFinished }"/>
    </div>
</aura:component>
UploadFileCompComtroller.js
({
    handleUploadFinished : function(component, event, helper) {
        var uploadedFiles = event.getParam("files");
        var documentId = uploadedFiles[0].documentId;
        var fileName = uploadedFiles[0].name;
        var toastEvent = $A.get("e.force:showToast");
        toastEvent.setParams({
            "title": "Success!",
            "message": "File "+fileName+" Uploaded successfully."
        });
        toastEvent.fire();
        
       // $A.get('e.lightning:openFiles').fire({
         //   recordIds: [documentId]
       // });
        
    }
})
UploadFileController.apx
public class CORE_UploadFileController {
    
    /* Method that inserts a document */
    @AuraEnabled
    public static Id saveTheFile(Id parentId, String fileName, String base64Data, String contentType) { 
        
        base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8');
        
        Attachment a = new Attachment();
        a.parentId = parentId;
        a.Body = EncodingUtil.base64Decode(base64Data);
        a.Name = fileName;
        a.ContentType = contentType;
        insert a;
        
        return a.Id;
    }
}

Really appreciate your help..!!
Thanks in advance.
Hi All,

I am giving inputs at run time, after hitting save button my records should get saved and display the record detail page. Here, I am using Standardcontroller = 'Lead'
<apex:page standardController="Lead" extensions="TrialReController" sidebar="false" showHeader="false">
<apex:form id="frm">
<apex:pageblock>
 <apex:pageblockButtons location="bottom">  
    <apex:commandButton value="Save" action="{!Save}" rendered="true" />
</apex:pageblockButtons>
<apex:pageblocksection columns="1">
    <apex:inputfield value="{!lead.FirstName}"/>
    <apex:inputfield value="{!lead.lastname}"/>
    <apex:inputfield value="{!lead.Phone}"/>
    <apex:inputfield value="{!lead.Email}"/> 
    <apex:inputfield value="{!lead.Account__c}"/> 
</apex:pageblocksection>
</apex:pageblock>
</apex:form>
</apex:page>
********************************************************
public class TrialReController {
    public boolean x{get;set;}
    public boolean y{get;set;}
    public Lead lead{get;set;}
    public TrialReController(ApexPages.StandardController controller) {
        Lead lead = new Lead();
    }
    public void Save(){
        insert Lead;     //used upsert also, still not working
        //return new PageReference('/'+Lead.Id);
       }
}

I am not able to save my records its throwing error :
Attempt to de-reference a null object
Error is in expression '{!Save}' in component <apex:commandButton> in page trialredesign: Class.TrialReController.Save: line 29, column 1

Many many thanks for your help..!!
Hi,

I want to display my Start button at first and when the user clicks on it then display ShowProducts button.
My Vf page :
<apex:page standardController="Lead" extensions="TrialReController" sidebar="false" showHeader="false">
<apex:form id="frm">
<apex:pageblock>
<apex:pageblockButtons location="bottom">
   <apex:commandButton value="Start" action="{!start}" rendered="{!x}" />
    <apex:commandButton value="ShowProducts" action="{!ShowProducts}" rendered="{!y}" />
</apex:pageblockButtons>

</apex:pageblock>
</apex:form>
</apex:page>
***************************************
public class TrialReController {
    public boolean x{get;set;}
    public boolean y{get;set;}
    public TrialReController(ApexPages.StandardController controller) {

    }
    public void start(){
        x=true;
        check();
    }
    public void ShowProducts(){
        y=true;
        check();
    }
    public void check(){
        if(x == true){
            y=false;
        }
        else{
            x=false;
        }
    }
}

When I am previewing my output I can't see any button there.
Many thanks for your help.!!
Hi,
Since I am new to development. I have been struggling to create VF page from the past 4 days. Need your help to create a single page with different functionalities.

Requirement: Create a page with start button when the user clicks on start button, on the same page (reload the page) display login page with input text fields of Lead Object so for that, I am using standardController = Lead in my VF Page and using command button "save" to save the records.
Save the Lead records in the backend which has LastName, FirstName and Account name after this display "Product" button and hide the previous buttons and display some 3 products with the checkboxes.
If the user selects any 1 or more than one product and clicks on submit. The Page should navigate to the Lead Detail page where it has last name, first name, account name details attached to it Also the products which the user has select on the product page should also be appended in the Lead Product related list on the Lead object.
FYI: Lead and Lead Product has lookup relationship.

Many Many thanks for your help...!!
Hi,
I tried doing this :
request.setHeader('Cache-Control','public,max-age=43200');
but still when I checked response in rest api. I can't see my value at max-age, it's still displaying like this :
Cache-Control: no-cache,must-revalidate,max-age=0,no-store,private

Please help me with this on how to proceed further on the same.

Thanks in advance..!!
Hi,
I tried doing this :
request.setHeader('Cache-Control','public,max-age=43200');
but still when I checked response in rest api. I can't see my value at max-age, it's still displaying like this :
Cache-Control: no-cache,must-revalidate,max-age=0,no-store,private

Please help me with this on how to proceed further on the same.

Thanks in advance..!!