• Bryant Daniels 46
  • NEWBIE
  • 10 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 14
    Questions
  • 7
    Replies
Trying to find out if i can rotate an image once the visualforce page is rendered as a PDF, when it is rendered as HTML the image shows correctly the way you take the image also the css below works with it on HTML but not PDF which is strange because the other style is working for the page when it is in PDF. 
<style type="text/css" media="print">
			@page {
				size: landscape
			}
.imageClass {
				-webkit-transform: rotate(90deg);
				-moz-transform: rotate(90deg);
				-o-transform: rotate(90deg);
				-ms-transform: rotate(90deg);
				transform: rotate(90deg);
				height: 200px;
				width: 200px;
			}

<img src="{!'/sfc/servlet.shepherd/version/download/' + Document_Id__c}" alt="before photo" class="imageClass"


-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
-o-transform: rotate(90deg);
-ms-transform: rotate(90deg);
transform: rotate(90deg);
Has anyone been able to add a Photo to the Service Report Template? I imagine you would be able to do this with a rich-text field on the work order or service appointment object, but was curious if anyone has any different approaches
When implementing the Lightning Web Component Dual Listbox in Salesforce Mobile App and you add a lot of values that would require you to scroll, the scrolling function does not work.

I used the sample code and just put it into a tab for the salesforce moblie app : 
 
<template>
	<lightning-dual-listbox name="languages" label="Select Languages" source-label="Available" selected-label="Selected" field-level-help="Select your preferred languages"
	 options={options} onchange={handleChange}></lightning-dual-listbox>
	<div class="slds-box">
		<p>Selected values are: {selected}</p>
	</div>
</template>


import { LightningElement, track } from 'lwc';

export default class DualListboxSimple extends LightningElement {
    @track _selected = [];

    get options() {
        return [
            { label: 'English', value: 'en' },
            { label: 'German', value: 'de' },
            { label: 'Spanish', value: 'es' },
            { label: 'French', value: 'fr' },
            { label: 'Italian', value: 'it' },
            { label: 'Japanese', value: 'ja' },
        ];
    }

    get selected() {
        return this._selected.length ? this._selected : 'none';
    }

    handleChange(e) {
        this._selected = e.detail.value;
    }
}

 
Looking to use Google Translate within Salesforce Communities, we are currently using the Aura Framework for most of our components but will be transitioning into LWC.  
Hello All,

I have created a community and attached to that community an app using react native. The app is fine, but the problem I am having is promoting the app with the native app browser for Andriod. The Apple one works fine as it is only a meta tag that is put into the community builder. I went to the google dev land and found this article.
https://developers.google.com/web/fundamentals/app-install-banners/native  (https://developers.google.com/web/fundamentals/app-install-banners/native)
I tried to add a lightning container to the component but that didn't work as well, and I am not too familiar with manifest files. Any type of guidance would be great.
Hello I am trying to create a autocomplete using lighting components, The first attempt was to use the lighting:combobox but this doesn't allow me to use the input box such as input of type search. I am able to use some of the documentation from the lighting design system, but I am unable to set the focus to the 1st index of the listitem in my aura:iteration. It would be great to just use the lightning:combox instead of using all of the markup from the lightingdesignsytem. One thing to mention is I don't get the options when the page loads I don't receive any options for the filteredOptions attribute until i type 2 characters into the input
<aura:attribute name="searchTerm" type="String" />
    <aura:attribute name="searchPlaceHolder" type="string" default="" />
    <aura:attribute name="searchLabel" type="string" default="" />
    <aura:attribute name="showLabel" type="boolean" default="false" />
    <aura:attribute name="isAutoComplete" type="boolean" />
    <aura:attribute name="showComboBoxOptions" type="boolean" default="false" />
    <aura:attribute name="setAriaExpanded" type="boolean" default="false" />
    <aura:attribute name="filteredOptions" type="String[]" />
   
   
    <aura:handler name="change" value="{!v.searchTerm}" action="{!c.onChangeSearchText}" />

    <div class="slds-form-element">
        <div class="slds-combobox_container">
            <div class="{!v.showComboBoxOptions ? 'slds-combobox slds-dropdown-trigger slds-dropdown-trigger_click slds-is-open' : 'slds-combobox slds-dropdown-trigger slds-dropdown-trigger_click'}"
                aria-expanded="{!v.setAriaExpanded}" aria-haspopup="listbox" role="combobox">
                <div onkeyup="{!c.onChangeSearchText}">
                    <lightning:input name="search-input" label="{v.searchLabel}" type="search" placeholder="{!v.placeHolder}"
                        aura:id="searchInput" value="{!v.searchTerm}" variant="{!v.showLabel ? '' : 'label-hidden'}"
                        aria-activedescendant="option1" />
                </div>
                <div id="listbox-id-16" class="slds-dropdown slds-dropdown_fluid" role="listbox">
                    <ul class="slds-listbox slds-listbox_vertical" role="presentation">
                        <aura:iteration items="{!v.filteredOptions}" var="option" indexVar="index">
                            <li role="presentation" class="slds-listbox__item" data-value="{!option.value}" data-record="{!option.label}">
                                <div aria-selected="true" id="option1" class="slds-media slds-listbox__option slds-listbox__option_entity slds-listbox__option_term "
                                    role="option">
                                    <span class="slds-media__body">
                                        <span class="slds-listbox__option-text slds-listbox__option-text_entity">{!option.label}</span>
                                    </span>
                                </div>
                            </li>
                        </aura:iteration>
                    </ul>
                </div>
            </div>
        </div>
    </div>
