• Matt Eck
  • NEWBIE
  • 55 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 6
    Replies
Hey Everyone,

I'm trying to create a login flow that will update a record whenever a person logs in, or create one if it doesn't already exist. I have it working right now so that whenever someone logs in it will create a new record, but I can't figure out a way that I can check to see if a record already exists and then choose to update or create the record based on that. Is their any way this can be done in a login flow? 

Any help would be really appreciated.
Thanks!
I'm having what I think is a very simple problem but I can't seem to figure out how to solve it. I'm trying to selsect a feild selected from a dropdown box and pass it to an apex class.

I have this apex class:
public class AssignBadgeToUser {
    public WorkBadgeDefinition curRecord {get; set;}
    public WorkBadge newAssignment {get; set;}
    public WorkThanks thanks{get; set;}
    public List<User> UserTemp = new List<User>();
   
    
    public AssignBadgeToUser(ApexPages.StandardController stdController)
    {
        this.curRecord = (WorkBadgeDefinition)stdController.getRecord();
        this.newAssignment = new WorkBadge();
        
    }
    
    //creates the List to populate the list of users on the visualforce page
    public List<SelectOption> UserList
    {
        get
        {
            UserTemp = [Select LastName, Id, FirstName, Email From User];
            UserList = new List<SelectOption>();
            
            for(User temp : UserTemp)
            {
                UserList.add(new SelectOption(temp.Id, temp.FirstName + ' ' + temp.LastName + ' ' + temp.Id));
            }
            return UserList;
        }
        set;
    }
    
    public void CreateAssignment()
    {
        //WorkThanks record is used to create the thanks.id which is needed as the newassignmanet sourceid
        this.thanks = new WorkThanks(GiverID = UserInfo.getUserId(), Message = 'Automated Message');
        try
        {
            insert this.thanks;
       	} catch(Exception e)
        {
         	System.debug(LoggingLevel.Error, 'Erorr = '+e.getMessage());
        }
        
        //creation of new badge assignment
        this.newAssignment.SourceId = thanks.Id;
        this.newAssignment.RecipientId = '00536000002UKV1'; //Person choosen from the UserList Picklist
        this.newAssignment.DefinitionId = curRecord.Id;
        
        try
        {
            insert this.newAssignment;
       	} catch(Exception e)
        {
         	System.debug(LoggingLevel.Error, 'Erorr = '+e.getMessage());
        }
        
        system.debug(this.newAssignment.SourceId + ' ' + this.newAssignment.RecipientId + ' ' + this.newAssignment.DefinitionId);
    }
}

and this visualforce page:
<apex:page standardController="WorkBadgeDefinition" extensions="AssignBadgeToUser">
   <h1>Assign Badge to User</h1>
   <br/>
  <apex:form >
      <apex:selectList size="1">
          <b>User: </b><apex:selectOptions value="{!UserList}"></apex:selectOptions>
      </apex:selectList>
      <apex:commandButton action="{!CreateAssignment}" value="Submit" id="submitButton"/>
  </apex:form>
</apex:page>

 The dropdown values are generated from UserList on the apex page and displayed on the visualforce page using a selectlist. I want to be able to take one of these choosen by the user and load that value into the create assignment method on line 46 where it says:
this.newAssignment.RecipientId = '00536000002UKV1'; //Person choosen from the UserList Picklist

I'm stuck here and I feel like this should be really simple. any help would be really appreciated.
I'm trying to write a visualforce page that will display badge information when given a recipient ID number. I need to use a wrapper class otherwise I would need 2 values going into my pageBlockTable values.

Everything on the Apex side seems to be working fine but when I try to access the information from visualforce I get this error "Unknown property 'VisualforceArrayList.GiverId'".

