-
ChatterFeed
-
3Best Answers
-
1Likes Received
-
0Likes Given
-
70Questions
-
77Replies
Exclude Holidays and Weekends to compute Opportunity Stage Age
Hi There,
Is there a way to calculate the opportunity age per stage excluding holidays and weekends?
Considering the following.
- 8am - 5pm during weekdays.
- Saturday and Sunday is not counted
- Holidays are not counted.
Thanks,
Del
-
- Del_Santos
- December 12, 2013
- Like
- 0
- Continue reading or reply
Help on Trigger Unit Test
Hi,
Please help to create a unit test for my trigger.
I having a trouble deploying my trigger in productio since sfdc is requiring a unit test. please help me. sandbox do not require a unit test. please please, im clueless onhow to start the unite tes.
here's the code:
=====
trigger UpdateQuoteManagers on Quote (before insert, before update) {
Set<ID> idOwners = new Set<ID>();
for(Quote quotes:trigger.new)
{
idOwners.add(quotes.Account_Manager__c);
}
if (idOwners.size() > 0)
{
Map<Id,User> users= new Map<Id,User>([Select Territory_Head__c, District_Head__c from User where Id in : idOwners]);
for(Quote qu:trigger.new)
{
if (users.get(qu.Account_Manager__c).Id!= null)
{
qu.District_Head2__c = users.get(qu.Account_Manager__c).District_Head__c;
qu.Territory_Head2__c = users.get(qu.Account_Manager__c).Territory_Head__c;
}
else
{
qu.District_Head2__c = null;
qu.Territory_Head2__c = null;
}
}
}
}
-
- Del_Santos
- September 24, 2013
- Like
- 0
- Continue reading or reply
Validate Attachment
Hi,
Can anyone tell me how can i create validation on leads' attachment?
I have a requirement wherein there should be an attachment before i convert a lead to account.
Appreciate help. thanks. :))
Del
-
- Del_Santos
- June 25, 2013
- Like
- 0
- Continue reading or reply
Help with Javascript
Hi,
I have a custom button with below javascript, however it is prompting me error: "Yes is not defined"
please help.
===============
if( {!Quote.With_Concesssion__c} == "Yes" )
{
window.open('http://www.yahoo.com');
}
else
{
window.open('http://www.google.com');
}
Thanks,
Del
-
- Del_Santos
- June 13, 2013
- Like
- 0
- Continue reading or reply
Inquiry: User Login Access
Hi,
I just would like to inquire if there is a way i can restrict a user to login to salesforce only to one specific computer?
This means, she can only login on her work station and hinders her from loging in when she's outside of the office.
Thanks,
Del
-
- Del_Santos
- June 07, 2013
- Like
- 0
- Continue reading or reply
Help with Javascript button
Hi,
I created a javascript button to open a vf page if {!Quote.Installation_Address_2__c} is not blank but encountering an error. Im not sure how to define a blank value. i am encountering an invalid token issue.
==========================================
here's the code
if ({!Quote.Installation_Address_2__c}!= null)
{
window.parent.location.href="apex/Generate_Endorsement_Letter_B?id={!Quote.Id}";
}
else {
alert("Site B Installation Address is Missing!");
}
Thanks!
Del
-
- Del_Santos
- June 06, 2013
- Like
- 0
- Continue reading or reply
Disable and Enable a custom link
Hi,
Can anybody give me an idea on how can I disable a custom link. I created a custom link in the opportunity page.
I want this link enabled based on a condition.
something like:
IF (Opportunity Type == New Service, link enabled, link disabled)
Thanks,
Del
-
- Del_Santos
- August 16, 2012
- Like
- 0
- Continue reading or reply
Help on record type
Hi Guys,
1. I have a record type and page layout called "locked Opportunity"
2. I just created a new opportunity record type "BellTel Opportunity" and a new page layout also called "BellTel Opportunity"
3. We have a separate system called FIS integrated with Salesforce to update some opportunity field. This system is designed to verify if the facility for the created opportunity is available.
4. We have a custom button that will send the opportunity details to FIS.
5. Exchange of information from SFDC and FIS is thru WSDL.
Now, I created a new opportunity with thisrecord type "BellTel Opportunity", when i send the details to FIS the opportunity record and layout is still "BellTel Opportunity". But when FIS returns the details to salesforce, it does not only update the fields but i also changed the record type and layout to "locked Opportunity". I am struggling all day to find out why it was changing the record type. Could someone help me or give me a clue.
Im totally clueless.:(
Thanks,
Del
-
- Del_Santos
- July 23, 2012
- Like
- 0
- Continue reading or reply
Help with Javascript! Function lost after page refresh
Hi Guys,
Can someone help me. I have a visualforce page with a couple of fields and validations, I have a requirement that when a checkbox A is ticked, field C will be disabled and will copy the value entered on from field B. So for that, I am using below JS and it is working quiet ok, however during the page refresh the functionality is lost. Field C will be blank and enabled.
Could someone please help.. :(
<script language="javascript">
function ToggleInput(copyid,billhouseid,billaptid,insthouseid,instaptid)
{
var copy = document.getElementById(copyid);
var billhouse = document.getElementById(billhouseid);
var billapt = document.getElementById(billaptid);
var insthouse = document.getElementById(insthouseid);
var instapt = document.getElementById(instaptid);
if(copy.checked == true)
{
billhouse.disabled = true;
billhouse.value = insthouse.value;
billapt.disabled = true;
billapt.value = instapt.value;
}
else
{
billhouse.disabled = false;
billapt.disabled = false;
}
}
</script>
<apex:inputText value="{!Lead.Installation_House__c}" required="true" id="insthouse"/>
<apex:inputText value="{!Lead.Installation_Apartment__c}" required="true" id="instapt"/>
<apex:inputCheckbox id="copy" value="{!Lead.Copy__c}" onchange="ToggleInput('{!$Component.copy}','{!$Component.billhouse}','{!$Component.billapt}','{!$Component.insthouse}','{!$Component.instapt}');"/>
<apex:inputText id="billhouse" value="{!Lead.Billing_House__c}"/>
<apex:inputText id="billapt" value="{!Lead.Billing_Apartment__c}"/>
Thanks,
Del
-
- Del_Santos
- July 20, 2012
- Like
- 0
- Continue reading or reply
Help with Javascript!!
Hi Guys,
I have this code that should disable a two fields, the phone and the fax. However, only the phone is getting disabled when i click the checkbox. Could someone help me with this? thanks!
Regards,
Del
==============================
<script language="javascript">
function ToggleInput(theId)
{
var e = document.getElementById(theId);
if(e != null)
{
e.disabled = (e.disabled ? false : "disabled");
}
}
window.onload = function () { document.getElementById('{!$Component.phone}','{!$Component.fax}').enabled= "enabled"; }
</script>
<apex:inputCheckbox onchange="ToggleInput('{!$Component.phone}','{!$Component.fax}');" value="{!Lead.Copy__c}"/>
<apex:inputText id="phone" value="{!Lead.phone}"/>
<apex:inputText id="fax" value="{!Lead.fax}"/>
-
- Del_Santos
- July 19, 2012
- Like
- 0
- Continue reading or reply
Help on trigger deployment
Hi Guys,
I am deploying below trigger in our production but im always getting "Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required". This is my first time creating a trigger could someone help me please.
trigger twebLead on Lead (after update) {
if (Trigger.new.size() == 1) {
if (Trigger.old[0].isConverted == false && Trigger.new[0].isConverted == true) {
if (Trigger.new[0].ConvertedAccountId != null) {
Account a = [Select a.Id, a.CurrencyIsoCode From Account a Where a.Id = :Trigger.new[0].ConvertedAccountId];
a.CurrencyIsoCode = 'PHP';
update a;
}
if (Trigger.new[0].ConvertedOpportunityId != null) {
Opportunity o = [Select o.Id, o.CurrencyIsoCode from Opportunity o Where o.Id = :Trigger.new[0].ConvertedOpportunityId];
o.CurrencyIsoCode = 'PHP';
update o;
}
}
}
}
I don't know what i am missing since i have deployed the same code in sandbox and worked well.
Thanks,
Del
-
- Del_Santos
- July 12, 2012
- Like
- 0
- Continue reading or reply
How to create a trigger to update the account's currency upon lead conversion?
Hi Guys,
Could someone help me on how to write a trigger which will update the account's currency to 'PHP' upon lead conversion?
Thanks,
Del
-
- Del_Santos
- July 12, 2012
- Like
- 0
- Continue reading or reply
How to set the lead currency if the lead is generated from web to lead
Hi Guys,
Could someone know the solution for my below issue.
I have created a force.com site (online application form) that will automatically create a lead when a site user hits the submit button. My issue is: the lead's currency is automatically created as USD. I would love to know on how can i set the currency to PHP when a lead is created. I don't want to show the LEAD CURRENCY field in my online application form.
Thanks,
Del
-
- Del_Santos
- July 11, 2012
- Like
- 0
- Continue reading or reply
Visualforce Validation to prevent user from attaching a non-jpeg file?
Hi Guys,
Below is the code for attaching a file in a record. I want to create a validation rule so that user can only upload jpeg files. Is there a way to do this? please help.
Thanks,
Del
public with sharing class AttachmentUploadController {
public Attachment attachment {
get {
if (attachment == null)
attachment = new Attachment();
return attachment;
}
set;
}
public PageReference upload() {
attachment.OwnerId = UserInfo.getUserId();
attachment.ParentId = '001W0000005v6Ih'; // the record the file is attached to
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;
}
}
-
- Del_Santos
- July 04, 2012
- Like
- 0
- Continue reading or reply
How to specify the destination folder for files uploaded
Hi,
I saw this code online when i am researching but i don't know how can i change the destination folder of my uploaded file. Instead of current users "My Personal Documents" folder, I created a new folder "Online Applications"
Could someone help me please. Thanks!
public PageReference upload() {
document.AuthorId = UserInfo.getUserId();
document.FolderId = UserInfo.getUserId(); <-- i need to change the destination to "Online Applications" folder.
insert mydoc;
return NULL;
}
Thanks,
Del
-
- Del_Santos
- July 02, 2012
- Like
- 0
- Continue reading or reply
Web to Lead form using Sites not passing value to leads
Hi Guys!
Can someone help me please. I have a web to lead form using sites which passes the value to my lead object. I decided to change my code by not using an inputfield to allow my javascript code to work but now it not passing the value to lead. please help me.
......................this code works: it passes the value to leads
<!-- Customer Address Information -->
<apex:pageBlockSection collapsible="false" columns="2">
<apex:inputField value="{!Lead.Installation_House__c}" required="true" id="insthouse"/>
<apex:inputField id="element" value="{!Lead.Billing_House__c}"/>
<apex:inputField value="{!Lead.Installation_Apartment__c}" required="true" id="instapt"/>
<apex:inputField id="b" value="{!Lead.Billing_Apartment__c}"/>
<apex:inputField value="{!Lead.Installation_Street__c}" required="true" id="instst"/>
<apex:inputField id="c" value="{!Lead.Billing_Street__c}"/>
<apex:inputField value="{!Lead.Installation_Subdivision__c}" required="true" id="instsubd"/>
<apex:inputField id="d" value="{!Lead.Billing_Subdivision__c}"/>
<apex:inputField value="{!Lead.Installation_City__c}" required="true" id="instcity"/>
<apex:inputField id="e" value="{!Lead.Billing_City__c}"/>
<apex:inputField value="{!Lead.Installation_Zipcode__c}" id="instzip"/>
<apex:inputField id="f" value="{!Lead.Billing_Zip_Code__c}"/>
</apex:pageBlockSection>
............this code do not works: does not pass the value to lead
<apex:pageBlockSection title="Installation Address" collapsible="false" columns="1">
<label for="{!Lead.Installation_House__c}">Installation House </label>
<input type="text" name="{!Lead.Installation_House__c}" id="insthouse"/><br></br>
<label for="{!Lead.Installation_Apartment__c}">Installation Apartment </label>
<select id="instapt" name="{!Lead.Installation_Apartment__c}" size="1">
<option value="EastwoodParkview1">Eastwood Parkview 1</option>
<option value="EastwoodParkview2">Eastwood Parkview 1</option>
<option value="OneCentralPark">One Central Park</option>
</select><br></br>
<label for="{!Lead.Installation_Street__c}">Installation Street </label>
<input type="text" name="{!Lead.Installation_Street__c}" id="instst"/><br></br>
<label for="{!Lead.Installation_House__c}">Installation Subdivision </label>
<input type="text" name="{!Lead.Installation_Subdivision__c}" id="instsubd"/><br></br>
<label for="{!Lead.Installation_City__c}">Installation City </label>
<input type="text" name="{!Lead.Installation_City__c}" id="instcity"/><br></br>
<label for="{!Lead.Installation_Zipcode__c}">Installation Zipcode </label>
<input type="text" name="{!Lead.Installation_Zipcode__c}" id="instzip"/><br></br>
</apex:pageBlockSection>
Thanks!
Del
-
- Del_Santos
- June 15, 2012
- Like
- 0
- Continue reading or reply
Field values in Sites not passing to Lead object
Hi Guys,
I have a force.com site which pass the value automatically of my inputfield to sfdcLead when i click submit.
I changed my design not to use an inputfield because of some limitations. I changed my code as below. However when i click on submit, it does not pass the value to my lead object anymore. Please help me. Thanks!
<apex:pageBlockSection title="Installation Address" collapsible="false" columns="1">
<label for="{!Lead.Installation_House__c}">Installation House </label>
<input type="text" name="{!Lead.Installation_House__c}" id="insthouse"/><br></br>
<label for="{!Lead.Installation_Apartment__c}">Installation Apartment </label>
<select id="instapt" name="{!Lead.Installation_Apartment__c}" size="1">
<option value="EastwoodParkview1">Eastwood Parkview 1</option>
<option value="EastwoodParkview2">Eastwood Parkview 1</option>
<option value="OneCentralPark">One Central Park</option>
</select><br></br>
<label for="{!Lead.Installation_Street__c}">Installation Street </label>
<input type="text" name="{!Lead.Installation_Street__c}" id="instst"/><br></br>
<label for="{!Lead.Installation_House__c}">Installation Subdivision </label>
<input type="text" name="{!Lead.Installation_Subdivision__c}" id="instsubd"/><br></br>
<label for="{!Lead.Installation_City__c}">Installation City </label>
<input type="text" name="{!Lead.Installation_City__c}" id="instcity"/><br></br>
<label for="{!Lead.Installation_Zipcode__c}">Installation Zipcode </label>
<input type="text" name="{!Lead.Installation_Zipcode__c}" id="instzip"/><br></br>
</apex:pageBlockSection>
Thanks!
Del
-
- Del_Santos
- June 15, 2012
- Like
- 0
- Continue reading or reply
How to copy inputfield value to another inputfield by checkbox?
Hi,
Is it possible to copy the value inputed by the user from inputfield A to inputfield B dynamically by just ticking a checkbox.?
Thanks,
Del
-
- Del_Santos
- June 14, 2012
- Like
- 0
- Continue reading or reply
Disable set of inputfields using a single checkbox
Hi,
I have the ff code which disable one inputfield when a checkbox is selected. My question is how do i make all the inputfields disabled using the same checkbox. When i tick the checkbox all the inputfield should also be disabled.
<apex:pageBlockSection title="Billing Address" collapsible="false" columns="1">
<apex:inputCheckbox value="{!Lead.Cpy_from_Installation_Address__c}" onchange="document.getElementById('{!$Component.disablefield}').disabled=this.checked"/>
<apex:inputField id="disablefield" value="{!Lead.Billing_House__c}"/>
<apex:inputField id="disablefield2" value="{!Lead.Billing_Apartment__c}"/>
<apex:inputField id="disablefield3" value="{!Lead.Billing_Street__c}"/>
<apex:inputField id="disablefield4" value="{!Lead.Billing_Subdivision__c}"/>
<apex:inputField id="disablefield5" value="{!Lead.Billing_City__c}"/>
<apex:inputField id="disablefield6" value="{!Lead.Billing_Zip_Code__c}"/>
</apex:pageBlockSection>
Thanks,
Del
-
- Del_Santos
- June 13, 2012
- Like
- 0
- Continue reading or reply
Diabling multiple fields using the single checkbox
Hi! Hello!
Can you help me on how can i use a single checkbox to disable multiple fields. I have this code below which disable the field {!Lead.Billing_House__c} when the checkbox {!Lead.Cpy_from_Installation_Address__c} is seleceted, however i want to disable more field using the same checkbox, and i cant use the same id because the system tells me already duplicate id.
<apex:pageBlockSection title="Billing Address" collapsible="false" columns="1">
<apex:inputCheckbox value="{!Lead.Cpy_from_Installation_Address__c}" onchange="document.getElementById('{!$Component.disablefield}'.disabled=this.checked"/>
<apex:inputField id="disablefield" value="{!Lead.Billing_House__c}"/>
<apex:inputField value="{!Lead.Billing_Apartment__c}"/>
<apex:inputField value="{!Lead.Billing_Street__c}"/>
<apex:inputField value="{!Lead.Billing_Subdivision__c}"/>
<apex:inputField value="{!Lead.Billing_City__c}"/>
<apex:inputField value="{!Lead.Billing_Zip_Code__c}"/>
</apex:pageBlockSection>
Thanks in AdvancE!
Del
-
- Del_Santos
- June 11, 2012
- Like
- 0
- Continue reading or reply
Adding hours in a NOW() function
Hi,
Is there a way we can add a time to now()?
My present time is 4/26/2011 6:43 PM.
I have a text formula as "TEXT(NOW())", but I am getting a result of "2011-04-26 10:43:51Z" which is 8 hours late hence i would like to add 8hours to my formula.
Also, is it possible to format the result exactly the same as "4/26/2011 6:43 PM"?
Thanks a lot.
Del
-
- Del_Santos
- April 26, 2011
- Like
- 1
- Continue reading or reply
Help on Trigger Unit Test
Hi,
Please help to create a unit test for my trigger.
I having a trouble deploying my trigger in productio since sfdc is requiring a unit test. please help me. sandbox do not require a unit test. please please, im clueless onhow to start the unite tes.
here's the code:
=====
trigger UpdateQuoteManagers on Quote (before insert, before update) {
Set<ID> idOwners = new Set<ID>();
for(Quote quotes:trigger.new)
{
idOwners.add(quotes.Account_Manager__c);
}
if (idOwners.size() > 0)
{
Map<Id,User> users= new Map<Id,User>([Select Territory_Head__c, District_Head__c from User where Id in : idOwners]);
for(Quote qu:trigger.new)
{
if (users.get(qu.Account_Manager__c).Id!= null)
{
qu.District_Head2__c = users.get(qu.Account_Manager__c).District_Head__c;
qu.Territory_Head2__c = users.get(qu.Account_Manager__c).Territory_Head__c;
}
else
{
qu.District_Head2__c = null;
qu.Territory_Head2__c = null;
}
}
}
}
- Del_Santos
- September 24, 2013
- Like
- 0
- Continue reading or reply
Validate Attachment
Hi,
Can anyone tell me how can i create validation on leads' attachment?
I have a requirement wherein there should be an attachment before i convert a lead to account.
Appreciate help. thanks. :))
Del
- Del_Santos
- June 25, 2013
- Like
- 0
- Continue reading or reply
Help with Javascript
Hi,
I have a custom button with below javascript, however it is prompting me error: "Yes is not defined"
please help.
===============
if( {!Quote.With_Concesssion__c} == "Yes" )
{
window.open('http://www.yahoo.com');
}
else
{
window.open('http://www.google.com');
}
Thanks,
Del
- Del_Santos
- June 13, 2013
- Like
- 0
- Continue reading or reply
Help with Javascript button
Hi,
I created a javascript button to open a vf page if {!Quote.Installation_Address_2__c} is not blank but encountering an error. Im not sure how to define a blank value. i am encountering an invalid token issue.
==========================================
here's the code
if ({!Quote.Installation_Address_2__c}!= null)
{
window.parent.location.href="apex/Generate_Endorsement_Letter_B?id={!Quote.Id}";
}
else {
alert("Site B Installation Address is Missing!");
}
Thanks!
Del
- Del_Santos
- June 06, 2013
- Like
- 0
- Continue reading or reply
Help on record type
Hi Guys,
1. I have a record type and page layout called "locked Opportunity"
2. I just created a new opportunity record type "BellTel Opportunity" and a new page layout also called "BellTel Opportunity"
3. We have a separate system called FIS integrated with Salesforce to update some opportunity field. This system is designed to verify if the facility for the created opportunity is available.
4. We have a custom button that will send the opportunity details to FIS.
5. Exchange of information from SFDC and FIS is thru WSDL.
Now, I created a new opportunity with thisrecord type "BellTel Opportunity", when i send the details to FIS the opportunity record and layout is still "BellTel Opportunity". But when FIS returns the details to salesforce, it does not only update the fields but i also changed the record type and layout to "locked Opportunity". I am struggling all day to find out why it was changing the record type. Could someone help me or give me a clue.
Im totally clueless.:(
Thanks,
Del
- Del_Santos
- July 23, 2012
- Like
- 0
- Continue reading or reply
Help with Javascript! Function lost after page refresh
Hi Guys,
Can someone help me. I have a visualforce page with a couple of fields and validations, I have a requirement that when a checkbox A is ticked, field C will be disabled and will copy the value entered on from field B. So for that, I am using below JS and it is working quiet ok, however during the page refresh the functionality is lost. Field C will be blank and enabled.
Could someone please help.. :(
<script language="javascript">
function ToggleInput(copyid,billhouseid,billaptid,insthouseid,instaptid)
{
var copy = document.getElementById(copyid);
var billhouse = document.getElementById(billhouseid);
var billapt = document.getElementById(billaptid);
var insthouse = document.getElementById(insthouseid);
var instapt = document.getElementById(instaptid);
if(copy.checked == true)
{
billhouse.disabled = true;
billhouse.value = insthouse.value;
billapt.disabled = true;
billapt.value = instapt.value;
}
else
{
billhouse.disabled = false;
billapt.disabled = false;
}
}
</script>
<apex:inputText value="{!Lead.Installation_House__c}" required="true" id="insthouse"/>
<apex:inputText value="{!Lead.Installation_Apartment__c}" required="true" id="instapt"/>
<apex:inputCheckbox id="copy" value="{!Lead.Copy__c}" onchange="ToggleInput('{!$Component.copy}','{!$Component.billhouse}','{!$Component.billapt}','{!$Component.insthouse}','{!$Component.instapt}');"/>
<apex:inputText id="billhouse" value="{!Lead.Billing_House__c}"/>
<apex:inputText id="billapt" value="{!Lead.Billing_Apartment__c}"/>
Thanks,
Del
- Del_Santos
- July 20, 2012
- Like
- 0
- Continue reading or reply
Help with Javascript!!
Hi Guys,
I have this code that should disable a two fields, the phone and the fax. However, only the phone is getting disabled when i click the checkbox. Could someone help me with this? thanks!
Regards,
Del
==============================
<script language="javascript">
function ToggleInput(theId)
{
var e = document.getElementById(theId);
if(e != null)
{
e.disabled = (e.disabled ? false : "disabled");
}
}
window.onload = function () { document.getElementById('{!$Component.phone}','{!$Component.fax}').enabled= "enabled"; }
</script>
<apex:inputCheckbox onchange="ToggleInput('{!$Component.phone}','{!$Component.fax}');" value="{!Lead.Copy__c}"/>
<apex:inputText id="phone" value="{!Lead.phone}"/>
<apex:inputText id="fax" value="{!Lead.fax}"/>
- Del_Santos
- July 19, 2012
- Like
- 0
- Continue reading or reply
Help on trigger deployment
Hi Guys,
I am deploying below trigger in our production but im always getting "Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required". This is my first time creating a trigger could someone help me please.
trigger twebLead on Lead (after update) {
if (Trigger.new.size() == 1) {
if (Trigger.old[0].isConverted == false && Trigger.new[0].isConverted == true) {
if (Trigger.new[0].ConvertedAccountId != null) {
Account a = [Select a.Id, a.CurrencyIsoCode From Account a Where a.Id = :Trigger.new[0].ConvertedAccountId];
a.CurrencyIsoCode = 'PHP';
update a;
}
if (Trigger.new[0].ConvertedOpportunityId != null) {
Opportunity o = [Select o.Id, o.CurrencyIsoCode from Opportunity o Where o.Id = :Trigger.new[0].ConvertedOpportunityId];
o.CurrencyIsoCode = 'PHP';
update o;
}
}
}
}
I don't know what i am missing since i have deployed the same code in sandbox and worked well.
Thanks,
Del
- Del_Santos
- July 12, 2012
- Like
- 0
- Continue reading or reply
Visualforce Validation to prevent user from attaching a non-jpeg file?
Hi Guys,
Below is the code for attaching a file in a record. I want to create a validation rule so that user can only upload jpeg files. Is there a way to do this? please help.
Thanks,
Del
public with sharing class AttachmentUploadController {
public Attachment attachment {
get {
if (attachment == null)
attachment = new Attachment();
return attachment;
}
set;
}
public PageReference upload() {
attachment.OwnerId = UserInfo.getUserId();
attachment.ParentId = '001W0000005v6Ih'; // the record the file is attached to
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;
}
}
- Del_Santos
- July 04, 2012
- Like
- 0
- Continue reading or reply
Need to create a button that will clone a quote and the related quote line items
Was wondering if someone has successfully accomplished cloning a quote and the related quote line items? I need it to create a new quote revision without creating a whole new quote with new quote number...just a new revision number.
I am struggling and thought that this task has probaly been done by someone "out there"...
I appreciate your help!!
- KarenC
- September 14, 2011
- Like
- 0
- Continue reading or reply