• sfdcBahu
  • NEWBIE
  • 144 Points
  • Member since 2016

  • Chatter
    Feed
  • 4
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 21
    Replies
Can someone tell me how can i add more values to this drop down that shows up when i click on "Select Closed Status" from the path compoment.
User-added image
Failed to save customLookup.cmp: Invalid definition for null:customLookUpController: ApexService.getType() return null with currentNamespace: c, namespace: null, name: customLookUpController: Source
Hi,

I am newbie in Salesforce, what i am trying to do is creating a trigger for image files that starts with 'ABC' to open them to community. So this is my trigger in below but it gives this error when i am trying to upload a file starts with 'ABC':

FATAL_ERROR System.FinalException: Record is read-only
FATAL_ERROR Trigger.ContentDocumentLinkTrigger: line 4, column 1

I have used after insert because i am trying to fetch DocumentContentID and even if i change my trigger to before trigger it works other way around. It doesn't work for other image files. It just works for files with 'ABC' and it changes its visibility to on before trigger.

Can you please help me out? I couldn't sort it out in some way. I am using files by the way not notes&attachments.

trigger ContentDocumentLinkTrigger on ContentDocumentLink (after insert) {
  for (ContentDocumentLink cdl : Trigger.new) {
            if (getFileExtensionAndTitle(cdl)) {
                cdl.Visibility = 'AllUsers';
            }
        }
    
     public static Boolean getFileExtensionAndTitle(ContentDocumentLink cdl) {
        String docId = cdl.ContentDocumentId;
        ContentDocument contentdocument = [SELECT FileExtension,Title FROM ContentDocument WHERE Id = :docId LIMIT 1];
        Boolean isExpected = contentdocument.Title.startsWith('ABC') && (contentdocument.FileExtension.equals('jpg') || contentdocument.FileExtension.equals('jpeg') || contentdocument.FileExtension.equals('png'));
        return isExpected;
    }
}
List<OpportunityLineItem> oLIList = new List<OpportunityLineItem>();
oLIList = [SELECT Id, Product2Id, OpportunityId
                     FROM OpportunityLineItem
                    WHERE OpportunityId IN :oIdSet];