Apex Class:
public with sharing class GetBadges {
    public List<BadgeWrapper> Wrappers { get; set; }
    public class BadgeWrapper 
    {
        public List<WorkBadge> Results {get; set;}
    	public String GID {get; set;}
    	public List<User> Results2 {get; set;}
        public BadgeWrapper(List<WorkBadge> wl, String g, List<User> ul)
        {
            Results = wl;
            GID = g;
            Results2 = ul;
        }
    }
    
    public GetBadges()
    {
        Wrappers = new List<BadgeWrapper>();
        List<WorkBadge> wl = [SELECT GiverId, Message, ImageURL, Description, DefinitionId FROM WorkBadge WHERE RecipientId = '00536000002UKV1'];
        String g = String.valueOf(wl[0]);
        List<User> ul = [SELECT Name FROM User WHERE ID = :g];
        Wrappers.add(new BadgeWrapper(wl,g,ul));
    }
}

Visualforce Page:
<apex:pageBlock title="Badge Certificate">
	<apex:pageBlockTable value="{!Wrappers}" var="row"> 
		<apex:column > 
                          <!--apex:facet name="giverID">Giver's ID</apex:facet--> 
                         <apex:outputText value="{!row.Results.GiverId}"/> 
		</apex:column> 
        </apex:pageBlockTable>
</apex:pageBlock>
I'm not sure why I'm getting this error any help would be really appreciated. Thanks!

 
I'm having trouble with one of the trailhead modules, Lightning Components Basics Input Data Using Forms https://developer.salesforce.com/trailhead/lex_dev_lc_basics/lex_dev_lc_basics_forms

In a previous module I set up the SLDS static resource and now in this module I'm asked to acess it and I'm not getting the custom styling that is supposed to be implimented. I copy-pasted the code exactly as it is shown in the module and only changed the name of the static resource.

expensesApp.app
<aura:application>
 
    <!-- Include the SLDS static resource (adjust to match package version) -->
    <ltng:require styles="{!$Resource.SLDS201 +
         '/assets/styles/salesforce-lightning-design-system-ltng.css'}"/>
 
    <!-- Add the "scoping" element to activate SLDS on components
         that we add inside it. -->
    <div class="slds">
       
        <!-- This component is the real "app" -->
        <c:expenses/>
       
    </div>
    <!-- / SLDS SCOPING DIV -->
 
</aura:application>
expenses.cmp
<aura:component>

    <!-- PAGE HEADER -->
    <div class="slds-page-header" role="banner">
      <div class="slds-grid">
        <div class="slds-col">
          <p class="slds-text-heading--label">Expenses</p>
          <h1 class="slds-text-heading--medium">My Expenses</h1>
        </div>
      </div>
    </div>
    <!-- / PAGE HEADER -->

    <!-- NEW EXPENSE FORM -->
    <div class="slds-col slds-col--padded slds-p-top--large">


        <!-- [[ expense form goes here ]] -->


    </div>
    <!-- / NEW EXPENSE FORM -->

</aura:component>

I've tried uninstalling and re-uploading the resource as well as changing the filepath but I can't seem to figure out how to acces this file.
Any help would be really appreciated.
 
Hey Everyone,

I'm trying to create a login flow that will update a record whenever a person logs in, or create one if it doesn't already exist. I have it working right now so that whenever someone logs in it will create a new record, but I can't figure out a way that I can check to see if a record already exists and then choose to update or create the record based on that. Is their any way this can be done in a login flow? 

Any help would be really appreciated.
Thanks!
I'm trying to write a visualforce page that will display badge information when given a recipient ID number. I need to use a wrapper class otherwise I would need 2 values going into my pageBlockTable values.

Everything on the Apex side seems to be working fine but when I try to access the information from visualforce I get this error "Unknown property 'VisualforceArrayList.GiverId'".

Apex Class:
public with sharing class GetBadges {
    public List<BadgeWrapper> Wrappers { get; set; }
    public class BadgeWrapper 
    {
        public List<WorkBadge> Results {get; set;}
    	public String GID {get; set;}
    	public List<User> Results2 {get; set;}
        public BadgeWrapper(List<WorkBadge> wl, String g, List<User> ul)
        {
            Results = wl;
            GID = g;
            Results2 = ul;
        }
    }
    
    public GetBadges()
    {
        Wrappers = new List<BadgeWrapper>();
        List<WorkBadge> wl = [SELECT GiverId, Message, ImageURL, Description, DefinitionId FROM WorkBadge WHERE RecipientId = '00536000002UKV1'];
        String g = String.valueOf(wl[0]);
        List<User> ul = [SELECT Name FROM User WHERE ID = :g];
        Wrappers.add(new BadgeWrapper(wl,g,ul));
    }
}