Was wondering if anyone has had success with creating a record using lighting data service that will bring in the picklist values for a field using lightning select and just binding the value to a aura iteration. Or do i still need to Schema.DescribeSObjectResult etc.. to retrieve the values from the server.  
Hello All,

I am currently having issues with allowing visitors to self-register in a lightning community portal. I have enabled "Person Accounts". Within in the site builder, I have the community configured to allow for self-registration and the profile is setup to the "Customer Community User Login" Profile. When I try to register I am receiving a error, "The error message is: portal account owner must have a role". I understand if I didn't have "Person Account" this would be fine because I can set that account with a user that has a role. The "Guest User" default for accounts is set to the "Person Account" record type, it is the only record type for that profile and it is the default RT. All of the files I am using are the ones that are created automatically when you create a custom community.  
Apex Controller:
global class LightningSelfRegisterController {

    public LightningSelfRegisterController() {

    }

    @TestVisible 
    private static boolean isValidPassword(String password, String confirmPassword) {
        return password == confirmPassword;
    }
    
    @TestVisible 
    private static boolean siteAsContainerEnabled(String communityUrl) {
        Auth.AuthConfiguration authConfig = new Auth.AuthConfiguration(communityUrl,'');
        return authConfig.isCommunityUsingSiteAsContainer();
    }
    
    @TestVisible 
    private static void validatePassword(User u, String password, String confirmPassword) {
        if(!Test.isRunningTest()) {
        Site.validatePassword(u, password, confirmPassword);
        }
        return;
    }
    
    @AuraEnabled
    public static String selfRegister(String firstname ,String lastname, String email, String password, String confirmPassword, String accountId, String regConfirmUrl, String extraFields, String startUrl, Boolean includePassword) {
        Savepoint sp = null;
        try {
            sp = Database.setSavepoint();
            
            if (lastname == null || String.isEmpty(lastname)) {
                return Label.Site.lastname_is_required;
            }
            
            if (email == null || String.isEmpty(email)) {
                return Label.Site.email_is_required;
            }
            
            User u = new User();
            u.Username = email;
            u.put('Email',email);
            
            u.FirstName = firstname;
            u.LastName = lastname;
            
            String networkId = Network.getNetworkId();

            // If using site to host the community the user should not hit s1 after logging in from mobile.
            if(networkId != null && siteAsContainerEnabled(Network.getLoginUrl(networkId))) {
                u.put('UserPreferencesHideS1BrowserUI',true);
            }
            
            String nickname = ((firstname != null && firstname.length() > 0) ? firstname.substring(0,1) : '' ) + lastname.substring(0,1);
            nickname += String.valueOf(Crypto.getRandomInteger()).substring(1,7);
            u.put('CommunityNickname', nickname);
                     
            if (extraFields != null) {
                List<Object> extraFieldsList = (List<Object>) JSON.deserializeUntyped(extraFields);        
                for (Object thisFieldObject : extraFieldsList) {
                    Map<String,Object> thisField = (Map<String,Object>) thisFieldObject;
                    Schema.SObjectField sof = Schema.SObjectType.User.fields.getMap().get((String) thisField.get('fieldPath'));
                    u.put(sof, thisField.get('value'));
                }
            }
                        
            if (includePassword) {    
                if (!isValidPassword(password, confirmPassword)) {
                    return Label.site.passwords_dont_match;
                }
             validatePassword(u, password, confirmPassword);
            }
            else {
                password = null;
            }
            
            // lastName is a required field on user, but if it isn't specified, we'll default it to the username
            String userId = Site.createExternalUser(u, accountId, password);
            // create a fake userId for test.
            if (Test.isRunningTest()) {
                userId = 'fakeUserId';           
            }
            if (userId != null) { 
                if (password != null && password.length() > 1) {
                    ApexPages.PageReference lgn = Site.login(email, password, startUrl);
                    if(!Test.isRunningTest()) {
                     aura.redirect(lgn);
                    }
                }
                else {
                    ApexPages.PageReference confirmRef = new PageReference(regConfirmUrl);
                    if(!Test.isRunningTest()) {
                    aura.redirect(confirmRef);
                   }

                }
            }
            return null;
        }
        catch (Exception ex) {
            Database.rollback(sp);
            return ex.getMessage();            
        }
    }
    
    @AuraEnabled
    public static List<Map<String,Object>> getExtraFields(String extraFieldsFieldSet) { 
        List<Map<String,Object>> extraFields = new List<Map<String,Object>>();
        Schema.FieldSet fieldSet = Schema.SObjectType.User.fieldSets.getMap().get(extraFieldsFieldSet);
        if(!Test.isRunningTest()) {
        if (fieldSet != null) {
            for (Schema.FieldSetMember f : fieldSet.getFields()) {
                Map<String, Object> fieldDetail = new Map<String, Object>();
                fieldDetail.put('dbRequired', f.getDBRequired());
                fieldDetail.put('fieldPath', f.getFieldPath());
                fieldDetail.put('label', f.getLabel());
                fieldDetail.put('required', f.getRequired());
                fieldDetail.put('type', f.getType());
                fieldDetail.put('value', '');   // client will populate
                extraFields.add(fieldDetail);
            }}}
        return extraFields;
    }
    
    @AuraEnabled
    global static String setExperienceId(String expId) {
        // Return null if there is no error, else it will return the error message 
        try {
            if (expId != null) {
                Site.setExperienceId(expId);   
            }
            return null; 
        } catch (Exception ex) {
            return ex.getMessage();            
        }        
    }  
}

