• Alok Singh 140
  • NEWBIE
  • 30 Points
  • Member since 2019
  • on the way of SalesForce Ninja
  • TCS

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 13
    Replies
I have build a form with two columns of fields and 4 of them are bottom justified, is there a way to get them to align by the top of the field, here is a screenshot of what I am referring to:

User-added image

Here is my code:

<lightning:layout pullToBoundary="medium">
        <lightning:layoutItem size="10" smallDeviceSize="5" mediumDeviceSize="5"  padding="around-small">
            <c:customLookup objectAPIName="account" IconName="standard:account" label="Tenant" selectedRecord="{!v.selectedTenantRecord}"/>
        </lightning:layoutItem>
        <lightning:layoutItem size="10" smallDeviceSize="5" mediumDeviceSize="5"  padding="around-small">
            <ui:inputDate aura:id="LeaseEffectiveDate" label="Lease Effective Date" class="field" value="{!v.PropDetails.LeaseEffectiveDate__c}" displayDatePicker="true" />      
        </lightning:layoutItem>
    </lightning:layout>
        
    <lightning:layout pullToBoundary="medium">
        <lightning:layoutItem size="10" smallDeviceSize="5" mediumDeviceSize="5"  padding="around-small">
            <!--<lightning:input label="Lease Opportunity" name="LeaseOpportunity" value="{!v.PropDetails.LeaseOpportunity__c }" /> -->
            <c:customLookup objectAPIName="opportunity" IconName="standard:opportunity" label="Lease Opportunity" selectedRecord="{!v.selectedOpptyRecord}"/>
        </lightning:layoutItem>
        <lightning:layoutItem size="10" smallDeviceSize="5" mediumDeviceSize="5"  padding="around-small">
            <ui:inputDate aura:id="LeaseExpirationDate" label="Lease Expiration Date" class="field" value="{!v.PropDetails.LeaseExpirationDate__c }" displayDatePicker="true" />      
        </lightning:layoutItem>
    </lightning:layout>    
        
    </div> 

Any help that can be provided would be greatly appreciated!
I have customer__c object with FirstName_c, LastName_c, DOB_c fields.
First VF page has  FirstName_c, LastName_c, DOB_c  InputFields and a "save" button which save record in Object
And "List" Button show that record fields with that values of input field in Second VF page.
 
I have a custom currency field called "Standard Price" on the products object. I need this because a formula field on a related object looks at this field.

I'm trying to see if it's possible to build a trigger that fires everytime the "Standard Price" in the standard price book is updated and updates that custom field to match.

Thanks!
Public class AutoConvertLeads
{
@InvocableMethod
public static void LeadAssign(List<Id> LeadIds)
{
LeadStatus CLeadStatus= [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true Limit 1];
List<Database.LeadConvert> MassLeadconvert = new List<Database.LeadConvert>();

List<Lead> myLeads = [Select id, name, company, Matched_Account_ID__c from Lead where id IN:LeadIds];
List<String> MatchedAccount = New List<String>();

for (Lead l:myLeads){
MatchedAccount.add(l.Matched_Account_ID__c);
}

List<Account> matchAccount = [Select id, Name from account where id IN:MatchedAccount];

Integer i=0;
for(Lead currentlead: myLeads){
for (Account a:matchAccount){
if (currentlead.Matched_Account_ID__c == a.id){
Database.LeadConvert Leadconvert = new Database.LeadConvert();
Leadconvert.setLeadId(currentlead.id);
Leadconvert.setAccountId(a.id);
Leadconvert.setConvertedStatus(CLeadStatus.MasterLabel);
Leadconvert.setDoNotCreateOpportunity(TRUE); //Remove this line if you want to create an opportunity from Lead Conversion
MassLeadconvert.add(Leadconvert);
i++;
Break;
}
}
If (i==0)
{
Database.LeadConvert Leadconvert = new Database.LeadConvert();
Leadconvert.setLeadId(currentlead.id);
Leadconvert.setConvertedStatus(CLeadStatus.MasterLabel);
Leadconvert.setDoNotCreateOpportunity(TRUE); //Remove this line if you want to create an opportunity from Lead Conversion
MassLeadconvert.add(Leadconvert);
}
i=0;
}

if (!MassLeadconvert.isEmpty()) {
List<Database.LeadConvertResult> lcr = Database.convertLead(MassLeadconvert);
}
}
}
I have build a form with two columns of fields and 4 of them are bottom justified, is there a way to get them to align by the top of the field, here is a screenshot of what I am referring to:

User-added image

Here is my code:

<lightning:layout pullToBoundary="medium">
        <lightning:layoutItem size="10" smallDeviceSize="5" mediumDeviceSize="5"  padding="around-small">
            <c:customLookup objectAPIName="account" IconName="standard:account" label="Tenant" selectedRecord="{!v.selectedTenantRecord}"/>
        </lightning:layoutItem>
        <lightning:layoutItem size="10" smallDeviceSize="5" mediumDeviceSize="5"  padding="around-small">
            <ui:inputDate aura:id="LeaseEffectiveDate" label="Lease Effective Date" class="field" value="{!v.PropDetails.LeaseEffectiveDate__c}" displayDatePicker="true" />      
        </lightning:layoutItem>
    </lightning:layout>
        
    <lightning:layout pullToBoundary="medium">
        <lightning:layoutItem size="10" smallDeviceSize="5" mediumDeviceSize="5"  padding="around-small">
            <!--<lightning:input label="Lease Opportunity" name="LeaseOpportunity" value="{!v.PropDetails.LeaseOpportunity__c }" /> -->
            <c:customLookup objectAPIName="opportunity" IconName="standard:opportunity" label="Lease Opportunity" selectedRecord="{!v.selectedOpptyRecord}"/>
        </lightning:layoutItem>
        <lightning:layoutItem size="10" smallDeviceSize="5" mediumDeviceSize="5"  padding="around-small">
            <ui:inputDate aura:id="LeaseExpirationDate" label="Lease Expiration Date" class="field" value="{!v.PropDetails.LeaseExpirationDate__c }" displayDatePicker="true" />      
        </lightning:layoutItem>
    </lightning:layout>    
        
    </div> 

Any help that can be provided would be greatly appreciated!
I want to call a function in every 5-second lightning component controller. 
Hi there,

I have Picklist field Membership_Level__c which have some values like Child Free and another picklist field Membership_Type__c which also have some value like GP and Dental.

Add a validation rule not to allow to add Free Child to GP and Dental.
I did this:
IF(AND(ISPICKVAL(Membership_Type__c,'MHC GP'), 
NOT(ISBLANK(Membership_Level__c,'Child Free'))), true, false)

Please assist
LN
<!--            <ui:scrollerWrapper  class="scroll" >-->
    <aura:iteration items="{!v.commentsData}" var="comment" indexVar="key">
        <lightning:card class="{!comment.Color == 'grey' ? 'grey' : 'blue'}" aura:id="{!comment.Color}+{!key}">
            {!comment.text}
        </lightning:card>
    </aura:iteration>
    <!--    </ui:scrollerWrapper>-->
If ui:scrollerWrapper is uncommented, the class in card element does not work.
 
If there is a possiblity, then

Can I get a code sample (having @http post method) on how to upload pdf file into salesforce object (say as an attachment) sent to salesforce with a http request using multipart/from-data from some external site.

For a while I've gone through multipart/form-data in the developer forum, but I could only find the HTTP Request samples made from salesforce and not to salesforce.

Thanks,
Leafen.

Hi,

I am a beginner to Salesforce development.

 

By default, from the Partner related list on the Opportunity, you can create OpportunityPartner junction objects between an Opportunity and a Partner Account. We want to modify this page. Unfortunately this object is not very easy to customize.

 

We have come up with a solution that works for us though.

I am going to create a Visualforce page with standardController 'Opportunity' and with an extension class.

The Visualforce page should be built up to look similar to the current Partner Edit page. 

 

So we are going to have five rows of partners where you can choose if its primary or not, the AccountToId and the Role. You don't have to fill in information on all rows.

 

I am not at all done with this yet and many things are not working as I would like them too (the radio buttons for instance). But currently I am stuck with the problem that the getters for the partner variables work but the setters does not. In other words I know that the getPartner methods have been run since I have seen this in the debug logs. The setters are never run though and this becomes obvious and also a problem when I try to insert one of the defined partners in the save method . I get an error that the field 'AccountToId' is a required field and should have a value:

 

 

Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [AccountToId]: [AccountToId]

 

 

Furthermore as you can see I have chosen to use the Partner object since I am not allowed to create OpportunityPartner objects. But when a Partner object gets created an OpportunityPartner object also does so that shouldn't be a problem.

 