Visualforce Page:
<apex:pageBlock title="Badge Certificate">
	<apex:pageBlockTable value="{!Wrappers}" var="row"> 
		<apex:column > 
                          <!--apex:facet name="giverID">Giver's ID</apex:facet--> 
                         <apex:outputText value="{!row.Results.GiverId}"/> 
		</apex:column> 
        </apex:pageBlockTable>
</apex:pageBlock>
I'm not sure why I'm getting this error any help would be really appreciated. Thanks!

 
I'm having trouble with one of the trailhead modules, Lightning Components Basics Input Data Using Forms https://developer.salesforce.com/trailhead/lex_dev_lc_basics/lex_dev_lc_basics_forms

In a previous module I set up the SLDS static resource and now in this module I'm asked to acess it and I'm not getting the custom styling that is supposed to be implimented. I copy-pasted the code exactly as it is shown in the module and only changed the name of the static resource.

expensesApp.app
<aura:application>
 
    <!-- Include the SLDS static resource (adjust to match package version) -->
    <ltng:require styles="{!$Resource.SLDS201 +
         '/assets/styles/salesforce-lightning-design-system-ltng.css'}"/>
 
    <!-- Add the "scoping" element to activate SLDS on components
         that we add inside it. -->
    <div class="slds">
       
        <!-- This component is the real "app" -->
        <c:expenses/>
       
    </div>
    <!-- / SLDS SCOPING DIV -->
 
</aura:application>
expenses.cmp
<aura:component>

    <!-- PAGE HEADER -->
    <div class="slds-page-header" role="banner">
      <div class="slds-grid">
        <div class="slds-col">
          <p class="slds-text-heading--label">Expenses</p>
          <h1 class="slds-text-heading--medium">My Expenses</h1>
        </div>
      </div>
    </div>
    <!-- / PAGE HEADER -->

    <!-- NEW EXPENSE FORM -->
    <div class="slds-col slds-col--padded slds-p-top--large">


        <!-- [[ expense form goes here ]] -->


    </div>
    <!-- / NEW EXPENSE FORM -->

</aura:component>

I've tried uninstalling and re-uploading the resource as well as changing the filepath but I can't seem to figure out how to acces this file.
Any help would be really appreciated.
 
Sales Managers have asked for an at-a-glance solution to see completeness on leads. Create a helper formula field that looks at 5 key fields on the Lead object and evaluates their completeness, then a second formula field that references the helper formula and returns an image.

>The helper formula field should be on the Lead object with a name of 'Lead Quality Helper' and a resulting API name of 'Lead_Quality_Helper__c'.
>The helper formula should be of type Number.
>The helper formula should evaluate the following 5 fields: Email, Phone, Company, Title, and Industry and return 0 if blank and 1 if not blank. >The formula should then add all the values together to return a total value.
>The image formula should be on the Lead object with a name of 'Lead Quality' and a resulting API name of 'Lead_Quality__c'.
>The image formula should reference the helper formula, and return an image based on the number returned by the helper formula. The helper formula should be of type Text. Note: All of these images are already available in your Developer Edition.

1 = /img/samples/stars_100.gif with alternate text '1 star'
2 = /img/samples/stars_200.gif with alternate text '2 stars'
3 = /img/samples/stars_300.gif with alternate text '3 stars'
4 = /img/samples/stars_400.gif with alternate text '4 stars'
5 = /img/samples/stars_500.gif with alternate text '5 stars'

If none of the fields are filled out, the default should be /img/samples/stars_000.gif with alternate text '0 stars'.
The 'Lead Quality' formula must be added to the Lead Layout page layout.

ok so im having trouble on this challenege on trailhead. im confused what it means by helper formula, like how would we create a helper formular? also how would we create a image formula?

thanks if anyone answers