-
ChatterFeed
-
14Best Answers
-
0Likes Received
-
0Likes Given
-
4Questions
-
80Replies
Percentage formula not calculating correctly
I'm trying to create a formula that shows the results of
Cost__c * Number_Of_Months__c - Retainer__c
But when i view the Total__c field, My formula is only reducing the amount by the number I enter into the retainer field.
So I enter 1,000 into the cost field and 5 in the number of months field and 5 percent in the retainer field my return value is $4,999.95 not 4,750. Can any one help me with this formula?
- Bob_z
- August 05, 2019
- Like
- 0
- Continue reading or reply
How do I use the WorkBench to retrieve metadata for State / Country Picklists
I need to export the State & Country picklist values which I think are in the Settings folder in the workbench but I need an xml file to do so
Looking for the format of the xml file needed
- Brian Bartlett
- August 05, 2019
- Like
- 0
- Continue reading or reply
Duplicate rule error message to display on custom lead convert page
Database.LeadConvertResult leadConvertResult = Database.convertLead(leadConvert); // if the lead converting was a success then create a task if (!leadConvertResult.success) { PrintErrors(leadConvertResult.errors); return null; } //this method will take database errors and print them to teh PageMessages public void PrintErrors(Database.Error[] errors) { for(Database.Error error : errors) { if(error instanceof Database.DuplicateError) { Database.DuplicateError duplicateError = (Database.DuplicateError)error; Datacloud.DuplicateResult duplicateResult = duplicateError.getDuplicateResult(); // Display duplicate error message as defined in the duplicate rule ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.Severity.ERROR, 'You are creating a duplicate record. We recommend you use an existing record instead.'); System.debug('The error message'+errorMessage); ApexPages.addMessage(errorMessage); } } }The above code doesn't provide the simple error message as mentioned in the code. However I recieve a the below error. What is it that I am doing wrong here ?
- Ankur Srivastava
- April 13, 2016
- Like
- 0
- Continue reading or reply
old account records
I am trying to understand trigger basics, so I have an custom field HelloWorld in acocunt object and when I create a new record I am updating the custom field with some value and the code is working
My requirement is to update the custom field in the old account records also.
How to access old record records?
Pls let me know.
public class HelloWorld { public void Display(List<Account> acc) { for(Account val:acc) { if (val.Hello__c == null) val.Hello__c='World'; } } } trigger trgupd_hello on Account (before Insert,before update,before delete,after insert,after update,after delete,after undelete) { if (trigger.isBefore) { if (trigger.isInsert) { HelloWorld obj_hello=new HelloWorld(); obj_hello.Display(trigger.new); } } }
Thanks
Pooja Biswas
- pooja biswas
- April 13, 2016
- Like
- 0
- Continue reading or reply
Adding custom button to the contact related list in Account Page layout
Can anyone tell me how to add custom button to the contact related list in Account Page layout
Thanks in advance,
Karthick
- SS Karthick
- July 25, 2014
- Like
- 0
- Continue reading or reply
Create a test class for trigger
I was wondering if anyone can help me with test class for the trigger below
trigger createNewRecord on Audits__c (after update){
list<Audits__c> newList = new list<Audits__c>();
for (Audits__c p:Trigger.new){
if ((p.Closed_Date__c!=trigger.oldMap.get(p.ID).Closed_Date__c)&(p.Closed_Date__c==Date.today())){
Audits__c au = new Audits__c(Name=p.name,Frequency__c=p.Frequency__c,Date__c=p.Closed_Date__c,Account__c=p.Account__c,Status__c='Opened');
newList.add(au);
}
}
if(newList.size()>0)
{
insert newList;
}
}
Thanks
- Denise Flood
- May 24, 2014
- Like
- 0
- Continue reading or reply
How I can use trigger to update user's public group?
- kelly.lu1.3940702104676975E12
- April 28, 2014
- Like
- 0
- Continue reading or reply
Passing text box value as query string.
Here is my code:
VF Page:
<apex:page id="pg" controller="OnLoadController">
<apex:form >
<script type="text/javascript">
function doSearch() {
contactSearch(document.getElementById("searchBox").value);
alert(document.getElementById("searchBox").value);
}
</script>
<apex:actionFunction action="{!redirect}" name="contactSearch">
<apex:param name="searchBox" value=""/>
</apex:actionFunction>
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton value="btn1" onclick="doSearch(); return false;"/>
</apex:pageBlockButtons>
<input type="text" id="searchBox" />
</apex:pageBlock>
</apex:form>
</apex:page>
Controller:
public class OnLoadController {
public String searchName {get; set;}
public PageReference redirect()
{
searchName = Apexpages.currentPage().getParameters().get('searchBox');
PageReference searchResult= new PageReference('/apex/VF_SearchDetails?searchCriteria='+ searchName);
searchResult.setRedirect(true);
return searchResult;
}
}
But it is redirecting to the page with null query string value.
Please help.
- arabisays
- February 24, 2014
- Like
- 0
- Continue reading or reply
Populating APEX Maps with object ID's as keys and object names as values
Id key = '006G000000TZ2f9IAD';
Map<Id, Invoice1__c> invoices = new Map<Id, Invoice1__c> ([SELECT Opportunity__c
, Name
FROM Invoice1__c
WHERE Opportunity__c = :key]);
system.debug('Created Map. Number of Invoice names mapped=' + invoices.size());
system.debug('Invoices.Get=' + invoices.get(key));
I would like to be able to pull the Invoice1__c.Name from the Map something like:
String invoiceName = invoices.get(newTicket.sbx_Opportunity__c).Name;
1. How do I properly populate a Map of <OpportunityID, Invoice1__c.Name>. Like this <006G000000TZ2f9IAD, 'Inv-0561'>
2. What are the Id's that I currently see in the invoices variable keySet?
- Carole Reynolds1
- February 22, 2014
- Like
- 0
- Continue reading or reply
- force novice
- January 16, 2014
- Like
- 0
- Continue reading or reply
Compile Error: Field is not writeable for ,leadaccesslevel='read'
Hi All
I keep getting the error message;
Compile Error: Field is not writeable: LeadShare.LeadId at line 14 column 57
if(PartnerUsermap.ContainsKey(ld.createdById)){
partnershare = new LeadShare(LeadId=ld.id,UserOrGroupId=ld.createdById,leadaccesslevel='read');
leadshares.add(partnershare);
}
How to overcome this?Please suggest
Cheers
- Team Works
- August 25, 2013
- Like
- 0
- Continue reading or reply
[{"message":"HTTPS Required","errorCode":"UNSUPPORTED_CLIENT"}]
Hi,
I have got error
[{"message":"HTTPS Required","errorCode":"UNSUPPORTED_CLIENT"}]
when i call service hosted in site from apex page .
my code is below
my source code:
<apex:page controller="getservice2">
<apex:form >
<apex:commandButton action="{!getResult}" value="Submit"> </apex:commandButton>
<br/><br/> {!myresponse}
</apex:form>
</apex:page>
public class getservice2
{
public String myresponse{get;set;}
public Pagereference getResult()
{
HttpRequest req = new HttpRequest();
Http http = new Http();
req.setMethod('GET');
String url = 'http://sarveswararao-developer-edition.ap1.force.com/services/apexrest/GetService ';
req.setEndpoint(url);
req.setHeader('Authorization', 'OAuth '+UserInfo.getSessionId());
HTTPResponse resp = http.send(req);
myresponse=resp.getBody();
return null; }
}
my target code in site
@RestResource(urlMapping='/GetService/*')
global with sharing class getservice1
{
@HttpGet
global static String postRestMethod()
{
return 'Hi, You have invoked getservice1 created using Apex Rest and exposed using REST API';
}
}
please suggest me
Thanks ,
Sarvesh.
- sarvesh001
- May 11, 2013
- Like
- 0
- Continue reading or reply
Fields visible to Selected Users
Hello,
Is there any way that we could show some custom fields on an Opportunity ONLY to a selected set of users? All the users in that profile should not see the field but for this set.
Thanks for the help.. !!!
Radram
- Radram
- September 24, 2012
- Like
- 0
- Continue reading or reply
redirect to Visualforce page on record save
Does anyone have any ideas on how to accomplish this?
Thanks in advance...
- Cthulhu4242
- November 21, 2008
- Like
- 0
- Continue reading or reply
Trigger vs Validation rule
I need some help that can we avoid validation rule on object and put this validation in trigger?
What is the best practice write validation in trigger or write validation rule separate ?.
Message Edited by Onki3 on 12-30-2008 10:24 PM
- ~Onkar
- December 30, 2009
- Like
- 0
- Continue reading or reply
i need help.. for using metadata webservices in asp.net2.0
No operation available for request {http://soap.sforce.com/2006/04/metadata}create
can anybody help me. i am using asp.net with c#.
- ~Onkar
- July 29, 2008
- Like
- 0
- Continue reading or reply
unable to download apextoolkit with eclipse3.2
I am trying to add force.com plugin with eclipse but its gives error.
My system is under firewall and i specify all proxy setting in eclipse.
!SUBENTRY 1 org.eclipse.update.core 4 0 2008-06-04 12:44:42.273 !MESSAGE The File "C:\DOCUME~1\OK76384\Local Settings\Temp\eclipse\.update\1212555238231\1212555238389\eclipse10130.tmp" is not a valid JAR file. [error in opening zip file] !STACK 0 java.util.zip.ZipException: error in opening zip file at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.<init>(Unknown Source) at java.util.jar.JarFile.<init>(Unknown Source) at java.util.jar.JarFile.<init>(Unknown Source) at org.eclipse.update.internal.verifier.CertVerifier.init(CertVerifier.java:77) at org.eclipse.update.internal.verifier.CertVerifier.verify(CertVerifier.java:129) at org.eclipse.update.core.Feature.verifyReferences(Feature.java:967) at org.eclipse.update.core.Feature.install(Feature.java:377) at org.eclipse.update.internal.core.SiteFile.install(SiteFile.java:96) at org.eclipse.update.internal.core.ConfiguredSite.install(ConfiguredSite.java:155) at org.eclipse.update.internal.core.ConfiguredSite.install(ConfiguredSite.java:119) at org.eclipse.update.internal.operations.InstallOperation.execute(InstallOperation.java:92) at org.eclipse.update.internal.operations.BatchInstallOperation.execute(BatchInstallOperation.java:84) at org.eclipse.update.internal.ui.wizards.InstallWizard2.install(InstallWizard2.java:373) at org.eclipse.update.internal.ui.wizards.InstallWizard2.access$1(InstallWizard2.java:370) at org.eclipse.update.internal.ui.wizards.InstallWizard2$1.run(InstallWizard2.java:483) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
- ~Onkar
- June 04, 2008
- Like
- 0
- Continue reading or reply
Use Asp.net WSDL in APEX class
How can we aceess or use "ASP.net WSDL" in Apex class.
when i am trying to use this its give the following error
"Failed to parse wsdl: Found more than one wsdl:binding. WSDL with multiple binding not supported"
Please help
- ~Onkar
- February 20, 2008
- Like
- 0
- Continue reading or reply
Percentage formula not calculating correctly
I'm trying to create a formula that shows the results of
Cost__c * Number_Of_Months__c - Retainer__c
But when i view the Total__c field, My formula is only reducing the amount by the number I enter into the retainer field.
So I enter 1,000 into the cost field and 5 in the number of months field and 5 percent in the retainer field my return value is $4,999.95 not 4,750. Can any one help me with this formula?
- Bob_z
- August 05, 2019
- Like
- 0
- Continue reading or reply
How do I use the WorkBench to retrieve metadata for State / Country Picklists
I need to export the State & Country picklist values which I think are in the Settings folder in the workbench but I need an xml file to do so
Looking for the format of the xml file needed
- Brian Bartlett
- August 05, 2019
- Like
- 0
- Continue reading or reply
SOQL Date Literals
I want to select some data that was created 14 days ago. so i wrote soql like this:
Select Id, CreatedDate FROM ***** WHERE CreatedDate < Last_N_DAYs:14 order by CreatedDate DESC
for example today is 19th so i want to get the date before 5th, but the latest date i get is 2016-08-03T23:34:01.000+0000
FYI i am in UTC 9 time zone. but it is still not right considering the time zone thing.
I appriciate if someone can tell me what is wrong with it. thanks.
- 出力用
- August 19, 2016
- Like
- 0
- Continue reading or reply
Duplicate rule error message to display on custom lead convert page
Database.LeadConvertResult leadConvertResult = Database.convertLead(leadConvert); // if the lead converting was a success then create a task if (!leadConvertResult.success) { PrintErrors(leadConvertResult.errors); return null; } //this method will take database errors and print them to teh PageMessages public void PrintErrors(Database.Error[] errors) { for(Database.Error error : errors) { if(error instanceof Database.DuplicateError) { Database.DuplicateError duplicateError = (Database.DuplicateError)error; Datacloud.DuplicateResult duplicateResult = duplicateError.getDuplicateResult(); // Display duplicate error message as defined in the duplicate rule ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.Severity.ERROR, 'You are creating a duplicate record. We recommend you use an existing record instead.'); System.debug('The error message'+errorMessage); ApexPages.addMessage(errorMessage); } } }The above code doesn't provide the simple error message as mentioned in the code. However I recieve a the below error. What is it that I am doing wrong here ?
- Ankur Srivastava
- April 13, 2016
- Like
- 0
- Continue reading or reply
old account records
I am trying to understand trigger basics, so I have an custom field HelloWorld in acocunt object and when I create a new record I am updating the custom field with some value and the code is working
My requirement is to update the custom field in the old account records also.
How to access old record records?
Pls let me know.
public class HelloWorld { public void Display(List<Account> acc) { for(Account val:acc) { if (val.Hello__c == null) val.Hello__c='World'; } } } trigger trgupd_hello on Account (before Insert,before update,before delete,after insert,after update,after delete,after undelete) { if (trigger.isBefore) { if (trigger.isInsert) { HelloWorld obj_hello=new HelloWorld(); obj_hello.Display(trigger.new); } } }
Thanks
Pooja Biswas
- pooja biswas
- April 13, 2016
- Like
- 0
- Continue reading or reply
Help on how to Disable Customize Column in Global Search
Is there a way APEX, Visualforce, Admin settings or anything that will disable a user to create their own column search?
So when I search for something and click on show more, is there are a way to disable the customize section for other users such as My columns and Columns and buttons for All users?
Only reason because I dont want the users be able to access some data.
Thanks in advance
- Shogun
- April 13, 2016
- Like
- 0
- Continue reading or reply
display pricebook products on visualforce page
I need to show both "order details" and "products in order (Order Products)" details.
My contoller code. Working for only retriving orders. Not working for quering order products (Pricebook)
public with sharing class OrdersController { public List<Order> orderList {get;set;} public OrdersController(){ orderList = new List<Order>(); } public List<Order> getOrders(){ return [SELECT OrderNumber, TotalAmount, Status (Select Product2Id, Product2.Name From PricebookEntry__r Where Product2Id =: productdet) FROM Order WHERE OwnerID=: UserInfo.getUserId()]; } }My VF code:
<apex:page controller="OrdersController" showHeader="false"> <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script> <script type="text/javascript"> jQuery.noConflict(); jQuery(document).ready(function($) { $("#pnl_details").hide(); $('#viewDetails').click(function () { if ($("#pnl_details").is(":hidden")) { $("#pnl_details").slideDown("slow"); $("#viewDetails").html("Show Less Details"); return false; } else { $("#pnl_details").hide("slow"); $("#viewDetails").html("Show More Details"); return false; } }); }); </script> <apex:pageBlock > <!-- <apex:repeat value="{!Orders}" var="owd"> ['{!owd.OrderNumber}','{!owd.TotalAmount}','{!owd.Status}'] </apex:repeat> --> <apex:pageBlockSection title="Orders" id="pnl_details" columns="1"> <apex:pageBlockTable value="{!orders}" var="o"> <!-- <apex:column headerValue="Order Number"> <apex:commandLink action="{!URLFOR($Action.Order.View, o.id)}" value="{!o.OrderNumber}"/> </apex:column> --> <apex:column value="{!o.OrderNumber}"/> <apex:column value="{!o.TotalAmount}" /> <apex:column value="{!o.Status}" /> </apex:pageBlockTable> </apex:pageBlockSection> <apex:pageBlockSection columns="1"> <apex:relatedList list="Pricebook2 " /> </apex:pageBlockSection> </apex:pageBlock> </apex:page>
help me in this.
- sf ost
- April 13, 2016
- Like
- 0
- Continue reading or reply
Adding new Contacts based on custom fields
For Example
I have:
Name:Bruce Wayne
Account: Wayne Enterprise
Email Domain: abcinc.com
IF
Name: Clark Kent
Account: (blank)
Email Domain: abcinc.com
Then for Contact Clark Kent then Account = Wayne Enterprise.
- S_Batman
- April 12, 2016
- Like
- 0
- Continue reading or reply
Report on Task Object
Can any one please help me out in generating report on task object, I am able to display only single object records but i need to display as shown below:..
Thanks in Advance.
- meds9
- April 12, 2016
- Like
- 2
- Continue reading or reply
VF Page in Edit and Create Mode
- Raghu Sharma 6
- March 30, 2016
- Like
- 0
- Continue reading or reply
how to check the old lead status with new lead lead status in apex class
i have the method where i will check the lead (lead records related to group members) owners and status is not changed with in 24 hoursthen i will update the checkbox__x to true.
Currently i have written the code until fetching the leads related to particulr public group of test_Team.Please suggest me how to check the existed old status with new lead status in apex class to process furthur.
public static void updateNamercheckbox(List<Lead> allleadlist){
set<id> useridset=new set<id>();
set<id> leadid=new set<id>();
for(Lead led:allleadlist){
leadid.add(led.ownerId);
}
List<Group> pbgrpid = [select id from Group where type='Regular' AND DeveloperName='test_Team'];
List<GroupMember> userids = [select UserOrGroupId,GroupId from GroupMember where GroupId IN:pbgrpid];
for(GroupMember gmid:userids){
useridset.add(gmid.UserOrGroupId);
}
system.debug('useridset' +leadid);
}
}
- Abi V 4
- March 30, 2016
- Like
- 0
- Continue reading or reply
Trigger to create an Opportunity Product when an Opportunity is Closed/Won
I was wondering if its possible for a trigger to automatically create an opportunity product when an opportunity is closed won.
I have an Object related to the opportunity that has fields called Product_Name__c and Total_Price__c.
I would like the trigger to populate these fields into the corresponding fields on the Opportunity Products object.
Thanks
- Andrew Hoban 6
- December 07, 2015
- Like
- 1
- Continue reading or reply
- vinaybabu H
- December 07, 2015
- Like
- 0
- Continue reading or reply
Salesforce SOQL Error Too many SOQL 001
I'm running one time update using Execute Anonymous and getting error "Salesforce SOQL Error Too many SOQL 001" for the following code, I tried few options to change the code but couldn't run the update, anyone can help with this code please: (Opportuntiy is master for custom object Sales Team, 1 : M)
List <Opportunity> OpptySalesRep = [Select Id,Sales_Rep__c From Opportunity Where Sales_Rep__c !=null and (CreatedDate > 2014-11-01T00:00:00Z and CreatedDate <= 2014-11-30T00:00:00Z)];
set<Id> opportunityIdSet = new set<Id>();
for (Opportunity Oppty : OpptySalesRep) {
list<Sales_Team__c> newGSTmember = new list<Sales_Team__c>();
opportunityIdSet.add(Oppty.Id); //Needed for following SOQL for GST
//Query to get all Sales team memeber for the opportunity
List <Sales_Team__c> gst = [Select Sales_Team_Member__c,Primary__c,Producer__c,Opportunity__c,Id
From Sales_Team__c
Where Opportunity__c IN: opportunityIdSet and Producer__c = null and Opportunity__c <> null];
system.debug('Number of Sales Team Member# ' + gst.size());
//Reset opportunityIdSet for avoid duplicate iteration
opportunityIdSet.remove(Oppty.Id);
boolean IsnewSalesRep = true; //to check if Sales Rep already exists in GST
// Loop through the list and update GST record that matches to Sales Rep
for (Sales_Team__c OpptyGST : gst){
system.debug('GST Memebr# : ' + OpptyGST.Sales_Team_Member__c);
//Update Sales Rep to Primary
if (OpptyGST.Sales_Team_Member__c == Oppty.Sales_Rep__c){
system.debug('INSIDE If');
OpptyGST.Primary__c = true;
IsnewSalesRep = false;
}
// Update Sales reps to non-primary
else if (OpptyGST.Sales_Team_Member__c != Oppty.Sales_Rep__c && OpptyGST.Primary__c == true){
system.debug('INSIDE else If');
OpptyGST.Primary__c = false;
}
}
//Add Sales Rep to GST
if (IsnewSalesRep == true)
{
Sales_Team__c newGST = new Sales_Team__c (); //instantiate the GST object to put values
newGST.Sales_Team_Member__c = Oppty.Sales_Rep__c;
newGST.Primary__c = true;
newGST.Opportunity__c = Oppty.Id;
newGSTmember.add(newGST);
insert newGSTmember;
}
update gst;
}
- Nagendra Singh 12
- July 06, 2015
- Like
- 0
- Continue reading or reply