-
ChatterFeed
-
0Best Answers
-
2Likes Received
-
0Likes Given
-
12Questions
-
6Replies
Hi all I am unable to delete a package.Here is the problem that is occuring Error
Problems
Component Type Name Problem
VisualForce Page UserGuide Component is in use by another component in your organization. Charket_APIs
-
- Abhishek Purohit
- December 13, 2016
- Like
- 0
- Continue reading or reply
I am getting this error while using the Data Loader As FATAL ERROR System.Exception duplicate id in List.There is an error occuring in updateField Kindly help
if(Trigger.isBefore)
{
if(Trigger.isInsert || Trigger.isUpdate)
{
ShippingAddress.shipBillAddress(Trigger.New);
}
}
if(Trigger.isAfter)
{
if(Trigger.isInsert)
{
ShippingAddress.insertRecord(Trigger.New);
}
if(Trigger.isUpdate)
{
ShippingAddress.updateField(Trigger.New);
}
}
}
This is my Helper Class
public class ShippingAddress{
public static void shipBillAddress(List<Account> accountObject){
for(Account account:accountObject){
account.ShippingStreet=account.BillingStreet;
account.ShippingCountry=account.BillingCountry;
account.ShippingCity=account.BillingCity;
account.ShippingState=account.BillingState;
}
}
public static void updateField(List<Account> accountObject){
system.debug('Account List'+accountObject);
Set<Id> setOfAccountIds=new Set<Id>();
for(Account account:accountObject)
{
setOfAccountIds.add(account.id);
}
List<Contact> listOfContact=new List<Contact>([Select Id,AccountId FROM Contact WHERE AccountId IN:setOfAccountIds]);
List<Contact> listOfUpdatedContact=new List<Contact>();
for(Account accountOfObject:accountObject)
{
for(Contact contactOfObject:listOfContact)
{
contactOfObject.Phone=accountOfObject.Phone;
listOfUpdatedContact.add(contactOfObject);
}
}
update listOfUpdatedContact;
}
public static void insertRecord(List<Account> accountObject){
List<Contact> contactList=new List<Contact>();
for(Account account:accountObject)
{
Contact contactObject = new Contact();
contactObject.accountId=account.Id;
contactObject.LastName=account.name;
contactObject.Phone=account.Phone;
contactList.add(contactObject);
}
insert contactList;
}
}
-
- Abhishek Purohit
- December 12, 2016
- Like
- 0
- Continue reading or reply
Now here is the question..I need to create an after update.Also trying for an Helper class Kindly guide.
trigger ShippingBillingAddress on Account (before insert,before update,after insert,after update) { if(Trigger.isBefore) { for(Account accountList:Trigger.New) { if(Trigger.isInsert) { accountList.ShippingStreet=accountList.BillingStreet; accountList.ShippingCountry=accountList.BillingCountry; accountList.ShippingCity=accountList.BillingCity; accountList.ShippingState=accountList.BillingState; } if(Trigger.isUpdate) { accountList.ShippingStreet=accountList.BillingStreet; accountList.ShippingCountry=accountList.BillingCountry; accountList.ShippingCity=accountList.BillingCity; accountList.ShippingState=accountList.BillingState; } } } if(Trigger.IsAfter) { List<Contact> contactCreate=new List<Contact>(); for(Account accountList2:Trigger.New) { if(Trigger.IsInsert) { Contact contactrecordCreate=new Contact(); contactrecordCreate.accountId=accountList2.Id; contactrecordCreate.LastName=accountList2.Name; contactrecordCreate.Phone=accountList2.Phone; contactCreate.add(contactrecordCreate); } insert contactCreate; } } }
-
- Abhishek Purohit
- December 08, 2016
- Like
- 0
- Continue reading or reply
I just started with apex triggers directly..I Want to know how can I write a Helper class. Please help
trigger OpportunityCreator on Account (after insert) { if(Trigger.isInsert) { List<Opportunity> oCreate=new List<Opportunity>(); List<Activity_Plan__c> actplanList=new List<Activity_Plan__c>(); for(Account acc :Trigger.New) { Opportunity op=new Opportunity(); Activity_Plan__c apobj =new Activity_Plan__c(); //op.accountId=acc.Id; op.Name=acc.Name; op.CloseDate=Date.today(); op.StageName='Prospecting'; apobj.name=acc.Name; apobj.Object__c=acc.Name; oCreate.add(op); actplanList.add(apobj); } insert oCreate; insert actplanList; } }
-
- Abhishek Purohit
- December 07, 2016
- Like
- 0
- Continue reading or reply
Create record type record's lookup with another record type's record in salesforce
In a case object there are 2 record types namely 'case record' and 'problem ticket'.
The problem ticket's record needs to be associated with the case record's record such that one problem ticket record can have multiple case records of the 'case record type'.Also there needs to be the condition that when a problem ticket record's status is closed it must close all the case record's of 'case record type' associated with it using the flow.How can this be done?
Thank you in advance
-
- Abhishek Purohit
- October 05, 2016
- Like
- 0
- Continue reading or reply
How can I solve this?
There needs to be an association of problem ticket to case such that 1 problem ticket will have multiple cases.
When I close the problem ticket the associated cases needs to be closed with it
-
- Abhishek Purohit
- October 04, 2016
- Like
- 0
- Continue reading or reply
How to provide the inline editing and saving of the record as well as assign checklist for selecting particular records fordeletion purpose??
public string name{get;set;}
public integer amount{get;set;}
public string stagename{get;set;}
public date closedDate{get;set;}
String key;
List<Opportunity> myop;
String SearchQuery{get;set;}
public String getkey(){
return key;
}
public OppControl(){
myop=[Select Name,Amount,StageName,CloseDate From Opportunity];
}
public List<Opportunity> getmyop(){
return myop;
}
public void setkey(String ip){
key=ip;
}
public PageReference search(){
SearchQuery='Select Name,StageName,Amount,CloseDate From Opportunity where Name like '+'\''+key+'%'+'\'';
myop=database.query(SearchQuery);
return null;
}
public PageReference add(){
return Page.vf4;
}
public PageReference save()
{
Opportunity oppObj=new Opportunity();
oppObj.Name=name;
oppObj.Amount=amount;
oppObj.StageName=stagename;
oppObj.CloseDate=closedDate;
insert oppObj;
return Page.vf3;
return null;
}
public PageReference saveit()
{
//I want to update the inline function
return null;
}
}
//this is the vf3 page
<apex:page controller="OppControl" sidebar="false" showHeader="false">
<apex:form >
<apex:pageBlock mode="inlineEdit" title="Search The Opportunities">
Name: <apex:inputText value="{!key}"/>
<apex:commandButton value="Go" action="{!search}"/>
<apex:commandButton value="Add Opportunity " action="{!add}"/>
<apex:commandButton value="Save" action="{!saveit}" />
<apex:pageBlockTable value="{!myop}" var="my">
<apex:column ><apex:outputLink value="/{!my.id}">"{!my.Name}"</apex:outputLink></apex:column>
<apex:column value="{!my.StageName}"/>
<apex:column value="{!my.Amount}"/>
<apex:column value="{!my.CloseDate}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
Please help by providing above code with the updation,multiple select and delete operation which will also be effective for the database too!
-
- Abhishek Purohit
- September 15, 2016
- Like
- 0
- Continue reading or reply
I have 2 vf pages and 1 custom controller want to add the record,save it on the visualforce page and database and redirect again to the 1st page please help .
this is vf3 page <apex:page controller="OppControl"> <apex:form > <apex:pageBlock title="Search The Opportunities"> Name: <apex:inputText value="{!key}"/> <apex:commandButton value="Go" action="{!search}"/> <apex:commandButton value="Add Opportunity " action="{!add}"/> <apex:pageBlockTable value="{!myop}" var="my"> <apex:column ><apex:outputLink value="/{!my.id}">"{!my.Name}"</apex:outputLink></apex:column> <apex:column value="{!my.StageName}"/> <apex:column value="{!my.Amount}"/> <apex:column value="{!my.CloseDate}"/> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page> This one redirects from the add opportunity button <apex:page controller="OppControl"> <apex:form > <apex:pageBlock title="The New Opportunity"> <apex:pageBlockSection title="Section One"> <apex:outputText value="Enter The Name"></apex:outputText> <apex:inputText /> </apex:pageBlockSection> <apex:pageBlockSection title="Section Two"> <apex:outputText value="Enter The Amount"></apex:outputText> <apex:inputText /> </apex:pageBlockSection> <apex:pageBlockSection title="Section Three"> <apex:outputText value="Enter The Stage Name"></apex:outputText> <apex:inputText /> </apex:pageBlockSection> <apex:pageBlockSection title="Section Four"> <apex:outputText value="Enter The Closed Date"></apex:outputText> <apex:inputText /> <apex:commandButton value="Save it" action="{!save}"/> </apex:pageBlockSection> </apex:pageblock> </apex:form> </apex:page> This is my Custom Controller public class OppControl{ String key; List<Opportunity> myop; String SearchQuery{get;set;} public String getkey(){ return key; } public OppControl(){ myop=[Select Name,Amount,StageName,CloseDate From Opportunity]; } public List<Opportunity> getmyop(){ return myop; } public void setkey(String ip){ key=ip; } public PageReference search(){ SearchQuery='Select Name,StageName,Amount,CloseDate From Opportunity where Name like '+'\''+key+'%'+'\''; myop=database.query(SearchQuery); return null; } public PageReference add(){ return Page.vf4; } public PageReference save(){ return Page.vf3; } } Now I want to add the record like for real in the database using this controller and also after it has been saved on that vf4 page should be able to show the name stagename closedate amount on the vf3 page
-
- Abhishek Purohit
- September 14, 2016
- Like
- 0
- Continue reading or reply
-
- Abhishek Purohit
- August 30, 2016
- Like
- 0
- Continue reading or reply
Now here is the question..I need to create an after update.Also trying for an Helper class Kindly guide.
trigger ShippingBillingAddress on Account (before insert,before update,after insert,after update) { if(Trigger.isBefore) { for(Account accountList:Trigger.New) { if(Trigger.isInsert) { accountList.ShippingStreet=accountList.BillingStreet; accountList.ShippingCountry=accountList.BillingCountry; accountList.ShippingCity=accountList.BillingCity; accountList.ShippingState=accountList.BillingState; } if(Trigger.isUpdate) { accountList.ShippingStreet=accountList.BillingStreet; accountList.ShippingCountry=accountList.BillingCountry; accountList.ShippingCity=accountList.BillingCity; accountList.ShippingState=accountList.BillingState; } } } if(Trigger.IsAfter) { List<Contact> contactCreate=new List<Contact>(); for(Account accountList2:Trigger.New) { if(Trigger.IsInsert) { Contact contactrecordCreate=new Contact(); contactrecordCreate.accountId=accountList2.Id; contactrecordCreate.LastName=accountList2.Name; contactrecordCreate.Phone=accountList2.Phone; contactCreate.add(contactrecordCreate); } insert contactCreate; } } }
- Abhishek Purohit
- December 08, 2016
- Like
- 0
- Continue reading or reply
I just started with apex triggers directly..I Want to know how can I write a Helper class. Please help
trigger OpportunityCreator on Account (after insert) { if(Trigger.isInsert) { List<Opportunity> oCreate=new List<Opportunity>(); List<Activity_Plan__c> actplanList=new List<Activity_Plan__c>(); for(Account acc :Trigger.New) { Opportunity op=new Opportunity(); Activity_Plan__c apobj =new Activity_Plan__c(); //op.accountId=acc.Id; op.Name=acc.Name; op.CloseDate=Date.today(); op.StageName='Prospecting'; apobj.name=acc.Name; apobj.Object__c=acc.Name; oCreate.add(op); actplanList.add(apobj); } insert oCreate; insert actplanList; } }
- Abhishek Purohit
- December 07, 2016
- Like
- 0
- Continue reading or reply
I have 2 vf pages and 1 custom controller want to add the record,save it on the visualforce page and database and redirect again to the 1st page please help .
this is vf3 page <apex:page controller="OppControl"> <apex:form > <apex:pageBlock title="Search The Opportunities"> Name: <apex:inputText value="{!key}"/> <apex:commandButton value="Go" action="{!search}"/> <apex:commandButton value="Add Opportunity " action="{!add}"/> <apex:pageBlockTable value="{!myop}" var="my"> <apex:column ><apex:outputLink value="/{!my.id}">"{!my.Name}"</apex:outputLink></apex:column> <apex:column value="{!my.StageName}"/> <apex:column value="{!my.Amount}"/> <apex:column value="{!my.CloseDate}"/> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page> This one redirects from the add opportunity button <apex:page controller="OppControl"> <apex:form > <apex:pageBlock title="The New Opportunity"> <apex:pageBlockSection title="Section One"> <apex:outputText value="Enter The Name"></apex:outputText> <apex:inputText /> </apex:pageBlockSection> <apex:pageBlockSection title="Section Two"> <apex:outputText value="Enter The Amount"></apex:outputText> <apex:inputText /> </apex:pageBlockSection> <apex:pageBlockSection title="Section Three"> <apex:outputText value="Enter The Stage Name"></apex:outputText> <apex:inputText /> </apex:pageBlockSection> <apex:pageBlockSection title="Section Four"> <apex:outputText value="Enter The Closed Date"></apex:outputText> <apex:inputText /> <apex:commandButton value="Save it" action="{!save}"/> </apex:pageBlockSection> </apex:pageblock> </apex:form> </apex:page> This is my Custom Controller public class OppControl{ String key; List<Opportunity> myop; String SearchQuery{get;set;} public String getkey(){ return key; } public OppControl(){ myop=[Select Name,Amount,StageName,CloseDate From Opportunity]; } public List<Opportunity> getmyop(){ return myop; } public void setkey(String ip){ key=ip; } public PageReference search(){ SearchQuery='Select Name,StageName,Amount,CloseDate From Opportunity where Name like '+'\''+key+'%'+'\''; myop=database.query(SearchQuery); return null; } public PageReference add(){ return Page.vf4; } public PageReference save(){ return Page.vf3; } } Now I want to add the record like for real in the database using this controller and also after it has been saved on that vf4 page should be able to show the name stagename closedate amount on the vf3 page
- Abhishek Purohit
- September 14, 2016
- Like
- 0
- Continue reading or reply
Visualforce Records not updating on Save
Hello,
I am still very new to APEX. I am trying to develop a simple visualforce page that lists all the accounts the active user owns. Ideally, the user should be able to edit and save the records. When the user clicks save, the record in the database should update. Currently, the edit and save buttons do not work but I can make changes when double clicking but they do not save. Any help is greatly appreciated.
My code so far:
*********************Visualforce page************************
<apex:page controller="MyController" >
<apex:form >
<apex:pageBlock title="My Accounts">
<apex:pageblocktable value="{!myaccounts}" var="acct">
<apex:column value="{! acct.name}"/>
<apex:column value="{! acct.Preferred_Mode_S__c}"/>
<apex:column value="{! acct.type}"/>
<apex:inlineEditSupport event="ondblclick"/>
</apex:pageblocktable>
<apex:commandButton value="Save" action="{!save}"/>
<apex:commandbutton value="Edit" action="{!edit}"/>
</apex:pageblock>
</apex:form>
</apex:page>
*****************************Controller*****************************
public class MyController {
public List<Account> getMyAccounts(){
List<Account> a = new List<Account>();
a = [select Id,name,type,preferred_mode_s__c,macro_industry__c,micro_industry__c from Account WHERE (owner.id =: userinfo.getuserid())];
return a;
}
public PageReference edit() {
return null;
}
public PageReference save() {
return null;
}
}
- SFDC-NOOB
- July 11, 2013
- Like
- 0
- Continue reading or reply