• Akhilesh Reddy Baddigam
  • NEWBIE
  • 305 Points
  • Member since 2015

  • Chatter
    Feed
  • 11
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 47
    Replies
I am having an issue centering the section header in  VF page.  Its more like off center towards the left side of the VF page.
User-added image

Here is the VF page.  The command buttons centered well but the title is not.  Any suggestions is greatly appreciated.
<div style="background-color:green;height:500px;width:802px;">
        <apex:form id="Merchandising" >
           <div align="center" >
            <apex:sectionHeader title="Choose Merchandising"/>
            </div>;
                <apex:pageBlock title="">
                    <apex:pageBlockSection columns="2">             
                    <apex:inputField value="{!merch.Merchandise__c}" required="true"/>
                    <apex:inputField value="{!merch.Date_Displayed__c}"/>
                    <apex:inputField value="{!merch.Merchandise_Category__c}" required="true"/>
                    <apex:outputfield value="{!merch.Date_Delivered__c}"  html-disabled="true" />
                    <apex:inputField value="{!merch.Merchandise_SubCategory__c}" required="true"/>                
                    <apex:inputField value="{!merch.Date_Removed_Replaced__c}"/>
                </apex:pageBlockSection>
            
                <Br></Br><Br></Br><Br></Br>            
                <div align="center" draggable="false" >
            
                <apex:commandButton action="{!save}" value="Save" id="saveButton" reRender="Panel" />        
                &nbsp;&nbsp;&nbsp;&nbsp;
                <apex:commandButton value="Cancel" onclick="window.close();" immediate="true"/>

 