Lighting Cmp:
<!-- add implements="forceCommunity:availableForAllPageTypes" to surface the component in community builder -->
<aura:component controller="LightningSelfRegisterController" implements="forceCommunity:availableForAllPageTypes" access="global">
    <aura:attribute name="accountId" type="String" required="false" description="accountId for creating the user. If not specified, it will create a PersonAccount if possible for B2C scenario. Or otherwise if it's in a community, the community's self-registration accountId will be used."/>
    <aura:attribute name="regConfirmUrl" type="String" required="true"/>
    <aura:attribute name="startUrl" type="String" required="false" description="The url you go to after a successful login" />
    <aura:attribute name="showError" type="Boolean" required="true" description="" default="false" access="private"/>
    <aura:attribute name="errorMessage" type="String" required="false" description="" access="private"/>
    <aura:attribute name="firstnameLabel" type="String" required="false" default="First Name"/>
    <aura:attribute name="lastnameLabel" type="String" required="false" default="Last Name"/>
    <aura:attribute name="emailLabel" type="String" required="false" default="Email"/>
    <aura:attribute name="passwordLabel" type="String" required="false" default="Create Password"/>
    <aura:attribute name="confirmPasswordLabel" type="String" required="false" default="Confirm Password"/>    
    <aura:attribute name="submitButtonLabel" type="String" required="false" default="Sign Up"/>
    <aura:attribute name="includePasswordField" type="Boolean" required="false" default="false" description="Whether to include password"/>    
    <aura:attribute name="extraFieldsFieldSet" type="String" required="false" description="A field set name whose fields are desired for user registration"/>
    <aura:attribute name="extraFields" type="list" required="false" description="A field set name whose fields are desired for user registration"/>
    <aura:handler name="init" value="{!this}" action="{!c.initialize}"/>
    <aura:attribute name="expid" type="String" required="false" description="The branding experience ID" />    
    
    <aura:registerevent name="sitePropagatedStartUrl" type="c:setStartUrl"/>
    <aura:handler name="init" value="{!this}" action="{!c.initialize}"/>
    <aura:dependency resource="c:setStartUrl" type="EVENT"/>
    
    <aura:dependency resource="siteforce:registerQueryEventMap" type="EVENT"/>
   
    <aura:handler event="c:setStartUrl" action="{!c.setStartUrl}"/> 
    <aura:handler event="c:setExpId" action="{!c.setExpId}"/>    
    <aura:dependency resource="c:setExpId" type="EVENT"/>   
    <ltng:require styles="{!$Resource.FontAwesomeWeb + '/fontawesome-web/css/all.css'}" />

   
    <div class="floating-container">
            <div class="register-container">
                <lightning:layoutItem padding="around-small" size="12" class="slds-align_absolute-center">
                    <div class="page-section page-header">
                        <img src="{!$Resource.starShadowOnly}" width="40" alt="city of chicago 311" />
                        <h1>Want to join us?</h1>
                        <p>Register a new account. Track all your requests </p>
                    </div>
                </lightning:layoutItem>
                <lightning:layoutItem size="12">
                <div id="sfdc_username_container" class="sfdc">
                    <!-- <span id="sfdc_user" class="login-icon" data-icon="a"></span> -->
                    <ui:inputText value="" aura:id="firstname" placeholder="{!v.firstnameLabel}" keyup="{!c.onKeyUp}" class="input sfdc_usernameinput sfdc"/>
                </div>
                </lightning:layoutItem>
                <lightning:layoutItem size="12">
                <div id="sfdc_nickname_container" class="sfdc">
                    <!-- <span id="sfdc_user" class="login-icon" data-icon="a"></span> -->
                    <ui:inputText value="" aura:id="lastname" placeholder="{!v.lastnameLabel}" keyup="{!c.onKeyUp}" class="input sfdc_usernameinput sfdc"/>
                </div>
                </lightning:layoutItem>
                <lightning:layoutItem size="12">
                <div id="sfdc_email_container" class="sfdc">
                    <!-- <span id="sfdc_user" class="login-icon" data-icon="k"></span> -->
                    <ui:inputText value="" aura:id="email" placeholder="{!v.emailLabel}" keyup="{!c.onKeyUp}" class="input sfdc_usernameinput sfdc"/>
                </div>
                </lightning:layoutItem>
                <aura:iteration aura:id="extraFields" items="{!v.extraFields}" var="curField" indexVar="index">
                    <div id="sfdc_extrafield_container" class="sfdc">
                        <!-- <span id="sfdc_user" class="login-icon" data-icon="a"></span> -->
                        <ui:inputText value="{!curField.value}" aura:id="{!curField.fieldPath}" placeholder="{!curField.label}" keyup="{!c.onKeyUp}" class="input sfdc_extrafieldinput sfdc"/>
                    </div>
                </aura:iteration>

                <aura:renderIf isTrue="{!v.includePasswordField}">
                    <div id="sfdc_password_container" class="sfdc">
                        <!-- <span id="sfdc_lock" class="login-icon sfdc" data-icon="c"></span> -->
                        <ui:inputSecret value="" aura:id="password" placeholder="{!v.passwordLabel}" keyup="{!c.onKeyUp}" class="input sfdc_passwordinput sfdc"/>
                    </div>
        
                    <div id="sfdc_confirm_password_container" class="sfdc">
                        <!-- <span id="sfdc_lock" class="login-icon sfdc" data-icon="c"></span> -->
                        <ui:inputSecret value="" aura:id="confirmPassword" placeholder="{!v.confirmPasswordLabel}" keyup="{!c.onKeyUp}" class="input sfdc_passwordinput sfdc"/>
                    </div>
                </aura:renderIf>
                <aura:renderIf isTrue="{!v.showError}">
                    <div id="error">
                        <ui:outputRichText value="{!v.errorMessage}"/>
                    </div>
                </aura:renderIf>

                <div class="sfdc">
                    <!-- <ui:button aura:id="submitButton" label="{!v.submitButtonLabel}" press="{!c.handleSelfRegister}" class="sfdc_button"/> -->
                    <lightning:button variant="brand" label="{!v.submitButtonLabel}" onclick="{!c.handleSelfRegister}" class="sfdc_button" />
                </div>
            </div>
    </div>
