• Deepak Kumar Sharma
  • NEWBIE
  • 35 Points
  • Member since 2018
  • Salesforce Developer
  • Astrea IT Services

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 17
    Replies
Hi,
I created a lightning component that used an anchor tag for downloading vcf (or text) file but this is not working in Salesforce1 specially with iphone (ios version 12.4.1 as per salesforce norm). 

you can reproduce that from your side as well :-
  • Just create a component with anchor tag and try to download a simple text file from Component's JS Controller.
  • Then create quick action for that component.
  • Then drag and drop above quick action on page layout of any object.
  • Then login with salesforce1 app in iPhone (ios version > 12.0) and try to download a file on click of anchor tag.
  • Then you will see downloading is working for desktop but not in SF1 mobile app.

Here is sample code for this:-
 
>> Copy and paste following sample code in component :-
 
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    <aura:attribute name="uriContent" type="String" default=""/>
<ui:button label="Download" class="slds-button slds-button--neutral" labelClass="label" press="{!c.download}"/>
    <a title="anchor" name="download!" href="{!v.uriContent}" id="test" download="Test.txt" aura:id="downloadLink" target="_blank" ></a>
</aura:component>
 
>> Copy and paste following sample code in component's JS controller:-
 
({
download : function(component, event, helper) {
        var NameOfRecord = 'Test';
        component.set("v.uriContent","data:application/octet-stream," + 'This is my text File!!');
        //var link = document.getElementById("test");
        var link = component.find('downloadLink').getElement();
        link.href = component.get("v.uriContent");
        link.download = NameOfRecord+'.txt';
        link.click();
}
})

Thanks & Regards,
Deepak
Hi All,
Is there anyone who could suggest that what are neccessary steps for becoming "Trailblazer"?
Thanks
Is there any one who can tell me the relation between public calendars and event. I am not able to figure out how salesforce able to show events corresponding to public calendars and resources. Is it any kind of record type on event or lookup? Actually i want to query all events corresponding to Public calendar and resources.
Thanks in advance :)
 
<apex:page controller="CheckEmailwithContact" >
  
  <apex:form >
  <apex:pageBlock title="Select Options as per your choice" >
<apex:selectRadio value="{!selectedCheckbox}" onclick="!getCons2(this.value)"  immediate="true">
<apex:selectOptions value="{!items}"/>
</apex:selectRadio><p/>
<!--<apex:commandButton value="Click Here" action="{!getCons2}"/>-->
</apex:pageBlock>
</apex:form>
 <apex:pageblock >
          <apex:pageBlockTable value="{!conlists}" var="l" id="Table">
          <apex:column headerValue="First Name" value="{!l.FirstName}"/>
          <apex:column headerValue="Last Name" value="{!l.LastName}"/>     
          <apex:column headerValue="Email" value="{!l.Email}"/>  
          </apex:pageBlockTable>
          
  </apex:pageBlock>
 
</apex:page>

 
I am trying to call the class from trigger... getting the error 'Method does not exist or incorrect signature: void acctphoneupdate(List<Account>) from the type AccClass1'. Pls help in resolving this issue.

I have the following Class

public class AccClass1 {
           public static acctphoneupdate(List<Account> Acc) {
//        list<Account> Acct = [Select Phone from Account];
//            for ( Account Acc : Acct) {
                if (Acc.phone == '4001002000')
                {
                    Acc.phone = '4040404040';
                    insert Acc;
                }
//            }
    }
}

I have the trigger as below:

trigger Acctrigger1 on Account (before insert) {
    AccClass1 first = new AccClass1();
    first.acctphoneupdate(Trigger.new); <--- This is the line of code having issue. 
}
  • April 08, 2018
  • Like
  • 0
I am getting this error when I am during account upsert. What does the row number in this error message mean?  
Hi All,

I am new to salesforce. Got an requirement to create a Visual force page in lightning for list-view of Custom object and also, i should be able to perform in-line editing on their list views.

Any help is highly appreciated.
  • March 26, 2018
  • Like
  • 0
Hello.
Anyone, please provide me a legit guide to avail sample projects for practicing.
Hi all,
when account have some related opprtunities i want to update opportunity field when account is updated it should get updated for one related opportunity or more than one using batch class 
Can you help me through this

Thanks in Advance
Jordan
public class PrintPageController {
    Public CPL_Protocols__c cp{get;set;}
    public ID cplid{get;set;} // used to pass values from controller to VF page.
    