VisualForce page:

 

<apex:page title="Partners: {!Opportunity.Name}" standardController="Opportunity" extensions="PartnerEditExt" showheader="true" sidebar="true" id="thePage"> <apex:sectionHeader title="Partners" subtitle="{!Opportunity.Name}" id="partnerEditSectionId" help="javascript:openPopupFocusEscapePounds(%27/help/doc/user_ed.jsp?loc=help&target=partners_edit.htm&section=Partners&showSplash=true%27, %27Help%27, 700, 600, %27width=700,height=600,resizable=yes,toolbar=yes,status=no,scrollbars=yes,menubar=yes,directories=no,location=no,dependant=no%27, false, false);"></apex:sectionHeader> <apex:pageMessages /> <apex:form id="theForm"> <apex:pageBlock title="Partners Edit"> <apex:pageBlockSection columns="3"> <!-- Headings --> <apex:outputText value="Primary" style="font-weight:bold" /> <apex:outputText value="Partner" style="font-weight:bold" /> <apex:outputText value="Role" style="font-weight:bold" /> <apex:pageBlockSectionItem > <apex:inputField value="{!Partner0.isPrimary}" id="fromPartnerPrimary0"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:outputText value="No Partner" id="noPartnerAccount"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem /> <!-- Partner 1 row --> <apex:pageBlockSectionItem > <apex:inputField value="{!Partner1.isPrimary}" id="fromPartnerPrimary1" /> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:inputField value="{!Partner1.AccountToId}" id="fromPartner1" /> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:inputField value="{!Partner1.Role}" id="fromPartnerRole1" /> </apex:pageBlockSectionItem> <!-- Partner 2 row --> <apex:pageBlockSectionItem > <apex:inputField value="{!Partner2.isPrimary}" id="fromPartnerPrimary2"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:inputField value="{!Partner2.AccountToId}" id="fromPartner2"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:inputField value="{!Partner2.Role}" id="fromPartnerRole2"/> </apex:pageBlockSectionItem> <!-- Partner 3 row --> <apex:pageBlockSectionItem > <apex:inputField value="{!Partner3.isPrimary}" id="fromPartnerPrimary3"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:inputField value="{!Partner3.AccountToId}" id="fromPartner3"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:inputField value="{!Partner3.Role}" id="fromPartnerRole3"/> </apex:pageBlockSectionItem> </apex:pageBlockSection> <apex:pageBlockButtons location="bottom"> <apex:commandButton action="{!save}" value="Save" immediate="true" /> <apex:commandButton action="{!Cancel}" value="Cancel" /> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </apex:page>

 

The Apex extension class:

 

public with sharing class PartnerEditExt { final Opportunity opp; Partner partner0 = null; Partner partner1 = null; Partner partner2 = null; Partner partner3 = null; ID oppId; ID accId; ID noPartnerAccId = [select id from Account where Name = 'no partner'].Id; /* Constructor */ public PartnerEditExt(ApexPages.StandardController controller) { opp = (Opportunity)controller.getRecord(); oppId = controller.getRecord().Id; accId = [select AccountId from Opportunity where Id = :oppId].AccountId; partner0 = new Partner(OpportunityId=oppId); partner1 = new Partner(OpportunityId=oppId); partner2 = new Partner(OpportunityId=oppId); partner3 = new Partner(OpportunityId=oppId); } /* Save action Insert the specified partners */ public void save() { // Currently no intelligent logic here // I just want to test that partner1 can be inserted insert partner1; } /* Cancel action Redirect user back to opportunity */ public PageReference cancel() { String curr = '/'+ApexPages.currentPage().getParameters().get('id'); PageReference pageref = new Pagereference(curr); return pageref; } /* Getters and Setters for the partner variables */ public Partner getPartner0() { return partner0; } public void setPartner0(Partner p) { partner0 = p; } public Partner getPartner1() { return partner1; } public void setPartner1(Partner p) { partner1 = p; } public Partner getPartner2() { return partner2; } public void setPartner2(Partner p) { partner2 = p; } public Partner getPartner3() { return partner3; } public void setPartner3(Partner p) { partner3 = p; } }

 

 Some of you might wonder why we didn't choose to use a custom object instead. We though of this but made the assumption that this work would take less time and also be less risky.

 

What have I done wrong?

I think I might miss some basic understanding here. A solution to my problem with a good explanation would be very welcome!

 

 

Thanks / Niklas