</aura:component>

Cmp Controller:
({
    initialize: function(component, event, helper) {
        $A.get("e.siteforce:registerQueryEventMap").setParams({"qsToEvent" : helper.qsToEventMap}).fire();
        $A.get("e.siteforce:registerQueryEventMap").setParams({"qsToEvent" : helper.qsToEventMap2}).fire();        
        component.set('v.extraFields', helper.getExtraFields(component, event, helper));
    },
    
    handleSelfRegister: function (component, event, helpler) {
        helpler.handleSelfRegister(component, event, helpler);
    },
    
    setStartUrl: function (component, event, helpler) {
        var startUrl = event.getParam('startURL');
        if(startUrl) {
            component.set("v.startUrl", startUrl);
        }
    },
    
    setExpId: function (component, event, helper) {
        var expId = event.getParam('expid');
        if (expId) {
            component.set("v.expid", expId);
        }
        helper.setBrandingCookie(component, event, helper);
    },
    
    onKeyUp: function(component, event, helpler){
        //checks for "enter" key
        if (event.getParam('keyCode')===13) {
            helpler.handleSelfRegister(component, event, helpler);
        }
    }   
})

Cmp Helper:
({
    qsToEventMap: {
        'startURL'  : 'e.c:setStartUrl'
    },
    
    qsToEventMap2: {
        'expid'  : 'e.c:setExpId'
    },
    
    handleSelfRegister: function (component, event, helpler) {
        var accountId = component.get("v.accountId");
        var regConfirmUrl = component.get("v.regConfirmUrl");
        var firstname = component.find("firstname").get("v.value");
        var lastname = component.find("lastname").get("v.value");
        var email = component.find("email").get("v.value");
        var includePassword = component.get("v.includePasswordField");
        var password = component.find("password").get("v.value");
        var confirmPassword = component.find("confirmPassword").get("v.value");
        var action = component.get("c.selfRegister");
        var extraFields = JSON.stringify(component.get("v.extraFields"));   // somehow apex controllers refuse to deal with list of maps
        var startUrl = component.get("v.startUrl");
        
        startUrl = decodeURIComponent(startUrl);
        
        action.setParams({firstname:firstname,lastname:lastname,email:email,
                password:password, confirmPassword:confirmPassword, accountId:accountId, regConfirmUrl:regConfirmUrl, extraFields:extraFields, startUrl:startUrl, includePassword:includePassword});
          action.setCallback(this, function(a){
          var rtnValue = a.getReturnValue();
          if (rtnValue !== null) {
             component.set("v.errorMessage",rtnValue);
             component.set("v.showError",true);
          }
       });
    $A.enqueueAction(action);
    },
    
    getExtraFields : function (component, event, helpler) {
        var action = component.get("c.getExtraFields");
        action.setParam("extraFieldsFieldSet", component.get("v.extraFieldsFieldSet"));
        action.setCallback(this, function(a){
        var rtnValue = a.getReturnValue();
            if (rtnValue !== null) {
                component.set('v.extraFields',rtnValue);
            }
        });
        $A.enqueueAction(action);
    },

    setBrandingCookie: function (component, event, helpler) {        
        var expId = component.get("v.expid");
        if (expId) {
            var action = component.get("c.setExperienceId");
            action.setParams({expId:expId});
            action.setCallback(this, function(a){ });
            $A.enqueueAction(action);
        }
    }    
})

 
Look for help to deploy Service Report Template via ant and metadata, it's not on the unsupported list of metadata
Hello I am using the Search input from the lightning input components.
<div onkeyup="{! c.handleKeyUp }"> <lightning:input aura:id="enter-search" name="enter-search" label="Search when user hits the 'enter' key" type="search" />

