• Brandon Nelson 9
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 4
    Replies
I have looked everywhere and I can't find a good answer. I have some custom objects with standard lookup fields on them. The users are wanting those lookup fields to be able to select multiple records in the object they are looking up to. I know the functionality is there, because you can do this on the user lookup object, but not in the custom objects. 

Can someone PLEASE tell me how I can create a lookup field that will allow the user to select multiple records from the object that lookup field is looking up to?
I have a trigger that I need to put in production, but I keep getting the following error. Can someone please look at my trigger and tell me why this is happening?
ERROR: The following triggers have 0% code coverage. Each trigger must have at least 1% code coverage.
Trigger ConvertToClient on Lead_Prospect__c(after insert, after update){
  //Adding the name to the Client record//
     
     List<Client__c> cons =new List<Client__c>();
     String idStore = null;
     Object tId = null;
     for(Lead_Prospect__c a :trigger.new){
     
         idStore = (String)a.id;
         List<Client__c> idChecks = [SELECT Prospect_ID__c FROM Client__c WHERE Prospect_ID__c = :idStore];
       if(a.Convert_to_Client__c == true && idChecks.size() <= 0){
          Client__c c  =new Client__c();
          c.Name = a.Name;
          c.Enagement_Type__c = a.Engagement_Type__c;
          c.Prospect_ID__c = a.id;
          tId = a.id;
           cons.add(c);
        
           }
   }
if (cons.size()>0){
    insert cons;
    Client__c c = [SELECT Prospect_ID__c FROM Client__c WHERE Prospect_ID__c = :idStore];
    Lead_Prospect__c a = [SELECT Client_Name__c FROM Lead_Prospect__c WHERE Id = :idStore];
    a.Client_Name__c = c.id;
    
    update a;
}
}



 
I'm having an issue trying to show ID, NAME, and URL of attachment based on who uploaded it. Problem is the code is showing results even without an attachment.... Can someone please look at my code and help me understand why?
Again, I need the page to show Attachment NAME, ID, Client NAME, ID and URL to attachment.

APEX CLASS
 
public with sharing class DisplayAttachments{
public List<Account> Records {get; set;}
public DisplayAttachments(){
    String userId = userinfo.getUserId();
    Records = [select Id,Name,(Select Id,Name from Attachments) From Account Where CreatedById =:userId];
    }
}

VISUALFORCE PAGE
 
<apex:page controller="DisplayAttachments" >

    <apex:pageBlock title="{!$User.FirstName} {!$User.LastName}'s Attahments">       

    <apex:pageBlockTable value="{!Records}" var="Record">

     <apex:column >

     <apex:facet name="header">Client ID</apex:facet>

     <apex:outputText value="{!Record.Id}"/>

     </apex:column>

     <apex:column >

     <apex:facet name="header">Client Name</apex:facet>

     <apex:outputText value="{!Record.Name}"/>

     </apex:column>

     <apex:column >

     <apex:facet name="header">Attachment ID</apex:facet>

        

        <apex:pageBlockTable value="{!Record.Attachments}" var="a">

            <apex:column >

                <apex:outputField value="{!a.Id}"/>

            </apex:column>

        </apex:pageBlockTable>
         

     </apex:column>
     

     <apex:column >

     <apex:facet name="header">Attachment Name</apex:facet>

         <apex:pageBlockTable value="{!Record.Attachments}" var="a">

            <apex:column >

                 <apex:outputField value="{!a.Name}"/>

            </apex:column>

        </apex:pageBlockTable>

     </apex:column>-->

       </apex:pageBlockTable>

     </apex:pageBlock>
       
     </apex:page>

 
I have an issue where I as the Admin have created a report for someone and I get the results. When they run it (And I run it as them), it returns 0. They have permission to the group that I'm filtering on, so all in all, I think they should be able to see it!

Please help me! I really dont know where else to look for this answer!?
OK my fellow Admins, I need some help.

I have a standard object (Task) with a custom field called 'Notify'. It is a lookup field from the USERS object. What I need to happen is when that 'Notify' field is NOT NULL, I need an email to go to that person.
I thought about doing a formula, but can't get it to work so I'm turning to APEX (Which I know nothing about).

All I need, is if that field is filled out, take the inserted user, get the email address, and send them an email with the link to the task.

