-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
11Questions
-
7Replies
Lightning:Select default value is coming while we editing the record.
I created Picklist by using Lightning:Select but while i'm editing the record default value is coming not selected one, How to avoid that.
Can u please find attachments and provide some good solution for that.
Thanks in Advance,
Anji.

Can u please find attachments and provide some good solution for that.
Thanks in Advance,
Anji.
-
- anji punyamanthula
- January 29, 2019
- Like
- 0
- Continue reading or reply
Lightning:input values are not getting refreshed when we are cancel it
Component-Markup:
<div class="slds-form-element__control">
<div class="uiInput uiInputDate uiInput--default uiInput--input uiInput--datetime">
<label class="label inputLabel uiLabel-left form-element__label uiLabel">
<span class="">{!v.customField.musqotmpm__startdate__c.Label}</span>
<span class="required ">*</span>
<aura:if isTrue="{!!empty(v.customField.musqotmpm__startdate__c.InlineHelpText)}">
<lightning:helptext content="{!v.customField.musqotmpm__startdate__c.InlineHelpText}" />
</aura:if>
</label>
<lightning:input aura:id="date-StartDate" type="date" name="" label="" class="ltng-label-hide" value="{!v.sObject.Musqotmpm__StartDate__c}" onchange="{!c.handlePeriod}" />
</div>
</div>
Component:Js:
closeModal : function(component, event, helper) {
component.set("v.hasErrors", false);
$A.get('e.force:refreshView').fire();
//$A.get("e.force:closeQuickAction").fire();
//helper.readCustomField(component, event, helper);
//document.location.reload(true);
helper.hideModal(component, event, helper);
//component.set('v.sObject', {});
if(!component.get('v.fromPlan')){
window.history.back();
}
},
<div class="slds-form-element__control">
<div class="uiInput uiInputDate uiInput--default uiInput--input uiInput--datetime">
<label class="label inputLabel uiLabel-left form-element__label uiLabel">
<span class="">{!v.customField.musqotmpm__startdate__c.Label}</span>
<span class="required ">*</span>
<aura:if isTrue="{!!empty(v.customField.musqotmpm__startdate__c.InlineHelpText)}">
<lightning:helptext content="{!v.customField.musqotmpm__startdate__c.InlineHelpText}" />
</aura:if>
</label>
<lightning:input aura:id="date-StartDate" type="date" name="" label="" class="ltng-label-hide" value="{!v.sObject.Musqotmpm__StartDate__c}" onchange="{!c.handlePeriod}" />
</div>
</div>
Component:Js:
closeModal : function(component, event, helper) {
component.set("v.hasErrors", false);
$A.get('e.force:refreshView').fire();
//$A.get("e.force:closeQuickAction").fire();
//helper.readCustomField(component, event, helper);
//document.location.reload(true);
helper.hideModal(component, event, helper);
//component.set('v.sObject', {});
if(!component.get('v.fromPlan')){
window.history.back();
}
},
-
- anji punyamanthula
- January 20, 2019
- Like
- 0
- Continue reading or reply
I want to invoke update Class of Map in trigger, can any one let me know how to do that
I want to invoke update Class of Map in trigger, can any one let me know how to do I'm attaching my controller below
public class Map_Acc_Con_upp_Ex1 {
public Static void Afterupdate(Map<Id,Account> accs){
List<Account> accounts=accs.values();
Set<Id> acids=accs.keyset();
List<Contact> contacts=new List<Contact>();
List<contact> cons=[select LastName,phone,AccountId from Contact where Accountid in:acids];
for(Contact c:cons){
c.phone=c.Account.Phone;
contacts.add(c);
}
update contacts;
}
}
public class Map_Acc_Con_upp_Ex1 {
public Static void Afterupdate(Map<Id,Account> accs){
List<Account> accounts=accs.values();
Set<Id> acids=accs.keyset();
List<Contact> contacts=new List<Contact>();
List<contact> cons=[select LastName,phone,AccountId from Contact where Accountid in:acids];
for(Contact c:cons){
c.phone=c.Account.Phone;
contacts.add(c);
}
update contacts;
}
}
-
- anji punyamanthula
- June 14, 2018
- Like
- 0
- Continue reading or reply
how to assign records to different users
I have 3 users i want to fetch 10 records from Account object and assign first 3 records to first user next 3 records 2nd user another 3 records to 3rd user and again it will go to 1st user to assign another record how to do that can any one help me in that.
my code is below
batch class:
global class Batch_Example_3 implements Database.Batchable<sobject>,Database.Stateful {
global Static Integer count;
global Database.QueryLocator Start(Database.BatchableContext bc){
String s='select name,ownerid from Account limit 10';
return database.getQueryLocator(s);
}
global void execute(Database.BatchableContext bc,List<Account> accs){
count=0;
List<User> myuser=[select id from user limit 3];
for(user u:myuser){
for(Account a:accs){
a.OwnerId=u.id;
count+=1;
update a;
}
}
//update accs;
}
global void finish(Database.BatchableContext bc){
}
}
execution:
Batch_Example_3 ba=new Batch_Example_3();
Id JobId=database.executeBatch(ba,1);
my code is below
batch class:
global class Batch_Example_3 implements Database.Batchable<sobject>,Database.Stateful {
global Static Integer count;
global Database.QueryLocator Start(Database.BatchableContext bc){
String s='select name,ownerid from Account limit 10';
return database.getQueryLocator(s);
}
global void execute(Database.BatchableContext bc,List<Account> accs){
count=0;
List<User> myuser=[select id from user limit 3];
for(user u:myuser){
for(Account a:accs){
a.OwnerId=u.id;
count+=1;
update a;
}
}
//update accs;
}
global void finish(Database.BatchableContext bc){
}
}
execution:
Batch_Example_3 ba=new Batch_Example_3();
Id JobId=database.executeBatch(ba,1);
-
- anji punyamanthula
- April 06, 2018
- Like
- 0
- Continue reading or reply
-
- anji punyamanthula
- January 03, 2018
- Like
- 0
- Continue reading or reply
i'm trying parsneing the xml its giving child elements but not get geting child of children below is the code check any one and help me in that
public class XML_Example_4 {
public String result {set;get;}
public String parseText {set;get;}
public void parse(){
DOM.Document doc=new DOM.Document();
doc.load(parseText);
DOM.XMLNode root=doc.getRootElement();
result=root.getName();
List<DOM.XMLNode> childs= root.getChildElements();
for(DOM.XMLNode c:childs){
result=result+'\n'+c.getName()+' :'+c.getText();
if(c.getNamespace()=='Std'){
list<DOM.XMLNode> root1=c.getChildren();
for(DOM.XMLNode c1:root1){
result=result+c1.getName()+' :'+c1.getText();
}
}
System.debug('result1'+c.getChildren());
}
}
}
i'm passing this string
<?xml version="1.0" encoding="UTF-8"?><as:name xmlns:as="capital"><lastname>anji</lastname><Firstname>punyamanthula</Firstname><age>24</age><Student name="raju" Age="30" xmlns:std="capital" /></as:name>
public String result {set;get;}
public String parseText {set;get;}
public void parse(){
DOM.Document doc=new DOM.Document();
doc.load(parseText);
DOM.XMLNode root=doc.getRootElement();
result=root.getName();
List<DOM.XMLNode> childs= root.getChildElements();
for(DOM.XMLNode c:childs){
result=result+'\n'+c.getName()+' :'+c.getText();
if(c.getNamespace()=='Std'){
list<DOM.XMLNode> root1=c.getChildren();
for(DOM.XMLNode c1:root1){
result=result+c1.getName()+' :'+c1.getText();
}
}
System.debug('result1'+c.getChildren());
}
}
}
i'm passing this string
<?xml version="1.0" encoding="UTF-8"?><as:name xmlns:as="capital"><lastname>anji</lastname><Firstname>punyamanthula</Firstname><age>24</age><Student name="raju" Age="30" xmlns:std="capital" /></as:name>
-
- anji punyamanthula
- December 30, 2017
- Like
- 0
- Continue reading or reply
I want to sum of all the opprtunities amounts and display on Account object how to do that can any help me in that
I tried below code but i'm not getting o/p
Apex trigger:
trigger Rollup_Acc on Opportunity (After insert,After update,After delete,after undelete) {
if(trigger.isinsert && trigger.isupdate && trigger.isdelete && trigger.isundelete){
List<Account> accs=new List<Account>();
Set<Id> ids=new Set<Id>();
for(opportunity o:trigger.new){
ids.add(o.AccountId);
}
decimal sum;
for(Account acc :[select id,name,Amount__c,(select id,name,amount from opportunities ) from Account where id =:ids]){
sum=0;
for(opportunity op:acc.opportunities){
sum+=op.Amount;
}
acc.AnnualRevenue=sum;
accs.add(acc);
}
update accs;
}
}
Apex trigger:
trigger Rollup_Acc on Opportunity (After insert,After update,After delete,after undelete) {
if(trigger.isinsert && trigger.isupdate && trigger.isdelete && trigger.isundelete){
List<Account> accs=new List<Account>();
Set<Id> ids=new Set<Id>();
for(opportunity o:trigger.new){
ids.add(o.AccountId);
}
decimal sum;
for(Account acc :[select id,name,Amount__c,(select id,name,amount from opportunities ) from Account where id =:ids]){
sum=0;
for(opportunity op:acc.opportunities){
sum+=op.Amount;
}
acc.AnnualRevenue=sum;
accs.add(acc);
}
update accs;
}
}
-
- anji punyamanthula
- December 28, 2017
- Like
- 0
- Continue reading or reply
If I try to create Contact record without Account Id then it has to throw an error by using trigger hoe to do that
Below Example after taking Account als its throwing same error where i'm wrong let me know any one help in that
trigger con_accname_error on Contact (before insert,before update) {
for(contact c:trigger.new){
if(c.Account==null){
c.addError('pl enter account name');
}
}
}
trigger con_accname_error on Contact (before insert,before update) {
for(contact c:trigger.new){
if(c.Account==null){
c.addError('pl enter account name');
}
}
}
-
- anji punyamanthula
- December 25, 2017
- Like
- 0
- Continue reading or reply
Lightning:input values are not getting refreshed when we are cancel it
Component-Markup:
<div class="slds-form-element__control">
<div class="uiInput uiInputDate uiInput--default uiInput--input uiInput--datetime">
<label class="label inputLabel uiLabel-left form-element__label uiLabel">
<span class="">{!v.customField.musqotmpm__startdate__c.Label}</span>
<span class="required ">*</span>
<aura:if isTrue="{!!empty(v.customField.musqotmpm__startdate__c.InlineHelpText)}">
<lightning:helptext content="{!v.customField.musqotmpm__startdate__c.InlineHelpText}" />
</aura:if>
</label>
<lightning:input aura:id="date-StartDate" type="date" name="" label="" class="ltng-label-hide" value="{!v.sObject.Musqotmpm__StartDate__c}" onchange="{!c.handlePeriod}" />
</div>
</div>
Component:Js:
closeModal : function(component, event, helper) {
component.set("v.hasErrors", false);
$A.get('e.force:refreshView').fire();
//$A.get("e.force:closeQuickAction").fire();
//helper.readCustomField(component, event, helper);
//document.location.reload(true);
helper.hideModal(component, event, helper);
//component.set('v.sObject', {});
if(!component.get('v.fromPlan')){
window.history.back();
}
},
<div class="slds-form-element__control">
<div class="uiInput uiInputDate uiInput--default uiInput--input uiInput--datetime">
<label class="label inputLabel uiLabel-left form-element__label uiLabel">
<span class="">{!v.customField.musqotmpm__startdate__c.Label}</span>
<span class="required ">*</span>
<aura:if isTrue="{!!empty(v.customField.musqotmpm__startdate__c.InlineHelpText)}">
<lightning:helptext content="{!v.customField.musqotmpm__startdate__c.InlineHelpText}" />
</aura:if>
</label>
<lightning:input aura:id="date-StartDate" type="date" name="" label="" class="ltng-label-hide" value="{!v.sObject.Musqotmpm__StartDate__c}" onchange="{!c.handlePeriod}" />
</div>
</div>
Component:Js:
closeModal : function(component, event, helper) {
component.set("v.hasErrors", false);
$A.get('e.force:refreshView').fire();
//$A.get("e.force:closeQuickAction").fire();
//helper.readCustomField(component, event, helper);
//document.location.reload(true);
helper.hideModal(component, event, helper);
//component.set('v.sObject', {});
if(!component.get('v.fromPlan')){
window.history.back();
}
},
- anji punyamanthula
- January 20, 2019
- Like
- 0
- Continue reading or reply
- anji punyamanthula
- January 03, 2018
- Like
- 0
- Continue reading or reply
I want to sum of all the opprtunities amounts and display on Account object how to do that can any help me in that
I tried below code but i'm not getting o/p
Apex trigger:
trigger Rollup_Acc on Opportunity (After insert,After update,After delete,after undelete) {
if(trigger.isinsert && trigger.isupdate && trigger.isdelete && trigger.isundelete){
List<Account> accs=new List<Account>();
Set<Id> ids=new Set<Id>();
for(opportunity o:trigger.new){
ids.add(o.AccountId);
}
decimal sum;
for(Account acc :[select id,name,Amount__c,(select id,name,amount from opportunities ) from Account where id =:ids]){
sum=0;
for(opportunity op:acc.opportunities){
sum+=op.Amount;
}
acc.AnnualRevenue=sum;
accs.add(acc);
}
update accs;
}
}
Apex trigger:
trigger Rollup_Acc on Opportunity (After insert,After update,After delete,after undelete) {
if(trigger.isinsert && trigger.isupdate && trigger.isdelete && trigger.isundelete){
List<Account> accs=new List<Account>();
Set<Id> ids=new Set<Id>();
for(opportunity o:trigger.new){
ids.add(o.AccountId);
}
decimal sum;
for(Account acc :[select id,name,Amount__c,(select id,name,amount from opportunities ) from Account where id =:ids]){
sum=0;
for(opportunity op:acc.opportunities){
sum+=op.Amount;
}
acc.AnnualRevenue=sum;
accs.add(acc);
}
update accs;
}
}
- anji punyamanthula
- December 28, 2017
- Like
- 0
- Continue reading or reply
If I try to create Contact record without Account Id then it has to throw an error by using trigger hoe to do that
Below Example after taking Account als its throwing same error where i'm wrong let me know any one help in that
trigger con_accname_error on Contact (before insert,before update) {
for(contact c:trigger.new){
if(c.Account==null){
c.addError('pl enter account name');
}
}
}
trigger con_accname_error on Contact (before insert,before update) {
for(contact c:trigger.new){
if(c.Account==null){
c.addError('pl enter account name');
}
}
}
- anji punyamanthula
- December 25, 2017
- Like
- 0
- Continue reading or reply