    public PrintPageController(ApexPages.StandardController controller) {    // Default Constructor Method to fetch data.
        cplid = apexpages.currentpage().getparameters().get('Id');
        
        if(cplid!=null){
            cp =[select id,ownerId,Study_Protocol_Number__c,Approval_Step_Status__c,Status_Date_Time_Stamp__c,Protocol_Status__c, Labels_Due_Date__c,
                 Number_of_Labels_to_Printed__c,Contact__c,user_email__c,Name,
                 Number_of_Study_Sites__c,Study_Type__c,Treatment_Period__c,Country__c,
                 Study_Phase__c,Study_Protocol_Description__c,No_of_Treatment_Grp__c,Enrollment_Period__c,
                 Study_Duration__c,Dosing_Regimen__c,Primary_Packaging__c,Secondary_Packaging__c,Label_Information__c,
                 Labeling_Lot_Number__c,Storage_Requirements__c,Max_Exposure_Time__c,Label_Expiration_Date__c,
                 Packaging_Site__c,Labeling_Site__c,Quantity_Required__c,Sampling_Requirements__c,CreatedById,Labeling_Package_Instructions__c,
                 Calculated_Qty_to_be_Prepared__c,Randomization__c,Randomization_File_Acknowledgement__c,LastModifiedById
                 from CPL_Protocols__c where id=:cplid]; // using ID, it displays the CPL Fields.
            system.debug('The value of CPL Prtocol is'+cp); // To Find and Resolve problems in execution.
        } 
    }
}





VF page:

<apex:page standardController="CPL_Protocols__c" renderAs="pdf" applyBodyTag="false" docType="html-5.0" standardStylesheets="false" showHeader="false" extensions="PrintPageController">
    
    <apex:form >
        <apex:pageBlock title="CPL Request Information Detail">
            <apex:pageBlockSection title="Status" columns="2">
                <apex:outputfield value="{!CPL_Protocols__c.OwnerId}"/>  
                <apex:outputfield value="{!CPL_Protocols__c.Study_Protocol_Number__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Approval_Step_Status__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Status_Date_Time_Stamp__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Protocol_Status__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Labels_Due_Date__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Number_of_Labels_to_Printed__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Contact__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.user_email__c}"/>  
            </apex:pageBlockSection> 
        </apex:pageBlock>
        
        
        <apex:pageblock >
            <apex:pageBlockSection title="Study Information" columns="2">
                <apex:outputfield value="{!CPL_Protocols__c.Name}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Number_of_Study_Sites__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Study_Type__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Treatment_Period__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Country__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Study_Phase__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Study_Protocol_Description__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.No_of_Treatment_Grp__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Enrollment_Period__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Study_Duration__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Dosing_Regimen__c}"/>  
            </apex:pageBlockSection>
        </apex:pageblock>
        
        <apex:pageblock >
            <apex:pageBlockSection title="Product Information" columns="2">
                <apex:outputfield value="{!CPL_Protocols__c.Primary_Packaging__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Secondary_Packaging__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Label_Information__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Labeling_Lot_Number__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Storage_Requirements__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Max_Exposure_Time__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Label_Expiration_Date__c}"/>   
            </apex:pageBlockSection>
        </apex:pageblock>
        
        <apex:pageblock >
            <apex:pageBlockSection title="Packaging/Labeling Operation" columns="2">
                <apex:outputfield value="{!CPL_Protocols__c.Packaging_Site__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Labeling_Site__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Quantity_Required__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Sampling_Requirements__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.CreatedById}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Labeling_Package_Instructions__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Calculated_Qty_to_be_Prepared__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Randomization__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.Randomization_File_Acknowledgement__c}"/> 
                <apex:outputfield value="{!CPL_Protocols__c.LastModifiedById}"/>   
            </apex:pageBlockSection>
        </apex:pageblock>
    </apex:form>
    
    <apex:relatedList list="Parts__r" />
    <apex:relatedList subject="{!CPL_Protocols__c}" list="Histories" />
    <apex:relatedList subject="{!CPL_Protocols__c}" list="ProcessSteps" />
    <apex:relatedList subject="{!CPL_Protocols__c}" list="ActivityHistories" />
    <apex:relatedList subject="{!CPL_Protocols__c}" list="OpenActivities" />
    <apex:relatedList subject="{!CPL_Protocols__c}" list="AttachedContentDocuments" />
    
    