Map<Id, Map<Id, OpportunityLineItem>> oLIMap = new Map<Id, Map<Id, OpportunityLineItem>>();
        for(OpportunityLineItem oLI : oLIList){

I am querying for OpportunityLineItems and I need to put them in a map nested in a map were the inner map key is the product2Id and the outer map key is the opportunityId. But I cannot figure how to do this in the for loop. Also, the value of the inner map should be the OpportunityLineItem record. Thank you for your help.
I am trying to write a trigger and helper class for an Account that has the Type as "Prospect".  If the Account is updated and has no related Opportunities, two new Opportunities are added to the Account.  I have not had any luck getting the code to work.

Here is my Trigger:

trigger ResComOpportunityTrigger on Account (after update) {
    if(Trigger.isAfter && Trigger.isUpdate){
        ResComOpportunityHelper.UpdateOpps(Trigger.new);
    }
}

Here is my helper class:

public with sharing class ResComOpportunityHelper {

    static public void UpdateOpps(List<Account> acctList) {

        List<Opportunity> updateOppsList = new List<Opportunity>();

        acctList = [
                SELECT Id, Name, OwnerId, (SELECT Name, Id FROM Opportunities)
                FROM Account
                WHERE Type = 'Prospect'
        ];

        for (Account accUp : acctList) {
            for (Opportunity opp : accUp.Opportunities) {
                if (opp.Name == null) {
                    Opportunity opp1 = new Opportunity();
                    opp1.Name = 'Default Residential Opp';
                    opp1.AccountId = accUp.Id;
                    opp1.CloseDate = System.today().addMonths(3);
                    opp1.StageName = 'Prospecting';
                    updateOppsList.add(opp1);

                    Opportunity opp2 = new Opportunity();
                    opp2.Name = 'Default Commercial Opp';
                    opp2.AccountId = accUp.Id;
                    opp2.CloseDate = System.today().addMonths(3);
                    opp2.StageName = 'Prospecting';
                    updateOppsList.add(opp2);
                }
            }
        }
        insert updateOppsList;
    }
}

Any assistance would be appreciated!
Hello,

I have an iOS app that I would like to open from the Salesforce iOS app.

I have created a Connected App at salesforce and added my iOS app's custom URL scheme, like myapp:// and also a universal URL for iOS app, in Mobile Start URL filed. 

Salesforce app showing my Connected App in the Menu list but on selecting it, it's not opening my iOS app in the device.

Is there any way to do this?
have already written trigger on CDL object.

Whenever I am submitting service request with multiple attachment , 
trigger first should handle all attachment at once of that record and then must call apex method (send email) is the scenario.

At this time , for every attachment it is calling apex method and sending separate email.

Even If multiple attahment are attached to record , it sends separate email for every attachment.

(Note - can't write trigger on incident obj , as  after inser attachment is not getting available.)

Your help would be much appreciated.
Hello!
We use a third party system (QAssign) to automatically assign leads to users when they "Pull" them.
There is a button on the leads page that says "Pull" and when pressed, it assigns a lead from a queue to the user that pressed the button.
To increase speed, the team asked that when they hit "Pull" the lead auto populates on their screen so they are ready to dial out.
Do you know of a way to make this happen?
Goal: When pressed, find and populate to screen the lead that was most recently assigned to you.

How should I be thinking of a problem like this? Is this possible?

Thank you for your help!

Ethan
Can someone tell me how can i add more values to this drop down that shows up when i click on "Select Closed Status" from the path compoment.
User-added image
Failed to save customLookup.cmp: Invalid definition for null:customLookUpController: ApexService.getType() return null with currentNamespace: c, namespace: null, name: customLookUpController: Source
How to get All Objects and Their Field? Please help me thank before<.^.>
Hi,

I have created a component to show the contact activity in my object.

public class ContactActivityHistory {
    
    @auraEnabled
    
    public static list<Task> getContactTask(id contactId){
        system.debug('contactId ' +contactId );
        list<task> contactTask=new list<task>();
        list<Application__c> appList=[select id,Contact__c from Application__c where Contact__c=:contactId];
       
      //  Application__c appList=[select id,Contact__r.id,(select id,Subject,Description,Who.Name,ActivityDate From Tasks ) 
                             //  from  Application__c where Contact__r.id= :ContactId];
   
        list< Contact> cons=new list<Contact>();
        cons=[select id from contact where id=:appList[0].Contact__c];
       //  cons= [select id,(select id,subject,Description,Who.Name,ActivityDate From Tasks) from contact where id=:appList[0].Contact__c];
    list<Task> tsk=[select id,whoId from task where whoId=:cons];
        system.debug('Task' +tsk);
        return tsk;
    }
    
}

Componenet


<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes"
                access="global" controller="ContactActivityHistory">
    
    <aura:attribute name="recordId" type="Id"/>
   
    <aura:attribute name="newTask" type="Task" default="{'sobjectType':'Task'}"/>
    <aura:attribute name="tasks" type="Task[]"/>
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    
    <aura:iteration items="{!v.tasks}" var="item">
        {!item.Subject}, {!item.ActivityDate}<br/>
    </aura:iteration>
    
</aura:component>

Js

({
    
    doInit : function(component, event, helper)
    {
        console.log('Test activity');
        var action = component.get("c.getContactTask");
        console.log('Test Activity @@@@');
        //  var action2=component.get('v.recordId');
        action.setParams({            
            "ContactId" : component.get('v.recordId')
        });
        
        console.log('Test my contact record activity ' +component.get('v.recordId'));
        action.setCallback(this, function(response) {
            var state = response.getState();
            if(state === "SUCCESS"){
                var records = response.getReturnValue();
                console.log('Server-> ' + JSON.stringify(records));
                
                var newItems=[];
                for (var i=0; i< records.length; i++)
                {
                    var record = records[i];
                    console.log('record-> ' + JSON.stringify(record));
                    
                    //   var Item = {title: record.Name, id: record.Id, status: "Unassigned"};
                    //  console.log('Item-> ' + JSON.stringify(Item));
                    
                    newItems.push(record);
                    console.log('newItems-> ' + JSON.stringify(newItems));
                }
                //component.set("v.tasks", newItems);
                
                
            } 
            else if (state === "ERROR") {
                var errors = response.getError();
                if (errors) {
                    if (errors[0] && errors[0].message) {
                        console.log("Error message: " + 
                                    errors[0].message);
                    }
                }
                
            }            
            
        });
        $A.enqueueAction(action);
        
        
    }  
})

Hi folks,
my requirment is :
When checkbox is selected, then update Date format in lighitng aura component.
component.set("v.SFYI",ShortFirst);   // SFYI is aura boolean attribute 
      var SFYI = component.get("v.SFYI");
       // alert(SFYI);   // when checkbox selected , alert display True value
if(SFYI == "true") {    /////Here checkbox code is not working 
              var today = $A.localizationService.formatDate(new Date(), "YYYY-MM-DD");
              component.set('v.today', today);
               component.set("v.date",today);
            }

Issues getting:
if(SFYI == true) is not working  ,when checkbox is True, but its this line is not executing.
And
my requirement is , when checkbox is True , immediatlty date should be 1231
can you pls assist on this 
Thanks
VRK

  • March 26, 2020
  • Like
  • 0
Hi !
So, from what i found until now it seems pretty impossible to integrate some components developped in Angular (not angularJS) into LWC due to LockerService.
Is there any solution to be able to re-use some code done using Angular (component, app, web component, library, ...) in LWC ?

I know that LWC are the best practice usage right now when developping new things in sales force, that's why i wanted to see if it is possible to do that.

In my company we have currently differently web application running and we wanted to investigate to see if it could be possible to avoid to re-code our components and use them in sales force (even if it request few changes)

What is the best way to achieve this kind of problematic ?

Best Regards,

Yoann BOUTIN
In Field Service Lightning (FSL) - Can I apply condition in "Create Service Report" button. I need this button to work based on condition.
When I click this button it generates a pdf view and save this Report in Related List of "Service Report."

Also can we have a custom code before this button is Clicked.

Thanks 
Anil Singh
Hi,

I am newbie in Salesforce, what i am trying to do is creating a trigger for image files that starts with 'ABC' to open them to community. So this is my trigger in below but it gives this error when i am trying to upload a file starts with 'ABC':

FATAL_ERROR System.FinalException: Record is read-only
FATAL_ERROR Trigger.ContentDocumentLinkTrigger: line 4, column 1

I have used after insert because i am trying to fetch DocumentContentID and even if i change my trigger to before trigger it works other way around. It doesn't work for other image files. It just works for files with 'ABC' and it changes its visibility to on before trigger.

Can you please help me out? I couldn't sort it out in some way. I am using files by the way not notes&attachments.

trigger ContentDocumentLinkTrigger on ContentDocumentLink (after insert) {
  for (ContentDocumentLink cdl : Trigger.new) {
            if (getFileExtensionAndTitle(cdl)) {
                cdl.Visibility = 'AllUsers';
            }
        }
    
     public static Boolean getFileExtensionAndTitle(ContentDocumentLink cdl) {
        String docId = cdl.ContentDocumentId;
        ContentDocument contentdocument = [SELECT FileExtension,Title FROM ContentDocument WHERE Id = :docId LIMIT 1];
        Boolean isExpected = contentdocument.Title.startsWith('ABC') && (contentdocument.FileExtension.equals('jpg') || contentdocument.FileExtension.equals('jpeg') || contentdocument.FileExtension.equals('png'));
        return isExpected;
    }
}
Hello Awesome Devs!

Recently moved to Lightning and was used to dealign with attachments, but now trying to clone a record to have its files also associated to the new cloned version of the record as well as staying associated with the initial starting record. 

I am calling the class via a process that is called when a checkbox is marked true. 

Right now the error I get is very vauge and I am not sure what I need to refactor.  Error =  An Apex error occurred: System.UnexpectedException: null

Can someone take a look at my code below and let me know how I can can applomplish this feat?...

Thank you in advance for your help!
 
public class cloneTicketWithRelated {

    @InvocableMethod
    public static void cloneRecords(List<Ticket__c> ticketIds){
      
        List<Ticket__c> ticketsToProcess = ticketIds;
 	    List<Ticket__c> cloneList = ticketsToProcess.deepClone();
        
        List<Ticket__c> clonedTickets = new List<Ticket__c>();
       
        for(Ticket__c t : cloneList){
            clonedTickets.add(t);
        }
        
        if(clonedTickets.size()>0){
            insert clonedTickets;
        }
   }    
}

 
Hi Everyone,

Currently we are manually changing/updating custom field values every time we did refresh from production. But we have different values in Production and sandbox, when we refreshed sandbox values are getting Prod values and we are doing manual changes to them. 
To avoid this manual change is there any other way that can be auto update to old values whenever refresh is done??

Please provide a sample apex code and how to retrive the old values of custom setting
  • March 11, 2020
  • Like
  • 0
This file is sample  tab Elimated Text file .. how to read this file and add to the List and render  in visualforce page in Salesforce ..!
User-added image Apex Class:
public class Textfileimport{

 public blob Selectedfile{get;set;}
 public list<Studentdetails> Lststudentdetails{get;set;}
 
public Textfileimport(){
Lststudentdetails= new list<Studentdetails>();
}

public void add(){

}
 //wrapperclass
 public class Studentdetails{
 public string studentname{get;set;}
 public string studentId{get;set;}
 public integer studentyear{get;set;}
  }
 
}

visualforce page:
<apex:page Controller="Textfileimport"  >
    <apex:messages />
    <apex:form id="theForm">
  
     <apex:inputFile value="{!Selectedfile}"  id="testhide" />
     
      <apex:commandButton value="ImportValues" action="{!add}"/>
      
      <apex:pageBlock >
      
      <apex:pageblockTable value="{!Lststudentdetails}" var="a" >
       <apex:column headerValue="Name">{!a.studentname} </apex:column>
         <apex:column headerValue="Id" >{!a.studentId}</apex:column>
         <apex:column headerValue="Year">{!a.studentyear}</apex:column>
       
       </apex:pageblockTable>
      </apex:pageBlock>
       
       
      
     </apex:form>
</apex:page>


how to add to list and display in the visualforce page ....!

​​​​​​​Please share any related links it might be help full thank you...!
 
List<OpportunityLineItem> oLIList = new List<OpportunityLineItem>();
oLIList = [SELECT Id, Product2Id, OpportunityId
                     FROM OpportunityLineItem
                    WHERE OpportunityId IN :oIdSet];
Map<Id, Map<Id, OpportunityLineItem>> oLIMap = new Map<Id, Map<Id, OpportunityLineItem>>();
        for(OpportunityLineItem oLI : oLIList){

I am querying for OpportunityLineItems and I need to put them in a map nested in a map were the inner map key is the product2Id and the outer map key is the opportunityId. But I cannot figure how to do this in the for loop. Also, the value of the inner map should be the OpportunityLineItem record. Thank you for your help.
Hi guys,
           I have a visualforce page which I am embedding inside a lightning component using iframe. The code is 
<aura:component implements="force:lightningQuickAction,force:hasRecordId" access="global">
    <iframe src="{! '/apex/vf_page?Id=' + v.recordId }" width="100%" height="1000px;" frameBorder="0"/>
</aura:component>
I need the iframe to fit all the contents of the visualforce page without setting width and height to iframe. Do anyone have solution for this?