When I am implementing it this is fine, the problem i am having is how would i clear the contents or have a event fire when you click the "Clear Icon" that is built in the component. 
 
Has anyone created a question and answer bank sort of like creating a form. 
Was wondering if anyone is have a problem displaying the map from leaflet onto a lighting component record page. Following the Accounts near me trailhead. In the trailhead you can see the map in the App which is fine. But i am not able to show it in a lighting component.
Hello I was trying to figure out how i can set the value on a Apex Param 
here is my visualforce:

<button onclick="done();" class="btn btn right" type="button" id="doneButton" style="border: none; background: none; width: 100px; background-color: #dcdcdc; color: #ffffff;">Done</button>
                     <apex:actionFunction action="{!done}" name="SetHiddenValue" reRender="">
                        <apex:param name="brandCode" value="" assignto="{!iaFet.Brand_CD__c}" id="brandCode" />
                    </apex:actionFunction>
and my java script where i get the values that i need:
function getRequiredValues(){
                var brandCodeVal  = $('#brandDropdown option:selected').val();                            
                console.log(brandCodeVal);
               
            }
when i run this i get the value that i want in the console.log but i am trying to figure out how i can pass that value to the apex: param value so then i can assign it to something in my controller and save the record with the value. 
Hello all I am looking for some help or to know if this is even possible, I have a standard picklist on a custom object type_co__c this field is populated with codes like, "IA, PA", What I am trying to recieve is to create a visual force page but instead of displaying IA i want to display "In Area" and "Past Area", but the values in the picklist should stay the same because i would like to use data loader to upsert to this field still using the IA and PA values. 
Trying to find out if i can rotate an image once the visualforce page is rendered as a PDF, when it is rendered as HTML the image shows correctly the way you take the image also the css below works with it on HTML but not PDF which is strange because the other style is working for the page when it is in PDF. 
<style type="text/css" media="print">
			@page {
				size: landscape
			}
