-
ChatterFeed
-
6Best Answers
-
1Likes Received
-
0Likes Given
-
17Questions
-
39Replies
lightning csv uploader to create accounts
Hi Team,
trying to deisgn CSV uploder in lightning component and need to display in table after uploading CSV file and on click on save button need to save account reords in data base.
Using these contoroller to create account.. help me to design lightning component
trying to deisgn CSV uploder in lightning component and need to display in table after uploading CSV file and on click on save button need to save account reords in data base.
public class PMO_CsvUploaderController { public Blob csvFileBody{get;set;} public string csvAsString{get;set;} public String[] csvFileLines{get;set;} public List<Account> Acclist{get;set;} public PMO_CsvUploaderController(){ csvFileLines = new String[]{}; Acclist = New List<Account>(); } public void importCSVFile(){ try{ csvAsString = csvFileBody.toString(); csvFileLines = csvAsString.split('\n'); for(Integer i=1;i<csvFileLines.size();i++){ Account couObj = new Account(); string[] csvRecordData = csvFileLines[i].split(','); couObj.name = csvRecordData[1] ; couObj.AccountNumber = csvRecordData[2]; couObj.Phone = csvRecordData[3]; couObj.Rating = csvRecordData[4]; /* String temp_fees=csvRecordData[3]; couObj.Course_fees__c = Decimal.valueOf(temp_fees); String temp_date=csvRecordData[4]; couObj.Course_Date__c = Date.parse(temp_date); */ Acclist.add(couObj); } insert Acclist; } catch (Exception e){ System.debug(e.getCause()); ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.ERROR,'An error has occured while importing data. Please make sure input csv file is correct'); ApexPages.addMessage(errorMessage); } } }
Using these contoroller to create account.. help me to design lightning component
- bhanu_prakash
- January 04, 2019
- Like
- 0
- Continue reading or reply
limit aura iteration
Hi everyone.
I hope you can help me. I'm working with a lightning component which has an aura iteration with another component inside.
My code:
I would like to know if there is any way to limit the number of records displayed and make a kind of button to load more or show more like in list views or related lists because when I have very few records I have no problem but when I have many records I get a very long vertical scroll and this is I want to avoid.
Regards
I hope you can help me. I'm working with a lightning component which has an aura iteration with another component inside.
My code:
<aura:iteration var="event" items="{!v.events}"> <c:LC_Events event="{!event}"/> </aura:iteration>
I would like to know if there is any way to limit the number of records displayed and make a kind of button to load more or show more like in list views or related lists because when I have very few records I have no problem but when I have many records I get a very long vertical scroll and this is I want to avoid.
Regards
- Javier Castro
- December 27, 2018
- Like
- 0
- Continue reading or reply
oppurtunity vf page
hi All,
I have made a oppurtunity page as vf page , but it is not responsive in simulator, all the fields are not aligned,
just see the effect.
i have bootstrap also,
plz reply ,
I have made a oppurtunity page as vf page , but it is not responsive in simulator, all the fields are not aligned,
just see the effect.
i have bootstrap also,
plz reply ,
- Aurora Ganguly 10
- July 04, 2017
- Like
- 0
- Continue reading or reply
Variable does not exist: standardController
On line 10 of my Class, I get the error listed in the subject line above. Unsure how to resolve. I am working on adding the attachments option to my VF Page listed below as well. Please help!!
public class VFAttachments {
public Id recordId;
public VFAttachments() {
}
public VFAttachments(ApexPages.StandardController controller) {
this.recordId = (Trip_Report__c)standardController.getRecord().Id;
}
public Attachment attachment {
get {
if (attachment == null)
attachment = new Attachment();
return attachment;
}
set;
}
public PageReference upload() {
attachment.OwnerId = UserInfo.getUserId();
attachment.ParentId = recordId; // the record the file is attached to
// attachment.ParentId = ApexPages.currentPage().getParameters().get('id');
attachment.IsPrivate = true;
try {
insert attachment;
} catch (DMLException e) {
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error uploading attachment'));
return null;
} finally {
attachment = new Attachment();
}
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'Attachment uploaded successfully'));
return null;
}
}
VF Page Below....
<apex:page standardController="Trip_Report__c" >
<style>
.activeTab {background-color: #2ECCFA; color:white;
background-image:none}
.inactiveTab { background-color: lightgrey; color:black;
background-image:none}
</style>
<script>
function confirmSave() {
var isSave = confirm("Your Trip Report has been saved!");
if (isSave) return true;
return false;
}
</script>
<apex:form >
<apex:pageBlock title="Trip Report">
<apex:pageBlockButtons >
<apex:commandButton value="Save As Draft" action="{!save}"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>
<apex:commandButton value="Delete" action="{!delete}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection columns="1">
<apex:inputfield required="true" value="{!Trip_Report__c.Name}" label="Visit"/>
<font style="margin-left:240px" size="0.25" color="blue"> <b> Enter: 'TR'-Company Name-Subject for the Visit</b></font>
<apex:inputfield required="true" value="{!Trip_Report__c.Purpose_of_Visit__c}" label="Purpose Of Visit"/>
<apex:inputfield value="{!Trip_Report__c.Visit_Date__c}" label="Date"/>
<apex:inputfield value="{!Trip_Report__c.Lead_Source__c}" label="Lead Source"/>
<apex:inputfield value="{!Trip_Report__c.Opportunity__c}" label="Opportunity"/>
<apex:inputfield value="{!Trip_Report__c.Campaign__c}" label="Campaign"/>
</apex:pageBlockSection>
<apex:pageBlock title="Attendees">
<apex:pageBlockSection columns="2">
<apex:inputfield value="{!Trip_Report__c.Attendees__c}" label="Client Attendees"/>
<apex:inputfield value="{!Trip_Report__c.PL_Attendees__c}" label="Internal Attendees"/>
</apex:pageBlockSection>
</apex:pageBlock>
<div>
<apex:pageBlock title="Trip Details & Notes">
<apex:tabPanel switchType="client" selectedTab="sch" tabclass="activeTab" inactivetabclass="inactiveTab">
<apex:tab label="Objectives">
<apex:inputfield value="{!Trip_Report__c.Objectives__c}" label="Objectives/Reason For Visit" style="width: 1250px; height: 100px"/>
</apex:tab>
<apex:tab label="Background">
<apex:inputfield value="{!Trip_Report__c.Background__c}" label="Background Information" style="width: 1250px; height: 100px"/>
</apex:tab>
<apex:tab label="Discussions">
<apex:inputfield value="{!Trip_Report__c.Discussion__c}" label="Discussions" style="width: 1250px; height: 100px"/>
</apex:tab>
<apex:tab label="Trip Summary">
<apex:inputfield value="{!Trip_Report__c.Summary__c}" label="Trip Summary" style="width: 1250px; height: 100px"/>
</apex:tab>
<apex:tab label="Actions/Questions">
<apex:inputfield value="{!Trip_Report__c.Actions_Questions__c}" label="Actions/Questions" style="width: 1250px; height: 100px"/>
</apex:tab>
</apex:tabPanel>
</apex:pageBlock>
</div>
</apex:pageBlock>
</apex:form>
</apex:page>
public class VFAttachments {
public Id recordId;
public VFAttachments() {
}
public VFAttachments(ApexPages.StandardController controller) {
this.recordId = (Trip_Report__c)standardController.getRecord().Id;
}
public Attachment attachment {
get {
if (attachment == null)
attachment = new Attachment();
return attachment;
}
set;
}
public PageReference upload() {
attachment.OwnerId = UserInfo.getUserId();
attachment.ParentId = recordId; // the record the file is attached to
// attachment.ParentId = ApexPages.currentPage().getParameters().get('id');
attachment.IsPrivate = true;
try {
insert attachment;
} catch (DMLException e) {
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error uploading attachment'));
return null;
} finally {
attachment = new Attachment();
}
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'Attachment uploaded successfully'));
return null;
}
}
VF Page Below....
<apex:page standardController="Trip_Report__c" >
<style>
.activeTab {background-color: #2ECCFA; color:white;
background-image:none}
.inactiveTab { background-color: lightgrey; color:black;
background-image:none}
</style>
<script>
function confirmSave() {
var isSave = confirm("Your Trip Report has been saved!");
if (isSave) return true;
return false;
}
</script>
<apex:form >
<apex:pageBlock title="Trip Report">
<apex:pageBlockButtons >
<apex:commandButton value="Save As Draft" action="{!save}"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>
<apex:commandButton value="Delete" action="{!delete}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection columns="1">
<apex:inputfield required="true" value="{!Trip_Report__c.Name}" label="Visit"/>
<font style="margin-left:240px" size="0.25" color="blue"> <b> Enter: 'TR'-Company Name-Subject for the Visit</b></font>
<apex:inputfield required="true" value="{!Trip_Report__c.Purpose_of_Visit__c}" label="Purpose Of Visit"/>
<apex:inputfield value="{!Trip_Report__c.Visit_Date__c}" label="Date"/>
<apex:inputfield value="{!Trip_Report__c.Lead_Source__c}" label="Lead Source"/>
<apex:inputfield value="{!Trip_Report__c.Opportunity__c}" label="Opportunity"/>
<apex:inputfield value="{!Trip_Report__c.Campaign__c}" label="Campaign"/>
</apex:pageBlockSection>
<apex:pageBlock title="Attendees">
<apex:pageBlockSection columns="2">
<apex:inputfield value="{!Trip_Report__c.Attendees__c}" label="Client Attendees"/>
<apex:inputfield value="{!Trip_Report__c.PL_Attendees__c}" label="Internal Attendees"/>
</apex:pageBlockSection>
</apex:pageBlock>
<div>
<apex:pageBlock title="Trip Details & Notes">
<apex:tabPanel switchType="client" selectedTab="sch" tabclass="activeTab" inactivetabclass="inactiveTab">
<apex:tab label="Objectives">
<apex:inputfield value="{!Trip_Report__c.Objectives__c}" label="Objectives/Reason For Visit" style="width: 1250px; height: 100px"/>
</apex:tab>
<apex:tab label="Background">
<apex:inputfield value="{!Trip_Report__c.Background__c}" label="Background Information" style="width: 1250px; height: 100px"/>
</apex:tab>
<apex:tab label="Discussions">
<apex:inputfield value="{!Trip_Report__c.Discussion__c}" label="Discussions" style="width: 1250px; height: 100px"/>
</apex:tab>
<apex:tab label="Trip Summary">
<apex:inputfield value="{!Trip_Report__c.Summary__c}" label="Trip Summary" style="width: 1250px; height: 100px"/>
</apex:tab>
<apex:tab label="Actions/Questions">
<apex:inputfield value="{!Trip_Report__c.Actions_Questions__c}" label="Actions/Questions" style="width: 1250px; height: 100px"/>
</apex:tab>
</apex:tabPanel>
</apex:pageBlock>
</div>
</apex:pageBlock>
</apex:form>
</apex:page>
- Patrick Sluck 5
- June 30, 2017
- Like
- 0
- Continue reading or reply
Remove Records From wrapper List
Hi Expert,
Now i am displaying selected records to Pageblock2 . Though selected records are don't need to show in PageBlock1. kindly Check the below Image For information.
**************** Apex *******************
*********************VF Page ***********************
**********Sample output ***********
Special Thanks In Advance !!!!
Regards,
Soundar
Now i am displaying selected records to Pageblock2 . Though selected records are don't need to show in PageBlock1. kindly Check the below Image For information.
**************** Apex *******************
public class OppDisplaySelectedContrl { public List<oppWrapper> listOppWrap{get;set;} Public List<Opportunity> listOfSelectedOpp{get;set;} Public List<Opportunity> listOfSelectedOpp2{get;set;} Set<Integer> st = New Set<Integer>(); public OppDisplaySelectedContrl(){ listoppWrap = new List<oppWrapper>(); searchrecord(); } public void searchrecord(){ listOppWrap.clear(); for(Opportunity opp : [Select id,name,stageName,amount, CloseDate From Opportunity Limit 5]){ listOppWrap.add(New OppWrapper(opp)); System.debug('Opportunity list' + opp ); } } public void addToGrid(){ listOfSelectedOpp = New List<Opportunity>(); listOfSelectedOpp.clear(); for(OppWrapper OppWrapObj : listOppWrap){ if(OppWrapObj.selected == True){ listOfSelectedOpp.add(OppWrapObj.wrapOpp); } } } public void closedWon(){ for(Opportunity opp : listOfSelectedOpp){ opp.StageName = 'Closed Won'; } update listOfSelectedOpp; searchrecord(); } public void closedLost(){ for(Opportunity opp : listOfSelectedOpp){ opp.StageName = 'Closed Lost'; } update listOfSelectedOpp; searchrecord(); } public class OppWrapper{ public boolean selected{get;set;} public Opportunity wrapOpp{get;set;} public OppWrapper(Opportunity opp){ selected = false; wrapOpp = opp; } } }
*********************VF Page ***********************
<apex:page controller="OppDisplaySelectedContrl"> <apex:form > <apex:pageBlock title="Opportunity" id="pb1"> <apex:pageBlockSection title="All Opportunity" columns="1"> <apex:pageBlockTable value="{!listOppWrap}" var="oppWrap" > <apex:column > <!--<apex:inputCheckbox value="Select"/> --> </apex:column> <apex:column headerValue="Select"> <apex:inputCheckbox value="{!oppWrap.selected}" /> </apex:column> <apex:column value="{!oppWrap.wrapOpp.name}"/> <apex:column value="{!oppWrap.wrapOpp.StageName}"/> <apex:column value="{!oppWrap.wrapOpp.closeDate}"/> <apex:column value="{!oppWrap.wrapOpp.amount}"/> </apex:pageBlockTable> </apex:pageBlockSection> <apex:pageBlockButtons > <apex:commandButton value="Add To Grid" action="{!addToGrid}"/> </apex:pageBlockButtons> </apex:pageBlock> <apex:pageBlock title="Selected opportunity" id="pb2"> <apex:pageBlockSection columns="1"> <apex:pageBlockTable value="{!listOfSelectedOpp}" var="selectedOpp" > <apex:column value="{!selectedOpp.name}" headerValue="Opportunity Name"/> <apex:column value="{!selectedOpp.StageName}" headerValue="Stage"/> <apex:column value="{!selectedOpp.closeDate}" headerValue="Closed Date"/> <apex:column value="{!selectedOpp.Amount}" headerValue="Amount"/> </apex:pageBlockTable> </apex:pageBlockSection> <apex:pageBlockButtons > <apex:commandButton value="Closed Won" action="{!closedWon}"/> <apex:commandButton value="Closed Lost" action="{!closedLost}" /> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </apex:page>
**********Sample output ***********
Special Thanks In Advance !!!!
Regards,
Soundar
- Soundar Rajan Ponpandi
- June 30, 2017
- Like
- 0
- Continue reading or reply
Workflow/Validation rule Help
"Customer State" is a field on lead object. The picklist values are CA, NJ,DC, AZ,IL, etc
The requirement is, if CA is selected, 'zipcode' field on lead should have a value '94544'. Similarly if 'NJ' is selected 07102 an so on.
How do i do this? workflow or formula or any easier way?
The requirement is, if CA is selected, 'zipcode' field on lead should have a value '94544'. Similarly if 'NJ' is selected 07102 an so on.
How do i do this? workflow or formula or any easier way?
- Rakesh Kumar 335
- June 29, 2017
- Like
- 0
- Continue reading or reply
I have two name fields name1 and name 2 If name one of any part in name 2 then a check box should be checked.
i have two name fields name1 and name 2
If name one of any part in name 2 then a check box should be checked...
Example
name 1 =HiTech city
Name2 = Hyd city
City is commom word in both
So check box checked automatically
If name one of any part in name 2 then a check box should be checked...
Example
name 1 =HiTech city
Name2 = Hyd city
City is commom word in both
So check box checked automatically
- vijayabhaskarareddy
- February 02, 2018
- Like
- 0
- Continue reading or reply
need help to wrote test class for below code
global class SendQuoteAsEmail { public static List <String> ToAddresses= New List<String>(); webservice static string sendQuoteEmail(String OrderIdFromParam) { try { System.debug('Order ID passed'+OrderIdFromParam); List<order> OrderDetailList = [select id, name,orderNumber,account.Billing_Owner__r.id,Client_Order_Owner__r.Email,Client_Order_Owner__r.id,Quote__c from Order where id=: OrderIdFromParam]; List<order> orderId=new List<order>(); //List<Order> ordersToUpdate=new List<Order>(); List<Quote_Email__c> getCustomSettingValues= new List<Quote_Email__c>([select CC_Email_Address__c, From_Email_Address__c from Quote_Email__c limit 1]); String fromAddress= getCustomSettingValues.get(0).From_Email_Address__c ; //String[] ccaddress = new String[] {getCustomSettingValues.get(0).CC_Email_Address__c}; OrgWideEmailAddress[] owea = [select Id from OrgWideEmailAddress where Address=:fromAddress]; for(Order ord: OrderDetailList ) { ToAddresses.add(ord.Client_Order_Owner__r.Email); orderId.add(ord); } system.debug('email ID:'+ToAddresses); Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); PageReference pdf = Page.QuoteDetailsPage; pdf.getParameters().put('id',OrderIdFromParam); pdf.getParameters().put('param','withprice'); pdf.setRedirect(true); Blob b; // Take the PDF content if(Test.IsRunningTest()) { b=Blob.valueOf('UNIT.TEST'); } else { b = pdf.getContent(); } // Create the email attachment Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment(); efa.setFileName(OrderDetailList[0].orderNumber+'-Quote-DiamondAir International.pdf'); efa.setBody(b); // Construct the list of emails we want to send List<Messaging.SingleEmailMessage> lstMsgs = new List<Messaging.SingleEmailMessage>(); Messaging.SingleEmailMessage msg = new Messaging.SingleEmailMessage(); email.setTemplateId( [select id from EmailTemplate where DeveloperName='Quote_Email_Template'].id ); email.setWhatId(OrderIdFromParam); email.setTargetObjectId(OrderDetailList.get(0).Client_Order_Owner__r.id); email.setToAddresses( ToAddresses); //email.setCcAddresses(ccaddress); email.setFileAttachments(new Messaging.EmailFileAttachment[] {efa}); email.setOrgWideEmailAddressId(owea.get(0).Id); lstMsgs.add(email); String upsertOrder=null; String updateInvoice=null; List<order> OrderToUpdate= new List<Order>(); for(order orderListVal: orderId) { datetime myDateTime = datetime.now(); string mydtstring = mydatetime.format(); orderListVal.Quote_status__c='Quote Sent to Client at '+myDateTime; orderListVal.Quote_Sent__c=true; OrderToUpdate.add(orderListVal); }//end of for try{ update OrderToUpdate; updateInvoice='Pass'; } catch(Exception e) { updateInvoice='Fail'; return 'false'; } if(updateInvoice.equals('Pass')) { List<Messaging.SendEmailResult> results=new List<Messaging.SendEmailResult>(); if(!Test.isRunningTest()) results=Messaging.sendEmail(lstMsgs); if(results.get(0).isSuccess()) return 'true'; else return 'false'; } else return 'false'; }//end of try catch(Exception e) { system.debug('Catch block'+e); return 'false'; } //end of catch }//end of sendInvoiceEmail }//end of class
- vijayabhaskarareddy
- January 02, 2018
- Like
- 0
- Continue reading or reply
action function not working
when we click on command button first execute NoOfPassengersTrueFalse() if it return true show elert message "TRUE"
if it returns false call QuoteAcceptedITpage() method
if it returns false call QuoteAcceptedITpage() method
JS ===== function NoOfPassTrueFalse(PassengersTrueFalse) { var pass= PassengersTrueFalse; if(pass==true) { alert('true') } else{ callApexMethod(); } } ============================================================ <apex:commandlink action="{!NoOfPassengersTrueFalse}" value="Accept" oncomplete=" NoOfPassTrueFalse('{! PassengersTrueFalse}');"/> <apex:actionFunction name="callApexMethod" action="{!QuoteAcceptedITpage}" /> ============================================================================= public boolean NoOfPassengersTrueFalse() { AddPassengerController obj= new AddPassengerController(); PassengersTrueFalse= obj.AddPassengerMethod(); return PassengersTrueFalse; } public pageReference QuoteAcceptedITpage() { Id orderID=Apexpages.currentpage().getParameters().get('orderId'); Order ord= new Order(); ord.Id=orderID; ord.Order_Stage__c='Quote'; ord.Admin_Stage__c='Quote Accepted'; update ord; pageReference pgRef = new pageReference('/apex/ItineraryDetailPage?Id='+itineraryID); pgRef.setRedirect(true); return pgref; } ===========================================
- vijayabhaskarareddy
- December 13, 2017
- Like
- 0
- Continue reading or reply
how to use onclick in vf page
i have two apex methods Ist return tyep boolean and 2nd return type pagereference
now my requirement is when i click on submit first goto boolean function and check true or false
if it is true show eler message else execute 2 nd method which perform update (DML) and return same page
now my requirement is when i click on submit first goto boolean function and check true or false
if it is true show eler message else execute 2 nd method which perform update (DML) and return same page
- vijayabhaskarareddy
- December 13, 2017
- Like
- 0
- Continue reading or reply
attempt to de-reference a null object in salesforce
i have been getting above error when i execute this code in develooper console
List<orderItem> membs1 = [SELECT id FROM OrderItem WHERE orderid ='8017F000000CfJZ']; list <id> opids; for( orderItem OI : membs1) { opids.add(OI.id); } system.debug('orde product ids r =='+ opids);
- vijayabhaskarareddy
- November 18, 2017
- Like
- 0
- Continue reading or reply
- vijayabhaskarareddy
- November 17, 2017
- Like
- 0
- Continue reading or reply
CSV file upload using drag drop and drop
i need help to upload a csv file using drag and drop
- vijayabhaskarareddy
- July 05, 2017
- Like
- 0
- Continue reading or reply
need help creating batch job or scheduled apex
1) Start the batch job/scheduled when the Lead.Owner changes
2) 15 minutes after the lead owner is changed, check if they have created any activity (logged a call). If they have, end the batch. If they haven't, update "Lead.Entropy__c = 1" and continue to step 3.
3) 15 minutes after step 2, check if the lead owner has created any activity (logged a call). If they have, end the batch. If they haven't, update "Lead.Entropy__c = 2" and continue to step 4.
4) 30 minutes after step 3, check if the lead owner has created any activity (logged a call). If they have, end the batch. If they haven't, update "Lead.Entropy__c = 3" and continue to step 5.
5) 15 minutes after step 4, check if the lead owner has created any activity (logged a call). If they have, end the batch. If they haven't, update "Lead.Entropy__c = 4" and end the batch job.
2) 15 minutes after the lead owner is changed, check if they have created any activity (logged a call). If they have, end the batch. If they haven't, update "Lead.Entropy__c = 1" and continue to step 3.
3) 15 minutes after step 2, check if the lead owner has created any activity (logged a call). If they have, end the batch. If they haven't, update "Lead.Entropy__c = 2" and continue to step 4.
4) 30 minutes after step 3, check if the lead owner has created any activity (logged a call). If they have, end the batch. If they haven't, update "Lead.Entropy__c = 3" and continue to step 5.
5) 15 minutes after step 4, check if the lead owner has created any activity (logged a call). If they have, end the batch. If they haven't, update "Lead.Entropy__c = 4" and end the batch job.
- vijayabhaskarareddy
- July 03, 2017
- Like
- 0
- Continue reading or reply
getting error while creating record in lightning component
i m trying to create a record from below code
i m getting error (Action failed: c:createaccount$controller$handleSaveContact [helper.validateContactForm is not a function] Failing descriptor: {c:createaccount$controller$handleSaveContact})
i m getting error (Action failed: c:createaccount$controller$handleSaveContact [helper.validateContactForm is not a function] Failing descriptor: {c:createaccount$controller$handleSaveContact})
createContact.cmp ================== <aura:component implements="flexipage:availableForRecordHome, force:hasRecordId"> <aura:attribute name="newContact" type="Object"/> <aura:attribute name="simpleNewContact" type="Object"/> <aura:attribute name="newContactError" type="String"/> <aura:handler name="init" value="{!this}" action="{!c.doInit}"/> <force:recordData aura:id="contactRecordCreator" layoutType="FULL" targetRecord="{!v.newContact}" targetFields="{!v.simpleNewContact}" targetError="{!v.newContactError}" /> <div class="slds-page-header" role="banner"> <p class="slds-text-heading--label">Create Contact</p> </div> <!-- Display Lightning Data Service errors --> <aura:if isTrue="{!not(empty(v.newContactError))}"> <div class="recordError"> <ui:message title="Error" severity="error" closable="true"> {!v.newContactError} </ui:message> </div> </aura:if> <!-- Display the new contact form --> <div class="slds-form--stacked"> <lightning:input aura:id="contactField" name="firstName" label="First Name" value="{!v.simpleNewContact.FirstName}" required="true"/> <lightning:input aura:id="contactField" name="lastname" label="Last Name" value="{!v.simpleNewContact.LastName}" required="true"/> <lightning:input aura:id="contactField" name="title" label="Title" value="{!v.simpleNewContact.Title}" /> <lightning:button label="Save contact" onclick="{!c.handleSaveContact}" variant="brand" class="slds-m-top--medium"/> </div> </aura:component> ====================== ({ doInit: function(component, event, helper) { // Prepare a new record from template component.find("contactRecordCreator").getNewRecord( "Contact", // sObject type (entityApiName) null, // recordTypeId false, // skip cache? $A.getCallback(function() { var rec = component.get("v.newContact"); var error = component.get("v.newContactError"); if(error || (rec === null)) { console.log("Error initializing record template: " + error); return; } console.log("Record template initialized: " + rec.sobjectType); }) ); }, handleSaveContact: function(component, event, helper) { if(helper.validateContactForm(component)) { component.set("v.simpleNewContact.AccountId", component.get("v.recordId")); component.find("contactRecordCreator").saveRecord(function(saveResult) { if (saveResult.state === "SUCCESS" || saveResult.state === "DRAFT") { // record is saved successfully var resultsToast = $A.get("e.force:showToast"); resultsToast.setParams({ "title": "Saved", "message": "The record was saved." }); resultsToast.fire(); } else if (saveResult.state === "INCOMPLETE") { // handle the incomplete state console.log("User is offline, device doesn't support drafts."); } else if (saveResult.state === "ERROR") { // handle the error state console.log('Problem saving contact, error: ' + JSON.stringify(saveResult.error)); } else { console.log('Unknown problem, state: ' + saveResult.state + ', error: ' + JSON.stringify(saveResult.error)); } }); } } }) ================
- vijayabhaskarareddy
- June 28, 2017
- Like
- 0
- Continue reading or reply
what is my mistake in controller, i am getting error .This page has an error.( You might just need to refresh it. Unknown controller action 'doInit' Failing descriptor: {markup://c:test2}
<aura:component> <aura:attribute name="setMeOnInit" type="String" default="default value" /> <aura:handler name="init" value="{!this}" action="{!c.doInit}"/> <p>This value is set in the controller after the component initializes and before rendering.</p> <p><b>{!v.setMeOnInit}</b></p> </aura:component> ================================ <aura:application > <c:test2/> </aura:application> ============================= ({ doInit: function(cmp) { // Set the attribute value. // You could also fire an event here instead. cmp.set("v.setMeOnInit", "controller init magic!"); } })
- vijayabhaskarareddy
- June 26, 2017
- Like
- 0
- Continue reading or reply
What is the use of <aura:handler name="init" value="{!this}" action="{!c.doInit}"/
What is the use of <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
- vijayabhaskarareddy
- June 26, 2017
- Like
- 1
- Continue reading or reply
tab panel not working properly
<apex:page extensions="Sample4,Sample6" standardController="Account">
<apex:form >
<apex:pageBlock id="details">
<apex:tabPanel switchType="ajax" >
<apex:tab label="Training Cases">
<apex:pageblockTable value="{!memb}" var="m">
<apex:column value="{!m.casenumber}"/>
<apex:column value="{!m.casenumber}"/>
</apex:pageblockTable>
<apex:commandButton value="<<" rerender="details" action="{!beginning}" disabled="{!prev}"/>
<apex:commandButton value="<" rerender="details" action="{!previous}" disabled="{!prev}"/>
<apex:commandButton value=">" rerender="details" action="{!next}" disabled="{!nxt}"/>
<apex:commandButton value=">>" rerender="details" action="{!end}" disabled="{!nxt}"/>
</apex:tab>
<apex:tab label="support">
<apex:pageblockTable value="{!memb6}" var="m6">
<apex:column value="{!m6.casenumber}"/>
</apex:pageblockTable>
<apex:commandButton value="<<" rerender="details" action="{!beginning6}" disabled="{!prev6}"/>
<apex:commandButton value="<" rerender="details" action="{!previous6}" disabled="{!prev6}"/>
<apex:commandButton value=">" rerender="details" action="{!next6}" disabled="{!nxt6}"/>
<apex:commandButton value=">>" rerender="details" action="{!end6}" disabled="{!nxt6}"/>
</apex:tab>
</apex:tabPanel>
</apex:pageBlock>
</apex:form>
</apex:page>
<apex:form >
<apex:pageBlock id="details">
<apex:tabPanel switchType="ajax" >
<apex:tab label="Training Cases">
<apex:pageblockTable value="{!memb}" var="m">
<apex:column value="{!m.casenumber}"/>
<apex:column value="{!m.casenumber}"/>
</apex:pageblockTable>
<apex:commandButton value="<<" rerender="details" action="{!beginning}" disabled="{!prev}"/>
<apex:commandButton value="<" rerender="details" action="{!previous}" disabled="{!prev}"/>
<apex:commandButton value=">" rerender="details" action="{!next}" disabled="{!nxt}"/>
<apex:commandButton value=">>" rerender="details" action="{!end}" disabled="{!nxt}"/>
</apex:tab>
<apex:tab label="support">
<apex:pageblockTable value="{!memb6}" var="m6">
<apex:column value="{!m6.casenumber}"/>
</apex:pageblockTable>
<apex:commandButton value="<<" rerender="details" action="{!beginning6}" disabled="{!prev6}"/>
<apex:commandButton value="<" rerender="details" action="{!previous6}" disabled="{!prev6}"/>
<apex:commandButton value=">" rerender="details" action="{!next6}" disabled="{!nxt6}"/>
<apex:commandButton value=">>" rerender="details" action="{!end6}" disabled="{!nxt6}"/>
</apex:tab>
</apex:tabPanel>
</apex:pageBlock>
</apex:form>
</apex:page>
- vijayabhaskarareddy
- June 02, 2017
- Like
- 0
- Continue reading or reply
Error: Compile Error: line 15:42 no viable alternative at character '‘' at line 15 column 42
can anyone help me on this task .
public with sharing class TrainingCasefilter {
public id accRecId;
private integer totalRecs = 0;
private integer OffsetSize = 0;
private integer LimitSize= 10;
public TrainingCasefilter(ApexPages.StandardController controller) {
accRecId = [select id from account where id = :ApexPages.currentPage().getParameters().get('id')].id;
totalRecs = [select count() from case where accountID= :accRecId];
}
List<case> trainingCases;
public List<case> getTrainingCases() {
if(accRecId != null) {
trainingCases= [SELECT Id, Contact.name, recordtype.id, casenumber, subject, priority, createddate, status, createdbyid
FROM Case
WHERE RecordType.Name ='Training' AND account.id=:accRecId LIMIT :LimitSize OFFSET :OffsetSize];
}
return trainingCases;
}
public void FirstPage()
{
OffsetSize = 0;
}
public void previous()
{
OffsetSize = OffsetSize – LimitSize;
}public void next()
{
OffsetSize = OffsetSize + LimitSize;
}public void LastPage()
{
OffsetSize = totalrecs – math.mod(totalRecs,LimitSize);
}
public boolean getprev()
{
if(OffsetSize == 0)
return true;
else
return false;
}
public boolean getnxt()
{
if((OffsetSize + LimitSize) > totalRecs)
return true;
else
return false;
}
}
public with sharing class TrainingCasefilter {
public id accRecId;
private integer totalRecs = 0;
private integer OffsetSize = 0;
private integer LimitSize= 10;
public TrainingCasefilter(ApexPages.StandardController controller) {
accRecId = [select id from account where id = :ApexPages.currentPage().getParameters().get('id')].id;
totalRecs = [select count() from case where accountID= :accRecId];
}
List<case> trainingCases;
public List<case> getTrainingCases() {
if(accRecId != null) {
trainingCases= [SELECT Id, Contact.name, recordtype.id, casenumber, subject, priority, createddate, status, createdbyid
FROM Case
WHERE RecordType.Name ='Training' AND account.id=:accRecId LIMIT :LimitSize OFFSET :OffsetSize];
}
return trainingCases;
}
public void FirstPage()
{
OffsetSize = 0;
}
public void previous()
{
OffsetSize = OffsetSize – LimitSize;
}public void next()
{
OffsetSize = OffsetSize + LimitSize;
}public void LastPage()
{
OffsetSize = totalrecs – math.mod(totalRecs,LimitSize);
}
public boolean getprev()
{
if(OffsetSize == 0)
return true;
else
return false;
}
public boolean getnxt()
{
if((OffsetSize + LimitSize) > totalRecs)
return true;
else
return false;
}
}
- vijayabhaskarareddy
- June 01, 2017
- Like
- 0
- Continue reading or reply
how to redirect from a vf page to case input page with record type A
.
i have a case object with two record types A and B
i need a vf page with two buttons
when i click on Button1 it should redirect to inputpage of new case with record type A
similarly
when i click on Button2 it should redirect to inputpage of new case with record type B
i have a case object with two record types A and B
i need a vf page with two buttons
when i click on Button1 it should redirect to inputpage of new case with record type A
similarly
when i click on Button2 it should redirect to inputpage of new case with record type B
- vijayabhaskarareddy
- May 31, 2017
- Like
- 0
- Continue reading or reply
how to display cases on related list of account page in the form of two pageblock tables
I have two record types A and B on case object
Now I want to display cases on related list of account page in the form of two pageblock tables
1st pageblock table should be cases with record type A
2nd pageblock table should be cases with record type B
- vijayabhaskarareddy
- May 30, 2017
- Like
- 0
- Continue reading or reply
How to create a case automatically from live chat
How to create a case automatically from live chat
- vijayabhaskarareddy
- April 30, 2017
- Like
- 0
- Continue reading or reply
What is the use of <aura:handler name="init" value="{!this}" action="{!c.doInit}"/
What is the use of <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
- vijayabhaskarareddy
- June 26, 2017
- Like
- 1
- Continue reading or reply
lightning csv uploader to create accounts
Hi Team,
trying to deisgn CSV uploder in lightning component and need to display in table after uploading CSV file and on click on save button need to save account reords in data base.
Using these contoroller to create account.. help me to design lightning component
trying to deisgn CSV uploder in lightning component and need to display in table after uploading CSV file and on click on save button need to save account reords in data base.
public class PMO_CsvUploaderController { public Blob csvFileBody{get;set;} public string csvAsString{get;set;} public String[] csvFileLines{get;set;} public List<Account> Acclist{get;set;} public PMO_CsvUploaderController(){ csvFileLines = new String[]{}; Acclist = New List<Account>(); } public void importCSVFile(){ try{ csvAsString = csvFileBody.toString(); csvFileLines = csvAsString.split('\n'); for(Integer i=1;i<csvFileLines.size();i++){ Account couObj = new Account(); string[] csvRecordData = csvFileLines[i].split(','); couObj.name = csvRecordData[1] ; couObj.AccountNumber = csvRecordData[2]; couObj.Phone = csvRecordData[3]; couObj.Rating = csvRecordData[4]; /* String temp_fees=csvRecordData[3]; couObj.Course_fees__c = Decimal.valueOf(temp_fees); String temp_date=csvRecordData[4]; couObj.Course_Date__c = Date.parse(temp_date); */ Acclist.add(couObj); } insert Acclist; } catch (Exception e){ System.debug(e.getCause()); ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.ERROR,'An error has occured while importing data. Please make sure input csv file is correct'); ApexPages.addMessage(errorMessage); } } }
Using these contoroller to create account.. help me to design lightning component
- bhanu_prakash
- January 04, 2019
- Like
- 0
- Continue reading or reply
limit aura iteration
Hi everyone.
I hope you can help me. I'm working with a lightning component which has an aura iteration with another component inside.
My code:
I would like to know if there is any way to limit the number of records displayed and make a kind of button to load more or show more like in list views or related lists because when I have very few records I have no problem but when I have many records I get a very long vertical scroll and this is I want to avoid.
Regards
I hope you can help me. I'm working with a lightning component which has an aura iteration with another component inside.
My code:
<aura:iteration var="event" items="{!v.events}"> <c:LC_Events event="{!event}"/> </aura:iteration>
I would like to know if there is any way to limit the number of records displayed and make a kind of button to load more or show more like in list views or related lists because when I have very few records I have no problem but when I have many records I get a very long vertical scroll and this is I want to avoid.
Regards
- Javier Castro
- December 27, 2018
- Like
- 0
- Continue reading or reply
hi, i want to write a trigger to update opportunity currency same as the opportunity owner currency
Hi
The opportunity currency should be the same as opportunity owner currency. I have to write a trigger for it. Can anyone help me with it.
The opportunity currency should be the same as opportunity owner currency. I have to write a trigger for it. Can anyone help me with it.
- Arundhati Deb
- December 12, 2018
- Like
- 0
- Continue reading or reply
hi, i want to write a trigger to update opportunity currency same as the opportunity owner currency in before insert.
Hi
I have a scenario where the account currency and opportunity currency can be different. The opportunity currency should be the same as opportunity owner currency. I have to write a trigger for it. Can anyone help me with it.
Highly appreciated.
I have a scenario where the account currency and opportunity currency can be different. The opportunity currency should be the same as opportunity owner currency. I have to write a trigger for it. Can anyone help me with it.
Highly appreciated.
- Arundhati Deb
- December 12, 2018
- Like
- 1
- Continue reading or reply
need help to wrote test class for below code
global class SendQuoteAsEmail { public static List <String> ToAddresses= New List<String>(); webservice static string sendQuoteEmail(String OrderIdFromParam) { try { System.debug('Order ID passed'+OrderIdFromParam); List<order> OrderDetailList = [select id, name,orderNumber,account.Billing_Owner__r.id,Client_Order_Owner__r.Email,Client_Order_Owner__r.id,Quote__c from Order where id=: OrderIdFromParam]; List<order> orderId=new List<order>(); //List<Order> ordersToUpdate=new List<Order>(); List<Quote_Email__c> getCustomSettingValues= new List<Quote_Email__c>([select CC_Email_Address__c, From_Email_Address__c from Quote_Email__c limit 1]); String fromAddress= getCustomSettingValues.get(0).From_Email_Address__c ; //String[] ccaddress = new String[] {getCustomSettingValues.get(0).CC_Email_Address__c}; OrgWideEmailAddress[] owea = [select Id from OrgWideEmailAddress where Address=:fromAddress]; for(Order ord: OrderDetailList ) { ToAddresses.add(ord.Client_Order_Owner__r.Email); orderId.add(ord); } system.debug('email ID:'+ToAddresses); Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); PageReference pdf = Page.QuoteDetailsPage; pdf.getParameters().put('id',OrderIdFromParam); pdf.getParameters().put('param','withprice'); pdf.setRedirect(true); Blob b; // Take the PDF content if(Test.IsRunningTest()) { b=Blob.valueOf('UNIT.TEST'); } else { b = pdf.getContent(); } // Create the email attachment Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment(); efa.setFileName(OrderDetailList[0].orderNumber+'-Quote-DiamondAir International.pdf'); efa.setBody(b); // Construct the list of emails we want to send List<Messaging.SingleEmailMessage> lstMsgs = new List<Messaging.SingleEmailMessage>(); Messaging.SingleEmailMessage msg = new Messaging.SingleEmailMessage(); email.setTemplateId( [select id from EmailTemplate where DeveloperName='Quote_Email_Template'].id ); email.setWhatId(OrderIdFromParam); email.setTargetObjectId(OrderDetailList.get(0).Client_Order_Owner__r.id); email.setToAddresses( ToAddresses); //email.setCcAddresses(ccaddress); email.setFileAttachments(new Messaging.EmailFileAttachment[] {efa}); email.setOrgWideEmailAddressId(owea.get(0).Id); lstMsgs.add(email); String upsertOrder=null; String updateInvoice=null; List<order> OrderToUpdate= new List<Order>(); for(order orderListVal: orderId) { datetime myDateTime = datetime.now(); string mydtstring = mydatetime.format(); orderListVal.Quote_status__c='Quote Sent to Client at '+myDateTime; orderListVal.Quote_Sent__c=true; OrderToUpdate.add(orderListVal); }//end of for try{ update OrderToUpdate; updateInvoice='Pass'; } catch(Exception e) { updateInvoice='Fail'; return 'false'; } if(updateInvoice.equals('Pass')) { List<Messaging.SendEmailResult> results=new List<Messaging.SendEmailResult>(); if(!Test.isRunningTest()) results=Messaging.sendEmail(lstMsgs); if(results.get(0).isSuccess()) return 'true'; else return 'false'; } else return 'false'; }//end of try catch(Exception e) { system.debug('Catch block'+e); return 'false'; } //end of catch }//end of sendInvoiceEmail }//end of class
- vijayabhaskarareddy
- January 02, 2018
- Like
- 0
- Continue reading or reply
action function not working
when we click on command button first execute NoOfPassengersTrueFalse() if it return true show elert message "TRUE"
if it returns false call QuoteAcceptedITpage() method
if it returns false call QuoteAcceptedITpage() method
JS ===== function NoOfPassTrueFalse(PassengersTrueFalse) { var pass= PassengersTrueFalse; if(pass==true) { alert('true') } else{ callApexMethod(); } } ============================================================ <apex:commandlink action="{!NoOfPassengersTrueFalse}" value="Accept" oncomplete=" NoOfPassTrueFalse('{! PassengersTrueFalse}');"/> <apex:actionFunction name="callApexMethod" action="{!QuoteAcceptedITpage}" /> ============================================================================= public boolean NoOfPassengersTrueFalse() { AddPassengerController obj= new AddPassengerController(); PassengersTrueFalse= obj.AddPassengerMethod(); return PassengersTrueFalse; } public pageReference QuoteAcceptedITpage() { Id orderID=Apexpages.currentpage().getParameters().get('orderId'); Order ord= new Order(); ord.Id=orderID; ord.Order_Stage__c='Quote'; ord.Admin_Stage__c='Quote Accepted'; update ord; pageReference pgRef = new pageReference('/apex/ItineraryDetailPage?Id='+itineraryID); pgRef.setRedirect(true); return pgref; } ===========================================
- vijayabhaskarareddy
- December 13, 2017
- Like
- 0
- Continue reading or reply
6. difference b/w system.assert and system.assertEquals...?
6. difference b/w system.assert and system.assertEquals...?
- rama krishna 181
- November 20, 2017
- Like
- 0
- Continue reading or reply
5. is it possible to send email in triggers..?
5. is it possible to send email in triggers..?
- rama krishna 181
- November 20, 2017
- Like
- 0
- Continue reading or reply
Error while Generating Apex Code from Partner WSDL
I'm getting an error while trying to generate Apex code from Partner WSDL file.
~Apex Generation Failed
Unsupported schema type: {http://www.w3.org/2001/XMLSchema}anyType
How to overcome this error?
~Apex Generation Failed
Unsupported schema type: {http://www.w3.org/2001/XMLSchema}anyType
How to overcome this error?
- RJ12
- July 17, 2017
- Like
- 0
- Continue reading or reply
obtain who was the previous last modified user in salesforce
Hi,
We have accidentally made some record update in our org, but we now want to know who was the last modified user before we made the changes.
Is there a way to get this in Salesforce?
Thanks.
We have accidentally made some record update in our org, but we now want to know who was the last modified user before we made the changes.
Is there a way to get this in Salesforce?
Thanks.
- Bhavana
- July 06, 2017
- Like
- 0
- Continue reading or reply
CSV file upload using drag drop and drop
i need help to upload a csv file using drag and drop
- vijayabhaskarareddy
- July 05, 2017
- Like
- 0
- Continue reading or reply
errors are occurred during creation of a class
hi..! friends
if I am trying to save an apex class, I am getting so many asci code errors,
here is my program and related errors:
and my friend saved this program and he did not get any error when he was writing this.but i have got these so many times.
and when i was writing this program, i did not get any error only whenever i am trying to copy any program, i will get these errors :
here is the common error:
'invalid identifier ' public list'.Apex identifiers must start with an ASCII letter (a-z or A-Z) followed by any number of ASCII letters(a-z or A-Z),digits(0-9),'$','_',or unicode characters from U+0080 to U+FFFE-'.
if I am trying to save an apex class, I am getting so many asci code errors,
here is my program and related errors:
and my friend saved this program and he did not get any error when he was writing this.but i have got these so many times.
and when i was writing this program, i did not get any error only whenever i am trying to copy any program, i will get these errors :
here is the common error:
'invalid identifier ' public list'.Apex identifiers must start with an ASCII letter (a-z or A-Z) followed by any number of ASCII letters(a-z or A-Z),digits(0-9),'$','_',or unicode characters from U+0080 to U+FFFE-'.
- pradeep kumar s 1
- July 04, 2017
- Like
- 0
- Continue reading or reply
oppurtunity vf page
hi All,
I have made a oppurtunity page as vf page , but it is not responsive in simulator, all the fields are not aligned,
just see the effect.
i have bootstrap also,
plz reply ,
I have made a oppurtunity page as vf page , but it is not responsive in simulator, all the fields are not aligned,
just see the effect.
i have bootstrap also,
plz reply ,
- Aurora Ganguly 10
- July 04, 2017
- Like
- 0
- Continue reading or reply
how to upload data to multiple objects from csv file through custom visualforcepage
hai
please tell me the code to insert records related to multiple objects with the data from csv file using custom visualforce upload page, you can see preview of my page attached here
Thanks in advance
please tell me the code to insert records related to multiple objects with the data from csv file using custom visualforce upload page, you can see preview of my page attached here
Thanks in advance
- bet account
- July 03, 2017
- Like
- 0
- Continue reading or reply