Any thoughts????

Brandon
I have looked everywhere and I can't find a good answer. I have some custom objects with standard lookup fields on them. The users are wanting those lookup fields to be able to select multiple records in the object they are looking up to. I know the functionality is there, because you can do this on the user lookup object, but not in the custom objects. 

Can someone PLEASE tell me how I can create a lookup field that will allow the user to select multiple records from the object that lookup field is looking up to?
I have looked everywhere and I can't find a good answer. I have some custom objects with standard lookup fields on them. The users are wanting those lookup fields to be able to select multiple records in the object they are looking up to. I know the functionality is there, because you can do this on the user lookup object, but not in the custom objects. 

Can someone PLEASE tell me how I can create a lookup field that will allow the user to select multiple records from the object that lookup field is looking up to?
I have a trigger that I need to put in production, but I keep getting the following error. Can someone please look at my trigger and tell me why this is happening?
ERROR: The following triggers have 0% code coverage. Each trigger must have at least 1% code coverage.
Trigger ConvertToClient on Lead_Prospect__c(after insert, after update){
  //Adding the name to the Client record//
     
     List<Client__c> cons =new List<Client__c>();
     String idStore = null;
     Object tId = null;
     for(Lead_Prospect__c a :trigger.new){
     
         idStore = (String)a.id;
         List<Client__c> idChecks = [SELECT Prospect_ID__c FROM Client__c WHERE Prospect_ID__c = :idStore];
       if(a.Convert_to_Client__c == true && idChecks.size() <= 0){
          Client__c c  =new Client__c();
          c.Name = a.Name;
          c.Enagement_Type__c = a.Engagement_Type__c;
          c.Prospect_ID__c = a.id;
          tId = a.id;
           cons.add(c);
        
           }
   }
if (cons.size()>0){
    insert cons;
    Client__c c = [SELECT Prospect_ID__c FROM Client__c WHERE Prospect_ID__c = :idStore];
    Lead_Prospect__c a = [SELECT Client_Name__c FROM Lead_Prospect__c WHERE Id = :idStore];
    a.Client_Name__c = c.id;
    
    update a;
}
}



 
I'm having an issue trying to show ID, NAME, and URL of attachment based on who uploaded it. Problem is the code is showing results even without an attachment.... Can someone please look at my code and help me understand why?
Again, I need the page to show Attachment NAME, ID, Client NAME, ID and URL to attachment.

APEX CLASS
 
public with sharing class DisplayAttachments{
public List<Account> Records {get; set;}
public DisplayAttachments(){
    String userId = userinfo.getUserId();
    Records = [select Id,Name,(Select Id,Name from Attachments) From Account Where CreatedById =:userId];
    }
}

VISUALFORCE PAGE
 
<apex:page controller="DisplayAttachments" >

    <apex:pageBlock title="{!$User.FirstName} {!$User.LastName}'s Attahments">       

    <apex:pageBlockTable value="{!Records}" var="Record">

     <apex:column >

     <apex:facet name="header">Client ID</apex:facet>

     <apex:outputText value="{!Record.Id}"/>

     </apex:column>

     <apex:column >

     <apex:facet name="header">Client Name</apex:facet>

     <apex:outputText value="{!Record.Name}"/>

     </apex:column>

     <apex:column >

     <apex:facet name="header">Attachment ID</apex:facet>

        

        <apex:pageBlockTable value="{!Record.Attachments}" var="a">

            <apex:column >

                <apex:outputField value="{!a.Id}"/>

            </apex:column>

        </apex:pageBlockTable>
         

     </apex:column>
     

     <apex:column >

     <apex:facet name="header">Attachment Name</apex:facet>

         <apex:pageBlockTable value="{!Record.Attachments}" var="a">

            <apex:column >

                 <apex:outputField value="{!a.Name}"/>

            </apex:column>

        </apex:pageBlockTable>

     </apex:column>-->

       </apex:pageBlockTable>

     </apex:pageBlock>
       
     </apex:page>

 
I have an issue where I as the Admin have created a report for someone and I get the results. When they run it (And I run it as them), it returns 0. They have permission to the group that I'm filtering on, so all in all, I think they should be able to see it!

Please help me! I really dont know where else to look for this answer!?