.imageClass {
				-webkit-transform: rotate(90deg);
				-moz-transform: rotate(90deg);
				-o-transform: rotate(90deg);
				-ms-transform: rotate(90deg);
				transform: rotate(90deg);
				height: 200px;
				width: 200px;
			}

<img src="{!'/sfc/servlet.shepherd/version/download/' + Document_Id__c}" alt="before photo" class="imageClass"


-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
-o-transform: rotate(90deg);
-ms-transform: rotate(90deg);
transform: rotate(90deg);
We are trying to configure a survey, and have it attached to either at the Case Level or Care Request Level in HC.  

Any thoughts?

Thanks,

Kevin
Hello I am using the Search input from the lightning input components.
<div onkeyup="{! c.handleKeyUp }"> <lightning:input aura:id="enter-search" name="enter-search" label="Search when user hits the 'enter' key" type="search" />

When I am implementing it this is fine, the problem i am having is how would i clear the contents or have a event fire when you click the "Clear Icon" that is built in the component. 
 
Has anyone created a question and answer bank sort of like creating a form. 
Was wondering if anyone is have a problem displaying the map from leaflet onto a lighting component record page. Following the Accounts near me trailhead. In the trailhead you can see the map in the App which is fine. But i am not able to show it in a lighting component.
Hello I was trying to figure out how i can set the value on a Apex Param 
here is my visualforce:

<button onclick="done();" class="btn btn right" type="button" id="doneButton" style="border: none; background: none; width: 100px; background-color: #dcdcdc; color: #ffffff;">Done</button>
                     <apex:actionFunction action="{!done}" name="SetHiddenValue" reRender="">
                        <apex:param name="brandCode" value="" assignto="{!iaFet.Brand_CD__c}" id="brandCode" />
                    </apex:actionFunction>
and my java script where i get the values that i need:
function getRequiredValues(){
                var brandCodeVal  = $('#brandDropdown option:selected').val();                            
                console.log(brandCodeVal);
               
            }
when i run this i get the value that i want in the console.log but i am trying to figure out how i can pass that value to the apex: param value so then i can assign it to something in my controller and save the record with the value.