</apex:page>

 
Here is my code,  I was not able to find the error ..
====================================
component :
<aura:component controller = "opplist">
    <aura:attribute name="opportunities" type="list"/>
    <aura:handler name="init" value="doinit" action="{!v.doinit}"/>
    <table class="slds-table slds-table--bordered slds-table--striped slds-table--cell-buffer slds-table--fixed-layout">
        <thead>
          <tr class="slds-text-heading--label">
            <th scope="col"><div class="slds-truncate" title="ID">ID</div></th>
            <th scope="col"><div class="slds-truncate" title="Name">AccountId</div></th>
            <th scope="col"><div class="slds-truncate" title="Type">probability</div></th>
            <th scope="col"><div class="slds-truncate" title="Number Of Employees">stageName</div></th>
            <th scope="col"><div class="slds-truncate" title="Ticker Symbol">Close Date</div></th>
            <th scope="col"><div class="slds-truncate" title="Phone">Opportunity Currency</div></th>
            <th scope="col"><div class="slds-truncate" title="Delete">Amount</div></th>
          </tr>
        </thead>
        <tbody>
            <aura:iteration items="{!v.opportunities}" var ="x">
                <tr>
          <th scope="row"><div class="slds-truncate" title="{!account.Id}">{!x.Id}</div></th>
          <td><div class="slds-truncate" title="{!account.Name}">{!x.AccountId}</div></td>
          <td><div class="slds-truncate" title="{!account.Type}">{!x.probability}</div></td>
          <td><div class="slds-truncate" title="{!account.NumberOfEmployees}">{!x.stageName}</div></td>
          <td><div class="slds-truncate" title="{!account.NumberOfEmployees}">{!x.closeDate}</div></td>
          <td><div class="slds-truncate" title="{!account.TickerSymbol}">{!x.OpportunityCurrency}</div></td>
          <td><div class="slds-truncate" title="{!account.Phone}">{!x.Amount}</div></td>
                </tr>
           </aura:iteration>                            
        </tbody>
    </table>
</aura:component>
===============================================
controller :
public class opplist {
   
    @AuraEnabled
    public static list<opportunity> getopplist(){
        
        list<opportunity> opps = new list<opportunity>([select Id,AccountId,probability,stageName from opportunity]);
        return opps;
    }
}
===========================
Helper controller :

({
    getopplist : function(component) {
         var action = component.get("v.getopplist");
        
        var self = this;
        action.setCallback(this, function(actionResult) {
            
            component.set('v.getopplist', actionResult.getReturnValue());
         });
          $A.enqueueAction(action);
    }
})

================================================
component controller

({
    doinit : function(component, event, helper) {
        helper.getAccountlist(component);
    }
})

 
Hello guys, I have the following Visualforce page, name is screen1VSF with a controller.

<apex:page controller="screen1">
   <apex:form >
       <apex:pageBlock >
           <apex:pageBlockSection >
               <apex:inputField value="{!account.name}"/>
               <apex:commandButton value="Save" action="{!save}"/>
           </apex:pageBlockSection>
       </apex:pageBlock>
   </apex:form>
</apex:page>

public class screen1 
{
    public Account myAccount;
    public Account callAccMethod; 
    
    public Account getAccount()
    {
        if(myAccount == null)
        {
            myAccount = new account();
        }
        return myAccount;
    }

    public PageReference save()
    {
       callAccMethod = getAccount();
       if(callAccMethod != null)
       {
           insert myAccount;
       }
       
       PageReference pageRef = new PageReference('/apex/screen2');
       pageRef.getParameters().put('id', myAccount.Id);
       return pageRef;
     }
}

I read some documentation from here: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_error_handling.htm but I'm still confused how this testing with VF works. Any ideas how can I test my visualforce page and explain how you did it, i want to learn.
write a query to get parent with max no of child records?
We are trying to use the E2Excel "Export to Excel" button (downloaded from the App Exchange) on custom objects and it seems to work if you include it directly on the object, but when we try to lauch the button from a 'Related List' we are getting an error message: 

A problem with the OnClick JavaScript for this button or link was encountered: Cannot read property 'value' of undefined

I have very little experience with Java but here is the code they included in the instructions for installation of the botton on the object:

var str = parent.location.href;
var sobjid=str.substring(str.indexOf("?fcf")-3,str.indexOf("?fcf"));
var idArray = {!GETRECORDIDS('selected')};
var listview = document.getElementsByName('fcf')[0];
var listId = listview.value;
var listName = listview.options[listview.selectedIndex].text;
var idString = JSON.stringify(idArray);
window.open('apex/E2Ex__Export_To_Excel?idString='+idString+'&sobjid='+sobjid+'&listid='+listId+'&listName='+listName);

Again, it has worked 'as expected' when added to the Object. But when trying to use it from a 'related list' we get the error message. The buttom appears on the Related List next to the "New" button. Any help you can offer to sort this out, would be greatly appreciated. 

Hi Guys,

 

I have this requirement, any idea how can I make use of checkboxes as radio buttons ? I don't need radio buttons

 

 

  • April 04, 2012
  • Like
  • 0