I craeted custom button on  participant table and link Vf pageto the button . when i clicked on the button , address table will get updated 
This is my controller extension  and Vf page .i need help on the test calss 
public with sharing class PClass{

    public participant__c participant;
    private ApexPages.StandardController stdControler;
    public Id Id { get; set; }
    
    
    public PClass(ApexPages.StandardController stdControler){
        
        this.participant = (participant__c)stdControler.getRecord();
        this.stdControler = stdControler;
            
    }
    
    public PageReference InsertAddress(){
        	
        try{
            participant__c p = [select id, SS_ID__c 
                                from participant__c
                               where Id = :participant.Id limit 1];
                             
           Registration__c r= [select Id,Address1__c, Address2__c,SS_ID__c 
                                                                        from Registration__c 
                                                                        where SS_ID__c =:p.SS_ID__c limit 1];
                                                                        
            Addresses_c  paddress = new Addresses__c();
            paddress.participant__c = participant.Id;
            paddress.Address1__c = r.Address1__c;
            paddress.Address2__c = r.Address2__c;
            insert paddress;
	   }

	   catch (Exception e){}
           return new ApexPages.StandardController(participant).view();
}
VF page 
<apex:page standardController="Participant__c" extensions="PClass" action="{!InsertAddress}" >


</apex:page>
My test class
@isTest public  with sharing class PClass_Test {

    static TestMethod void AddAddress(){
        
        
        Registration__c  TestRegistration= new Registration__c();
        TestRegistration.Name = 'Test Registration';
        TestRegistration.SS_ID__c = Decimal.valueOf(30111);
        TestRegistration.Address1__c='10 Street';
        TestRegistration.Address2__c ='15 street';
        insert TestRegistration;
        
        participant__c TestParticipant = new participant__c();
        TestParticipant.FirstName__c ='Test participant';
        TestParticipant.SS_ID__c =Decimal.valueOf(30111);;
        insert TestParticipant;
        
	Test.startTest();
        ApexPages.StandardController stdController = new ApexPages.StandardController(TestParticipant);
        PClass  pa = new PClass(stdController);
       System.debug(pa.Id);
      
        
       	pa.InsertAddress();
        System.debug(pa);
        
        Test.stopTest();
        try{
        
     		Addresses_c padd = [select id, participant__c from Addresses_c where participant__c =:pa.Id limit 1];
           }
      catch (Exception e){}
}


 
  • August 15, 2017
  • Like
  • 0
I am trying to push a managed extension package to a scratch org but am running into some issues. The issues seem to be stemed around some custom objects that are owned by the package that is being extended. I have added the "extension" fields and can see that the objects are being added to the extension package but it is still erroring. I have attatched the errors below.
 
force-app/main/default/objects/inscor__Allocation__c.object-meta.xml                      Must specify a non-empty label for the CustomObject
N/A                                                                                       Field Employee__r does not exist. Check spelling. (88:13)
N/A                                                                                       referenceTo value of 'inscor__Company_Location__c' does not resolve to a valid sObject type (66:13)
N/A                                                                                       referenceTo value of 'inscor__Part_Master__c' does not resolve to a valid sObject type (138:13)
force-app/main/default/objects/inscor__Employee__c.object-meta.xml                        Must specify a non-empty label for the CustomObject
N/A                                                                                       referenceTo value of 'inscor__Employee__c' does not resolve to a valid sObject type (66:13)
N/A                                                                                       referenceTo value of 'inscor__Employee__c' does not resolve to a valid sObject type (66:13)
N/A                                                                                       referenceTo value of 'inscor__Inventory_Line__c' does not resolve to a valid sObject type (66:13)
N/A                                                                                       referenceTo value of 'inscor__Employee__c' does not resolve to a valid sObject type (66:13)
force-app/main/default/layouts/Work_Order__c-Work Order Layout.layout-meta.xml            In field: field - no CustomField named Work_Order__c.Company_Location__c found (18:26)
force-app/main/default/layouts/Labor_Entry__c-Labor Entry Layout.layout-meta.xml          In field: field - no CustomField named Labor_Entry__c.Employee__c found (20:26)
force-app/main/default/layouts/Tool_Assignment__c-Tool Assignment Layout.layout-meta.xml  In field: field - no CustomField named Tool_Assignment__c.Employee__c found (28:26)
force-app/main/default/layouts/Work_Order_Task__c-Work Order Task Layout.layout-meta.xml  In field: field - no CustomField named Work_Order_Task__c.Assigned_To__c found (55:26)
force-app/main/default/applications/AvSight_Work_Order.app-meta.xml                       In field: tab - no CustomTab named Administration found

 
I am following examples from Lightning COmponent developer guide, but looks like all style and design are missing there? When I am trying simple examples these all show very odd? Any suggestion what needs to be followed?

for example If I follow these examples,
it shows everything looks in very bad UI most of thing don't render as expected.
User-added image
for example I am just using below code :
<aura:component >
    <aura:attribute name="myTitle" type="String" default="My Card Title"/>
    BreadCrumb:
    <lightning:breadcrumbs >
        <lightning:breadcrumb label="Parent Account" href="https://vyaslirik-dev-ed.lightning.force.com/one/one.app#/sObject/5007F000001hWVgQAM/view"/>
        <lightning:breadcrumb label="Case" href="https://vyaslirik-dev-ed.lightning.force.com/one/one.app#/sObject/5007F000001hWVgQAM/view"/>
    </lightning:breadcrumbs>
	<lightning:icon iconName="utility:error" variant="error"/>
   Avatar : <lightning:avatar src="{!$Resource.Images + '/Images/lightning.png'}" initials="Sa" 
      fallbackIconName="standard:account" alternativeText="Salesforce"/>    
	<lightning:pill label="hello pill" onremove="{! c.handleRemoveOnly }" onclick="{! c.handleClick }">
    	<aura:set attribute="media">
            <lightning:icon iconName="standard:account"  alternativeText="Account"/>
        </aura:set>
    </lightning:pill>
3
    <lightning:card title="{!v.myTitle}" footer="Card Footer">
        <aura:set attribute="actions">
            <lightning:button label="New"/>
        </aura:set>
        <p class="slds-p-horizontal--small">
            Card Body (custom component)
        </p>
    </lightning:card>
    
    <div class="c-container">
        <lightning:layout horizontalAlign="end" verticalAlign="center">
            <lightning:layoutItem flexibility="auto" padding="around-small">
               <lightning:formattedNumber value="12.34" style="currency" 
                     currencyCode="EUR" currencyDisplayAs="symbol"/>
            </lightning:layoutItem>
            <lightning:layoutItem flexibility="auto" padding="around-small">
                <lightning:input type="number" name="percentVal" label="Enter a percentage value" formatter="percent" step="0.01" />
            </lightning:layoutItem>
            <lightning:layoutItem flexibility="auto" padding="around-small">
                <lightning:input type="number" name="currencyVal" label="Enter a dollar amount" formatter="currency" step="0.01" />
            </lightning:layoutItem>
            <lightning:layoutItem flexibility="auto" padding="around-small">
                4
            </lightning:layoutItem>
        </lightning:layout>
    </div>

	<lightning:button label="Toggle" variant="brand" onclick="{!c.toggle}"/>
    <div class="exampleHolder">
        <lightning:spinner aura:id="mySpinner" />
    </div>
     <form>
      <fieldset>
        <legend>Select your favorite color:</legend>
        <lightning:input type="checkbox" label="Red" 
            name="color1" value="1" aura:id="colors"/>
        <lightning:input type="checkbox" label="Blue" 
            name="color2" value="2" aura:id="colors"/>
        <lightning:input type="checkbox" label="Green" 
            name="color3" value="3" aura:id="colors"/>
      </fieldset>
    <lightning:tabset>
      <lightning:tab onactive="{! c.handleActive }" label="Tab 1" id="tab1" />
      <lightning:tab onactive="{! c.handleActive }" label="Tab 2" id="tab2" />
    </lightning:tabset>
    </form>
</aura:component>
Hello!,

I was wondering if anyone has any experience with this, or if anyone knows if this is even possible?

We get an excel document automatically created on our local server every day with information we have pulled via another API (That we can't intergrate directly with Salesforce).

What we want to do, is every day at X Time take the excel sheet, and upload it to salesforce using a mapping into a custom object.
 
Has anyone encounted a need to upload a CSV automatically like this? Would love to hear some potental ideas as well.
I have written an apex trigger and it is trowing me an error at line 13 col 17 stating "Error: Compile Error: unexpected token: '=' at line 13 column 17". Can someone help me resolve the error.

trigger Update_TrackingId_MSRLineItem_to_ReplacementPart on MSR_Line_Item__c (after update) 
{
 Map<Id, Replacement_Part__c> replacement  = new Map<Id, Replacement_Part__c>();
    List<Id> listIds = new List<Id>();
    
    for(MSR_Line_Item__c msr : Trigger.new)
    {
        if(msr.Tracking_ID__c != null && msr.MSR_PS_ID__c != null && msr.Replacement_Part__c != null)
        {
        listIds.add(msr.Replacement_Part__c);        
        }        
    }
    replacement = new Map<Id, Replacement_Part__c>([SELECT Id, Tracking_Id__c, MSR_PS_ID__c (SELECT Id, Tracking_Id__c, MSR_PS_ID__c FROM MSR_Line_Items__r) FROM Replacement_Part__c WHERE ID IN:listIds]);
    
    for(MSR_Line_Item__c newmsr : Trigger.new)
    {
        
        Replacement_Part__c rpart = new Replacement_Part__c();
        if(newmsr.Replacement_Part__c != null)
        {
            if(replacement.get(newmsr.Replacement_Part__c) != null)
            rpart = replacement.get(newmsr.Replacement_Part__c);
        }
        if(newmsr.Tracking_ID__c != null && newmsr.MSR_PS_ID__c != null)
        {
            rpart.Tracking_ID__c = newmsr.Tracking_ID__c;
            rpart.MSR_PS_ID__c = newmsr.MSR_PS_ID__c;
        }
        
    }
    update replacement.values();
}

Thanks in advance
Hi everyone, so I'm having trouble making my extension class for my VF page be able to interact with custom fields that I need. When the picklists in my VF page get selected Yes/No it triggers a method in the extension class to check a checkbox Checked for Yes, Not Checked for No. But as of right now when I run my VF page and try to select Yes/No it gives me the error "Attempt to de-reference a null object. Error is in expression '{!setDataIntegrity}' in page escalation_question_page: Class.EscalationPageExtension.setDataIntegrity: line 31, column 1". So there is clearly something wrong when trying to check the checkbox.

Any help would be absolueltly fantastic and greatly appreciated. If you would also be able to give me an exmaple of how my Test Class for the extension would look I would really appreciate it. Im horrible with test classes and have no idea how it would look. Thanks again!

Extension:
/***************************************************************
 * Used for the Visualforce page Escalation Question Page
 * Created by Isaac Gomolka
 * 7/13/2017
 * ************************************************************/

public with sharing class EscalationPageExtension { 
    
    public String picklist1{get;set;}
    public String picklist2{get;set;}
    public String picklist3{get;set;}
    private Case cases;
   
    private ApexPages.StandardController ctrl;
    public EscalationPageExtension(ApexPages.StandardController controller)
    {
        ctrl = controller; 
        this.ctrl = ctrl;   
    }
    
    public List<SelectOption> options { get; private set; }
    {
    options = new List<SelectOption>();
    options.add(new SelectOption('', '-Select-')); // ==> option null
    options.add(new SelectOption('false', 'No'));
    options.add(new SelectOption('true', 'Yes'));
    }
    
    public void setDataIntegrity()
    {
        this.cases.Escalation_Data_Integrity__c = Boolean.valueof(picklist1); 
    }
    
    public void setViableWorkaround()
    {
        this.cases.Escalation_Viable_Workaround__c = Boolean.valueof(picklist2);
    }
    
    public void setAppFunction()
    {
        this.cases.Escalation_Application_Functionality__c = Boolean.valueof(picklist3);
    }
}

VF Page
<apex:page standardController="Case" extensions="EscalationPageExtension"><!-- We should keep sidebars and headers to give them a way out -->
    <apex:pageBlock title="{!$User.FirstName}, Answer Questions to Escalate Case.">
    
    <apex:form id="formID">
      
      <h1>How many users are affected?</h1>
      <apex:inputField value="{! Case.Escalation_Users_Affected__c }" required="true"/>
    
      <br/>
      <h1>Does this affect data integrity?</h1>
      <apex:actionRegion >
          <apex:outputPanel styleClass="requiredInput" layout="block">
          <apex:outputPanel styleClass="requiredBlock" layout="block"/>
          <apex:selectList value="{!picklist1}" size="1" required="true">
          <apex:actionSupport event="onchange" rerender="hidepanel1" action="{!setDataIntegrity}"/>
          <apex:selectOptions value="{!options}" />
          </apex:selectList>
          </apex:outputPanel>
      </apex:actionRegion>
      <br/>
      <apex:outputPanel id="hidepanel1">
      <apex:outputText value="How?" style="display:{!if(picklist1=='true', 'block', 'none')}"/>
      <apex:inputField value="{!Case.Escalation_Data_Integrity_Explain__c}" required="{!picklist1}" style="display:{!if(picklist1=='true', 'block; width:250px; height:75px;', 'none')}"/>
      <!-- <apex:inputCheckbox value="{!Case.Escalation_Data_Integrity__c}" selected="true" style="display:none;" rendered="{!picklist1}"/> -->
      </apex:outputPanel>
      
      <br/> <br/>
      <h1>Do you have a viable workaround?</h1>
      <apex:actionRegion >
          <apex:outputPanel styleClass="requiredInput" layout="block">
          <apex:outputPanel styleClass="requiredBlock" layout="block"/>
          <apex:selectList value="{!picklist2}" size="1" required="true">
          <apex:actionSupport event="onchange" rerender="hidepanel2" action="{!setViableWorkaround}"/>
          <apex:selectOptions value="{!options}" />
          </apex:selectList>
          </apex:outputPanel>
      </apex:actionRegion>
      <br/>
      <apex:outputPanel id="hidepanel2">
      <apex:outputText value="What is the viable workround?" style="display:{!if(picklist2=='true', 'block','none')}"/>
      <apex:inputField value="{!Case.Escalation_Viable_Workaround_Explain__c}" required="{!picklist2}" style="display:{!if(picklist2=='true', 'block; width:250px; height:75px;', 'none')}" />
      <!-- <apex:inputCheckbox value="{!Case.Escalation_Viable_Workaround__c}" selected="true" style="display:none;" rendered="{!picklist2}"/> -->
      </apex:outputPanel>
    
      <br/> <br/>
      <h1>Does this affect critical application functionality?</h1>
      <apex:actionRegion >
          <apex:outputPanel styleClass="requiredInput" layout="block">
          <apex:outputPanel styleClass="requiredBlock" layout="block"/>
          <apex:selectList value="{!picklist3}" size="1" required="true">
          <apex:actionSupport event="onchange" rerender="hidepanel3" action="{!setAppFunction}"/>
          <apex:selectOptions value="{!options}" />
          </apex:selectList>
          </apex:outputPanel>
      </apex:actionRegion>
      <br/>
      <apex:outputPanel id="hidepanel3">
      <apex:outputText value="How?" style="display:{!if(picklist3=='true', 'block','none')}"/>
      <apex:inputField value="{!Case.Escalation_App_Functionality_Explain__c}" required="{!picklist3}" style="display:{!if(picklist3=='true', 'block; width:250px; height:75px;', 'none')}" />
      <!-- <apex:inputCheckbox value="{!Case.Escalation_Application_Functionality__c}" selected="true" style="display:none;" rendered="{!picklist3}"/> -->
      </apex:outputPanel>
      
      <br/> <br/>
      <h1>What business functionality are you unable to perform?</h1>
      <br/>
      <apex:inputField value="{! Case.Escalation_Business_Functionality__c }"  style="width: 300px; height: 100px" required="true"/>
      
      <br/> <br/> <br/>
      <apex:inputCheckbox value="{!Case.IsEscalated}" selected="true" style="display:none;"/>
      <apex:commandButton action="{!save}" value="Submit" />
      
    </apex:form>  
    </apex:pageBlock>   
</apex:page>

Thanks again in advanced for the help!​
Hello,
Please help me code and solve the below issues in lightning component and its js.
1.either or selection on 2 checkboxes
2.hide/show a div on uncheck/check of checkbox
Thanks.
 
Hello All,
I have an issue trying to figure out the Test classes for this code.  I know I need a test class for this controller and a Mock Call Out class but I have been gettign continous errors in my test classes.  Any help would be appreciated.

Regards,
M.


public with sharing class JdeOrderController {

    Account account;
    List<JdeOrderHeader> jdeData;
    string message;
        
    public JdeOrderController () {
        message = '';
        account = [SELECT stuff FROM Account WHERE Id = :ApexPages.currentPage().getParameters().get('id')];
        if(String.isEmpty(account.stuff) || !account.JDE__c.isNumeric()) {
            message = 'BLA BLA BLA' ;
        }
        else {
            jdeData = RetrieveJdeData();
        }
    }
    
    public string getMessage() {
        return message;
    }
    
    public List<JdeOrderHeader> getJdeData() {
        return jdeData;
    }

    private List<JdeOrderHeader> RetrieveJdeData() {
        HttpRequest req = new HttpRequest();
        HttpResponse res = new HttpResponse();
        Http http = new Http();

        JdeIntegration jde = new JdeIntegration();
        String url = jde.buildUrl(account, 'order');
        
        if (url == '') {
            return null;
        }

        req.setEndpoint(url);
        req.setMethod('GET');
        res = http.send(req);
    
        if(res.getstatusCode() == 200 && res.getbody() != null) {    
            List<JdeOrderHeader> jdeDataList = (List<JdeOrderHeader>)json.deserialize(res.getbody(), List<JdeOrderHeader>.class);
            return jdeDataList;
        }

        return null;
    }
}
HI 
In my vf page i am displating all account records (by using  <apex:pageBlockTable> ) it is done  here my problem is 
when i am click on account name ( any one from displayed account names) then immediately display one popup in that popup should display that account name  record details 
 
 
Hi i am trying to download installed packages with names containing space but it was throwing me an error, the below command worked fine wit out spaces in package name. 

This was in windows cmd prompt 

sfdx force:mdapi:retrieve -p "Contact Contact Course ManagementApp" 
Can any one sugget me Auto Complete feature for sublime text 3 for lightning development?
 Hi I would like to report a error in the new Lightning Data Service basics Module (Handle record Changes and Errors) in this we have ldsEditContactController.js.
 
make sure you have the comma between saveContact and handleRecordUpdated funcitons
 
Thank you
Hi Can some one explain me how to use two components with Lightning Data Service, i tried the following code for accDisplay and accEdit.
This worked as i expected but i got the following error!

I am missing some thing, can some one explain me how LDS works with multiple componets!
 
Challenge Not yet complete... here's what's wrong: 
The 'accDisplay' Lightning Component does not appear to be displaying the 'Name' using 'ui:outputText' and the value 'v.accountRecord.Name
 
<!--accDisplay component-->
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId">
 <aura:attribute name="accountRecord" type="Object" />
<force:recordData aura:id="AccountRecordCreator"
    recordId="{!v.recordId}"
    layoutType="FULL"
    targetRecord="{!v.accountRecord}"
    targetFields="{!v.simpleNewAccount}"
    targetError="{!v.newContactError}"
                  mode="VIEW"
    />
   



    <!-- Display a header with details about the record -->
    <div class="slds-form--stacked">
        <div class="slds-form-element">
            <label class="slds-form-element__label" for="recordName">Name: </label>
            <div class="slds-form-element__control">
              <ui:outputText class="slds-input" aura:id="recordName"
                value="{!v.simpleNewAccount.Name}" />
            </div>
            <label class="slds-form-element__label" for="recordIndustry">Industry: </label>
            <div class="slds-form-element__control">
              <ui:outputText class="slds-input" aura:id="recordIndustry"
                value="{!v.simpleNewAccount.Industry}" />
            </div>
             <label class="slds-form-element__label" for="recordDescription">Description: </label>
            <div class="slds-form-element__control">
              <ui:outputTextArea class="slds-input" aura:id="recordDescription"
                value="{!v.simpleNewAccount.Description}" />
            </div>
             <label class="slds-form-element__label" for="recordPhone">Phone: </label>
            <div class="slds-form-element__control">
              <ui:outputPhone class="slds-input" aura:id="recordPhone"
                value="{!v.simpleNewAccount.Phone}" />
            </div>
        </div>
    </div>

   

   
</aura:component>
<!--accEdit-->
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId">

<aura:attribute name="accountRecord" type="Object"/>
<aura:attribute name="simpleNewAccount" type="Object"/>
<aura:attribute name="newContactError" type="String"/>

<force:recordData aura:id="AccountRecordCreator"
    recordId="{!v.recordId}"
    layoutType="FULL"
    targetRecord="{!v.accountRecord}"
    targetFields="{!v.simpleNewAccount}"
    targetError="{!v.newContactError}"
                  mode="EDIT"
    />
   
    <ui:outputText class="slds-output" 
                value="Edit Account" />
     <lightning:input aura:id="recordName" name="accountRecord" label="Name"
                  value="{!v.simpleNewAccount.Name}" />

     <lightning:button label="Save Account" onclick="{!c.handleSaveRecord}"
               variant="brand" class="slds-m-top--medium"/>
</aura:component>

 
I am having an issue centering the section header in  VF page.  Its more like off center towards the left side of the VF page.
User-added image

Here is the VF page.  The command buttons centered well but the title is not.  Any suggestions is greatly appreciated.
<div style="background-color:green;height:500px;width:802px;">
        <apex:form id="Merchandising" >
           <div align="center" >
            <apex:sectionHeader title="Choose Merchandising"/>
            </div>;
                <apex:pageBlock title="">
                    <apex:pageBlockSection columns="2">             
                    <apex:inputField value="{!merch.Merchandise__c}" required="true"/>
                    <apex:inputField value="{!merch.Date_Displayed__c}"/>
                    <apex:inputField value="{!merch.Merchandise_Category__c}" required="true"/>
                    <apex:outputfield value="{!merch.Date_Delivered__c}"  html-disabled="true" />
                    <apex:inputField value="{!merch.Merchandise_SubCategory__c}" required="true"/>                
                    <apex:inputField value="{!merch.Date_Removed_Replaced__c}"/>
                </apex:pageBlockSection>
            
                <Br></Br><Br></Br><Br></Br>            
                <div align="center" draggable="false" >
            
                <apex:commandButton action="{!save}" value="Save" id="saveButton" reRender="Panel" />        
                &nbsp;&nbsp;&nbsp;&nbsp;
                <apex:commandButton value="Cancel" onclick="window.close();" immediate="true"/>

 
I craeted custom button on  participant table and link Vf pageto the button . when i clicked on the button , address table will get updated 
This is my controller extension  and Vf page .i need help on the test calss 
public with sharing class PClass{

    public participant__c participant;
    private ApexPages.StandardController stdControler;
    public Id Id { get; set; }
    
    
    public PClass(ApexPages.StandardController stdControler){
        
        this.participant = (participant__c)stdControler.getRecord();
        this.stdControler = stdControler;
            
    }
    
    public PageReference InsertAddress(){
        	
        try{
            participant__c p = [select id, SS_ID__c 
                                from participant__c
                               where Id = :participant.Id limit 1];
                             
           Registration__c r= [select Id,Address1__c, Address2__c,SS_ID__c 
                                                                        from Registration__c 
                                                                        where SS_ID__c =:p.SS_ID__c limit 1];
                                                                        
            Addresses_c  paddress = new Addresses__c();
            paddress.participant__c = participant.Id;
            paddress.Address1__c = r.Address1__c;
            paddress.Address2__c = r.Address2__c;
            insert paddress;
	   }

	   catch (Exception e){}
           return new ApexPages.StandardController(participant).view();
}
VF page 
<apex:page standardController="Participant__c" extensions="PClass" action="{!InsertAddress}" >


</apex:page>
My test class
@isTest public  with sharing class PClass_Test {

    static TestMethod void AddAddress(){
        
        
        Registration__c  TestRegistration= new Registration__c();
        TestRegistration.Name = 'Test Registration';
        TestRegistration.SS_ID__c = Decimal.valueOf(30111);
        TestRegistration.Address1__c='10 Street';
        TestRegistration.Address2__c ='15 street';
        insert TestRegistration;
        
        participant__c TestParticipant = new participant__c();
        TestParticipant.FirstName__c ='Test participant';
        TestParticipant.SS_ID__c =Decimal.valueOf(30111);;
        insert TestParticipant;
        
	Test.startTest();
        ApexPages.StandardController stdController = new ApexPages.StandardController(TestParticipant);
        PClass  pa = new PClass(stdController);
       System.debug(pa.Id);
      
        
       	pa.InsertAddress();
        System.debug(pa);
        
        Test.stopTest();
        try{
        
     		Addresses_c padd = [select id, participant__c from Addresses_c where participant__c =:pa.Id limit 1];
           }
      catch (Exception e){}
}


 
  • August 15, 2017
  • Like
  • 0
I am trying to push a managed extension package to a scratch org but am running into some issues. The issues seem to be stemed around some custom objects that are owned by the package that is being extended. I have added the "extension" fields and can see that the objects are being added to the extension package but it is still erroring. I have attatched the errors below.
 
force-app/main/default/objects/inscor__Allocation__c.object-meta.xml                      Must specify a non-empty label for the CustomObject
N/A                                                                                       Field Employee__r does not exist. Check spelling. (88:13)
N/A                                                                                       referenceTo value of 'inscor__Company_Location__c' does not resolve to a valid sObject type (66:13)
N/A                                                                                       referenceTo value of 'inscor__Part_Master__c' does not resolve to a valid sObject type (138:13)
force-app/main/default/objects/inscor__Employee__c.object-meta.xml                        Must specify a non-empty label for the CustomObject
N/A                                                                                       referenceTo value of 'inscor__Employee__c' does not resolve to a valid sObject type (66:13)
N/A                                                                                       referenceTo value of 'inscor__Employee__c' does not resolve to a valid sObject type (66:13)
N/A                                                                                       referenceTo value of 'inscor__Inventory_Line__c' does not resolve to a valid sObject type (66:13)
N/A                                                                                       referenceTo value of 'inscor__Employee__c' does not resolve to a valid sObject type (66:13)
force-app/main/default/layouts/Work_Order__c-Work Order Layout.layout-meta.xml            In field: field - no CustomField named Work_Order__c.Company_Location__c found (18:26)
force-app/main/default/layouts/Labor_Entry__c-Labor Entry Layout.layout-meta.xml          In field: field - no CustomField named Labor_Entry__c.Employee__c found (20:26)
force-app/main/default/layouts/Tool_Assignment__c-Tool Assignment Layout.layout-meta.xml  In field: field - no CustomField named Tool_Assignment__c.Employee__c found (28:26)
force-app/main/default/layouts/Work_Order_Task__c-Work Order Task Layout.layout-meta.xml  In field: field - no CustomField named Work_Order_Task__c.Assigned_To__c found (55:26)
force-app/main/default/applications/AvSight_Work_Order.app-meta.xml                       In field: tab - no CustomTab named Administration found

 
Hi guys difference between component events and application events
Hi All, 

Is there a way that we can send an email from Salesforce and easily attach items form a custom objects notes and attachmnets section? The current method of saving locally and then uploading is very time consuming. 
From what I have seen so far, the best method is to create a custom "send email" button which fetches the required attachments, but as I am not a developer I cannot say this with any clarity.  
I am following examples from Lightning COmponent developer guide, but looks like all style and design are missing there? When I am trying simple examples these all show very odd? Any suggestion what needs to be followed?

for example If I follow these examples,
it shows everything looks in very bad UI most of thing don't render as expected.
User-added image
for example I am just using below code :
<aura:component >
    <aura:attribute name="myTitle" type="String" default="My Card Title"/>
    BreadCrumb:
    <lightning:breadcrumbs >
        <lightning:breadcrumb label="Parent Account" href="https://vyaslirik-dev-ed.lightning.force.com/one/one.app#/sObject/5007F000001hWVgQAM/view"/>
        <lightning:breadcrumb label="Case" href="https://vyaslirik-dev-ed.lightning.force.com/one/one.app#/sObject/5007F000001hWVgQAM/view"/>
    </lightning:breadcrumbs>
	<lightning:icon iconName="utility:error" variant="error"/>
   Avatar : <lightning:avatar src="{!$Resource.Images + '/Images/lightning.png'}" initials="Sa" 
      fallbackIconName="standard:account" alternativeText="Salesforce"/>    
	<lightning:pill label="hello pill" onremove="{! c.handleRemoveOnly }" onclick="{! c.handleClick }">
    	<aura:set attribute="media">
            <lightning:icon iconName="standard:account"  alternativeText="Account"/>
        </aura:set>
    </lightning:pill>
3
    <lightning:card title="{!v.myTitle}" footer="Card Footer">
        <aura:set attribute="actions">
            <lightning:button label="New"/>
        </aura:set>
        <p class="slds-p-horizontal--small">
            Card Body (custom component)
        </p>
    </lightning:card>
    
    <div class="c-container">
        <lightning:layout horizontalAlign="end" verticalAlign="center">
            <lightning:layoutItem flexibility="auto" padding="around-small">
               <lightning:formattedNumber value="12.34" style="currency" 
                     currencyCode="EUR" currencyDisplayAs="symbol"/>
            </lightning:layoutItem>
            <lightning:layoutItem flexibility="auto" padding="around-small">
                <lightning:input type="number" name="percentVal" label="Enter a percentage value" formatter="percent" step="0.01" />
            </lightning:layoutItem>
            <lightning:layoutItem flexibility="auto" padding="around-small">
                <lightning:input type="number" name="currencyVal" label="Enter a dollar amount" formatter="currency" step="0.01" />
            </lightning:layoutItem>
            <lightning:layoutItem flexibility="auto" padding="around-small">
                4
            </lightning:layoutItem>
        </lightning:layout>
    </div>

	<lightning:button label="Toggle" variant="brand" onclick="{!c.toggle}"/>
    <div class="exampleHolder">
        <lightning:spinner aura:id="mySpinner" />
    </div>
     <form>
      <fieldset>
        <legend>Select your favorite color:</legend>
        <lightning:input type="checkbox" label="Red" 
            name="color1" value="1" aura:id="colors"/>
        <lightning:input type="checkbox" label="Blue" 
            name="color2" value="2" aura:id="colors"/>
        <lightning:input type="checkbox" label="Green" 
            name="color3" value="3" aura:id="colors"/>
      </fieldset>
    <lightning:tabset>
      <lightning:tab onactive="{! c.handleActive }" label="Tab 1" id="tab1" />
      <lightning:tab onactive="{! c.handleActive }" label="Tab 2" id="tab2" />
    </lightning:tabset>
    </form>
</aura:component>
Hello, I have been reciving more business requrements that require me to buid Flows lately and I need some tips from you experts :)
Right now I am entirely focused on flows that do not have screens and are launched by Process Builder.

The two main things I want to figure out are:
1) First and foremost, how can I have my flow send me an email at a given step to show me what the current variable values are? For example, I have a decision element and while testing, my flow is taking the action that the "No" side of the decision leads to when I want it to be taking the other action and I can't figure out why it's doing what it's doing. If I could have the flow send me an email to show me what the result of the decision element was and what the variable values were right then, that would really help me troubleshoot.
2) How can I customize the flow errors so that if my flow does generate an error message it's better than "An unhandled fault has occured..."
3) When referencing a record ID in visual workflow, does it matter if you use a 15 or 18-digit ID?
4) What resources can you direct me to that can help me learn and practice visual workflow? I have done some trailhead, but already completed the "Process Automation" badge, which mostly covers flows with screens.

Any help is much appreciated. Thank you!
Hello!,

I was wondering if anyone has any experience with this, or if anyone knows if this is even possible?

We get an excel document automatically created on our local server every day with information we have pulled via another API (That we can't intergrate directly with Salesforce).

What we want to do, is every day at X Time take the excel sheet, and upload it to salesforce using a mapping into a custom object.
 
Has anyone encounted a need to upload a CSV automatically like this? Would love to hear some potental ideas as well.
Hi everyone, so I'm having trouble making my extension class for my VF page be able to interact with custom fields that I need. When the picklists in my VF page get selected Yes/No it triggers a method in the extension class to check a checkbox Checked for Yes, Not Checked for No. But as of right now when I run my VF page and try to select Yes/No it gives me the error "Attempt to de-reference a null object. Error is in expression '{!setDataIntegrity}' in page escalation_question_page: Class.EscalationPageExtension.setDataIntegrity: line 31, column 1". So there is clearly something wrong when trying to check the checkbox.

Any help would be absolueltly fantastic and greatly appreciated. If you would also be able to give me an exmaple of how my Test Class for the extension would look I would really appreciate it. Im horrible with test classes and have no idea how it would look. Thanks again!

Extension:
/***************************************************************
 * Used for the Visualforce page Escalation Question Page
 * Created by Isaac Gomolka
 * 7/13/2017
 * ************************************************************/

public with sharing class EscalationPageExtension { 
    
    public String picklist1{get;set;}
    public String picklist2{get;set;}
    public String picklist3{get;set;}
    private Case cases;
   
    private ApexPages.StandardController ctrl;
    public EscalationPageExtension(ApexPages.StandardController controller)
    {
        ctrl = controller; 
        this.ctrl = ctrl;   
    }
    
    public List<SelectOption> options { get; private set; }
    {
    options = new List<SelectOption>();
    options.add(new SelectOption('', '-Select-')); // ==> option null
    options.add(new SelectOption('false', 'No'));
    options.add(new SelectOption('true', 'Yes'));
    }
    
    public void setDataIntegrity()
    {
        this.cases.Escalation_Data_Integrity__c = Boolean.valueof(picklist1); 
    }
    
    public void setViableWorkaround()
    {
        this.cases.Escalation_Viable_Workaround__c = Boolean.valueof(picklist2);
    }
    
    public void setAppFunction()
    {
        this.cases.Escalation_Application_Functionality__c = Boolean.valueof(picklist3);
    }
}

VF Page
<apex:page standardController="Case" extensions="EscalationPageExtension"><!-- We should keep sidebars and headers to give them a way out -->
    <apex:pageBlock title="{!$User.FirstName}, Answer Questions to Escalate Case.">
    
    <apex:form id="formID">
      
      <h1>How many users are affected?</h1>
      <apex:inputField value="{! Case.Escalation_Users_Affected__c }" required="true"/>
    
      <br/>
      <h1>Does this affect data integrity?</h1>
      <apex:actionRegion >
          <apex:outputPanel styleClass="requiredInput" layout="block">
          <apex:outputPanel styleClass="requiredBlock" layout="block"/>
          <apex:selectList value="{!picklist1}" size="1" required="true">
          <apex:actionSupport event="onchange" rerender="hidepanel1" action="{!setDataIntegrity}"/>
          <apex:selectOptions value="{!options}" />
          </apex:selectList>
          </apex:outputPanel>
      </apex:actionRegion>
      <br/>
      <apex:outputPanel id="hidepanel1">
      <apex:outputText value="How?" style="display:{!if(picklist1=='true', 'block', 'none')}"/>
      <apex:inputField value="{!Case.Escalation_Data_Integrity_Explain__c}" required="{!picklist1}" style="display:{!if(picklist1=='true', 'block; width:250px; height:75px;', 'none')}"/>
      <!-- <apex:inputCheckbox value="{!Case.Escalation_Data_Integrity__c}" selected="true" style="display:none;" rendered="{!picklist1}"/> -->
      </apex:outputPanel>
      
      <br/> <br/>
      <h1>Do you have a viable workaround?</h1>
      <apex:actionRegion >
          <apex:outputPanel styleClass="requiredInput" layout="block">
          <apex:outputPanel styleClass="requiredBlock" layout="block"/>
          <apex:selectList value="{!picklist2}" size="1" required="true">
          <apex:actionSupport event="onchange" rerender="hidepanel2" action="{!setViableWorkaround}"/>
          <apex:selectOptions value="{!options}" />
          </apex:selectList>
          </apex:outputPanel>
      </apex:actionRegion>
      <br/>
      <apex:outputPanel id="hidepanel2">
      <apex:outputText value="What is the viable workround?" style="display:{!if(picklist2=='true', 'block','none')}"/>
      <apex:inputField value="{!Case.Escalation_Viable_Workaround_Explain__c}" required="{!picklist2}" style="display:{!if(picklist2=='true', 'block; width:250px; height:75px;', 'none')}" />
      <!-- <apex:inputCheckbox value="{!Case.Escalation_Viable_Workaround__c}" selected="true" style="display:none;" rendered="{!picklist2}"/> -->
      </apex:outputPanel>
    
      <br/> <br/>
      <h1>Does this affect critical application functionality?</h1>
      <apex:actionRegion >
          <apex:outputPanel styleClass="requiredInput" layout="block">
          <apex:outputPanel styleClass="requiredBlock" layout="block"/>
          <apex:selectList value="{!picklist3}" size="1" required="true">
          <apex:actionSupport event="onchange" rerender="hidepanel3" action="{!setAppFunction}"/>
          <apex:selectOptions value="{!options}" />
          </apex:selectList>
          </apex:outputPanel>
      </apex:actionRegion>
      <br/>
      <apex:outputPanel id="hidepanel3">
      <apex:outputText value="How?" style="display:{!if(picklist3=='true', 'block','none')}"/>
      <apex:inputField value="{!Case.Escalation_App_Functionality_Explain__c}" required="{!picklist3}" style="display:{!if(picklist3=='true', 'block; width:250px; height:75px;', 'none')}" />
      <!-- <apex:inputCheckbox value="{!Case.Escalation_Application_Functionality__c}" selected="true" style="display:none;" rendered="{!picklist3}"/> -->
      </apex:outputPanel>
      
      <br/> <br/>
      <h1>What business functionality are you unable to perform?</h1>
      <br/>
      <apex:inputField value="{! Case.Escalation_Business_Functionality__c }"  style="width: 300px; height: 100px" required="true"/>
      
      <br/> <br/> <br/>
      <apex:inputCheckbox value="{!Case.IsEscalated}" selected="true" style="display:none;"/>
      <apex:commandButton action="{!save}" value="Submit" />
      
    </apex:form>  
    </apex:pageBlock>   
</apex:page>

Thanks again in advanced for the help!​