-
ChatterFeed
-
0Best Answers
-
3Likes Received
-
0Likes Given
-
22Questions
-
43Replies
salesforce option not showing in user license when adding new user
Hi,
On add new user page i am not able to select salesforce option in user license there are only two options
Chatter Free and Chatter External due to which i am not able to select my custum created new profile.
Can some body help me how i can select salesforce license?
Thanks,
Shahab
On add new user page i am not able to select salesforce option in user license there are only two options
Chatter Free and Chatter External due to which i am not able to select my custum created new profile.
Can some body help me how i can select salesforce license?
Thanks,
Shahab
- Shahab Khan
- May 21, 2015
- Like
- 0
- Continue reading or reply
Future method cannot be called from a future or batch method
Hello,
I have a scheduled class of managed package which insert paymnets i have added trigger after insert of payment and i want to add opportunity and opportunity contact role.
This works fine in Sandbox but in live i am getting following error and due to that error my opportunities not added.
"Future method cannot be called from a future or batch method: npo02.OpportunityRollups.rollupContactsandHouseholdsForTrigger(Set<Id>)"
Here is my scheduled apex class.
And here is my trigger code.
Can some body help me how to fix that error so that trigger works fine.
Thanks,
Faraz
I have a scheduled class of managed package which insert paymnets i have added trigger after insert of payment and i want to add opportunity and opportunity contact role.
This works fine in Sandbox but in live i am getting following error and due to that error my opportunities not added.
"Future method cannot be called from a future or batch method: npo02.OpportunityRollups.rollupContactsandHouseholdsForTrigger(Set<Id>)"
Here is my scheduled apex class.
/*** ScheduleRebillingCycle: ***/ public with sharing class ScheduleRebillingCycle implements Schedulable{ List<Rebilling_Cycle__c> rebillingCycles = new List<Rebilling_Cycle__c>(); List<List<Rebilling_Cycle__c>> cycleList = new List<List<Rebilling_Cycle__c>>(); List<Rebilling_Cycle__c> cycleTest = new List<Rebilling_Cycle__c>(); List<String> transactionIDs = new List<String>(); Boolean isFromBatchFile = false; public ScheduleRebillingCycle(List<Rebilling_Cycle__c> cycles, Boolean isBatchFile){ if (cycles != null) cycleTest = cycles; isFromBatchFile = isBatchFile; } public ScheduleRebillingCycle(){ } /* Executes the rebilling cycle that has been set up inside of SalesForce. If approved, create a Payment record. // */ public void execute(SchedulableContext ctx) { if (cycleTest.IsEmpty()) { try { rebillingCycles = [SELECT Id, Name, Account_Name__c, Contact_Name__c, Transaction_ID__c, Account_Type__c, Routing_Number__c, Rebill_Next_Date__c,Rebill_Frequency__c, Rebill_Frequency_Number__c, Payment_Type__c, Card_Number__c, Expiration_Month__c, Expiration_Year__c, Account_Number__c, Rebill_Cycles_Remaining__c, Rebill_Status__c, Rebill_Amount__c, Campaign_Name__c FROM Rebilling_Cycle__c WHERE Rebill_Next_Date__c = TODAY AND (Rebill_Cycles_Remaining__c = 'Infinite' OR Rebill_Cycles_Remaining__c != '0') AND Rebill_Status__c = 'Active']; } catch(Exception e){System.debug('ERROR' + e);} for(Rebilling_Cycle__c c: rebillingCycles){ cycleTest.add(c); } } if ([SELECT count() FROM AsyncApexJob WHERE JobType='BatchApex' AND (Status = 'Processing' OR Status = 'Preparing' OR Status = 'Holding' OR Status = 'Queued')] < 5){ BatchRebillingCycles cycle = new BatchRebillingCycles(cycleTest, isFromBatchFile); ID batchprocessid = Database.executeBatch(cycle); } else { ScheduleRebillingCycle sch = new ScheduleRebillingCycle(cycleTest, isFromBatchFile); Datetime dt = Datetime.now().addMinutes(2); String timeForScheduler = dt.format('s m H d M \'?\' yyyy'); Id schedId = System.Schedule('BluePayRetry'+timeForScheduler,timeForScheduler,sch); } cycleTest.clear(); } }
And here is my trigger code.
trigger BpRCTrigger on BluePay_DNA__Payment__c (after insert) { try { List < Opportunity > oppList = new List<Opportunity>(); List < String > contact_ids = new List<String>(); List < OpportunityContactRole > roleList = new List<OpportunityContactRole>(); oppList.clear(); roleList.clear(); Opportunity opportunity = new Opportunity(); OpportunityContactRole role = new OpportunityContactRole(); Contact prev_contact_rec; Account prev_account_rec; Datetime cDT = System.now(); String current_date = cDT.format('MM/d/yyyy'); Date re_today_date = Date.today(); for (BluePay_DNA__Payment__c bpp : trigger.new) { if(bpp.BluePay_DNA__Is_Recurring__c == 'Yes' && bpp.BluePay_DNA__Transaction_Result__c == 'APPROVED') { String contact_id = String.valueOf(bpp.BluePay_DNA__Contact_Name__c); String campaign_id = String.valueOf(bpp.BluePay_DNA__Campaign_Name__c); String rebilling_cycle_id = String.valueOf(bpp.BluePay_DNA__Rebilling_Cycle_Reference_ID__c); if(contact_id != null && contact_id != '' && campaign_id != null && campaign_id !='') { System.debug('test: 1'); prev_contact_rec = null; prev_account_rec = null; prev_contact_rec = [select AccountId, Donation_Type__c, Other_Gift_Type__c from Contact where Id=:contact_id limit 1]; prev_account_rec = [select Name from Account where id=:prev_contact_rec.AccountId limit 1]; opportunity = null; role = null; opportunity = new Opportunity(); role = new OpportunityContactRole(); System.debug('test: 2'); opportunity.accountId = prev_contact_rec.AccountId; opportunity.name = prev_account_rec.Name + ' $' + bpp.BluePay_DNA__Amount__c + ' Recurring Donation ' + current_date; opportunity.Donation_Type__c = prev_contact_rec.Donation_Type__c; opportunity.BluePay_DNA__Donation_Type__c = (prev_contact_rec.Donation_Type__c != null) ? prev_contact_rec.Donation_Type__c : ''; opportunity.Other_Donation_Type__c = prev_contact_rec.Other_Gift_Type__c; opportunity.Donation_Source_Type__c = 'Via Website'; opportunity.CampaignId = campaign_id; opportunity.amount = Double.valueof(bpp.BluePay_DNA__Amount__c); opportunity.CloseDate = re_today_date; opportunity.stageName = 'Posted'; if(rebilling_cycle_id != null && rebilling_cycle_id !='') { BluePay_DNA__Rebilling_Cycle__c reb_cycle = [select BluePay_DNA__Recurring_Donation_ID__c from BluePay_DNA__Rebilling_Cycle__c where Id=:rebilling_cycle_id limit 1]; if(reb_cycle.BluePay_DNA__Recurring_Donation_ID__c != null && reb_cycle.BluePay_DNA__Recurring_Donation_ID__c !='') { opportunity.npe03__Recurring_Donation__c = reb_cycle.BluePay_DNA__Recurring_Donation_ID__c; } } oppList.add(opportunity); contact_ids.add(contact_id); System.debug('test: 4'); } } } if (oppList != null && oppList.size() > 0) { insert(oppList); Integer count = 0; for(Opportunity opp: oppList) { role = null; role = new OpportunityContactRole(); role.contactId = contact_ids[count]; role.Role = '10'; role.opportunityId = opp.id; roleList.add(role); count++; } insert(roleList); } } catch (exception ex) { System.debug('Error occurd: ' + ex); } }
Can some body help me how to fix that error so that trigger works fine.
Thanks,
Faraz
- Shahab Khan
- April 10, 2015
- Like
- 0
- Continue reading or reply
Trigger.new not working on before update
Hello,
I have write trigger on Contact before insert and before update for avoiding duplicate entry of Email.
Here is my code
It is working fine when inserting new contact. But when i update the email address of existing contact then the trigger gets old value of email field instead of new value for example old value of email was "foo@yahoo.com" i have updated it to "foo123@yahoo.com" instead of assigning "foo123@yahoo.com" value to val_con object it assigns "foo@yahoo.com" to it in case of before update trigger event.
Can some body help me how to fix it.
Thanks,
Shahab
I have write trigger on Contact before insert and before update for avoiding duplicate entry of Email.
Here is my code
trigger DuplicateEmail on Contact (before insert, before update) { Contact val_con = trigger.new[0]; Contact prev_contact_rec = null; if(val_con.Email != null && val_con.Email != '') { try { if (trigger.isInsert) { prev_contact_rec = [select Email from Contact where Email=:val_con.Email limit 1]; system.debug('----->>> Email Before Insert New: ' + val_con.Email); } else if (trigger.isUpdate) { prev_contact_rec = [select Email from Contact where Email=:val_con.Email and Id !=:val_con.Id limit 1]; system.debug('----->>> Email Before Update New: ' + val_con.Email); system.debug('----->>> Id Before Update New: ' + val_con.Id); } if(prev_contact_rec.Email != null && prev_contact_rec.Email != '') { Trigger.new[0].adderror('Email you provided has already exists'); } } catch (exception ex) { System.debug('Error occurd: ' + ex); } } }
It is working fine when inserting new contact. But when i update the email address of existing contact then the trigger gets old value of email field instead of new value for example old value of email was "foo@yahoo.com" i have updated it to "foo123@yahoo.com" instead of assigning "foo123@yahoo.com" value to val_con object it assigns "foo@yahoo.com" to it in case of before update trigger event.
Can some body help me how to fix it.
Thanks,
Shahab
- Shahab Khan
- February 19, 2015
- Like
- 0
- Continue reading or reply
Invalid type Error
i have custom controller with following signature
public with sharing class ScheduleRebillingCycle implements Schedulable
But when i try to instantiate it in other controller like below
ScheduleRebillingCycle ss = new ScheduleRebillingCycle();
It give me error "Invalid type: ScheduleRebillingCycle"
Please somebody help me how i can fix it.
Thanks,
Shahab
public with sharing class ScheduleRebillingCycle implements Schedulable
But when i try to instantiate it in other controller like below
ScheduleRebillingCycle ss = new ScheduleRebillingCycle();
It give me error "Invalid type: ScheduleRebillingCycle"
Please somebody help me how i can fix it.
Thanks,
Shahab
- Shahab Khan
- February 13, 2015
- Like
- 0
- Continue reading or reply
How to add new custom field under Account look up when New is clicked
Hello Every one,
Can any body help me how to add new custom field under account loopup page when we click on new button for adding new account directly there.
For example when we add new opportunity we select account from look up field in the look up field dialog there is new button for add new account directly there i want to add new custom field in this new account form
I have added my custom field but its not coming here please help me how we can show custom field here?
Thanks,
Shahab
Can any body help me how to add new custom field under account loopup page when we click on new button for adding new account directly there.
For example when we add new opportunity we select account from look up field in the look up field dialog there is new button for add new account directly there i want to add new custom field in this new account form
I have added my custom field but its not coming here please help me how we can show custom field here?
Thanks,
Shahab
- Shahab Khan
- February 13, 2015
- Like
- 0
- Continue reading or reply
Donation Information not updating under contact
Hello Every One,
I am adding oppertunities of a contact programatically with stage name posted.
But under contact detail page the donation information is not updating.
Can anyone help me how to make it work?
Thanks,
Shahab
I am adding oppertunities of a contact programatically with stage name posted.
But under contact detail page the donation information is not updating.
Can anyone help me how to make it work?
Thanks,
Shahab
- Shahab Khan
- February 03, 2015
- Like
- 0
- Continue reading or reply
PHP Toolkit not returning data in sequence
Hello,
I am using PHP latest toolkit.
I have written the query "SELECT Id, Name, Amount, CloseDate, StageName from Opportunity Limit 5"
but toolkit returing the result in different sequence like below
There should be first ID then Name then amount then close date and the last stagename.
Can any body help me how to get result data in sequence.?
Thanks,
Faraz
I am using PHP latest toolkit.
I have written the query "SELECT Id, Name, Amount, CloseDate, StageName from Opportunity Limit 5"
but toolkit returing the result in different sequence like below
[0] => stdClass Object ( [Id] => 006M000000BcyHxIAJ [Amount] => 50 [CloseDate] => 2015-01-21 [Name] => Faisal Naeem- Donation 1/21/2015 [StageName] => Posted ) [1] => stdClass Object ( [Id] => 006M000000BcyIUIAZ [Amount] => 50 [CloseDate] => 2015-02-11 [Name] => Faisal Naeem Donation (4) 2/11/2015 [StageName] => Pledged )
There should be first ID then Name then amount then close date and the last stagename.
Can any body help me how to get result data in sequence.?
Thanks,
Faraz
- Shahab Khan
- January 26, 2015
- Like
- 0
- Continue reading or reply
How to display radio buttons with image or text box
Hi,
Can some one help me how to display radio button with image as shown below.
Thanks in advance.
Can some one help me how to display radio button with image as shown below.
Thanks in advance.
- Shahab Khan
- September 23, 2014
- Like
- 0
- Continue reading or reply
How to display radio buttons with image
Hi,
Can some one help me how to display radio button with image as shown below.
Thanks in advance.
Can some one help me how to display radio button with image as shown below.
Thanks in advance.
- Shahab Khan
- September 22, 2014
- Like
- 0
- Continue reading or reply
How to show jquery UI dialog in visual force page
Hi,
Can any body help me how to show jquery UI dialog in visual force page?
Thanks in advance.
Can any body help me how to show jquery UI dialog in visual force page?
Thanks in advance.
- Shahab Khan
- September 01, 2014
- Like
- 0
- Continue reading or reply
How to remove comma from Number field
Hi,
I have a number field (Number, 0) but when i put valuee 10000 in it it will diplay it as 10,000 i want to display it without comma.
I have selected number field because i need to select Max number from it and add 1 in Max number for new entry.
Can any body help me how i can do it.
Thanks,
Faraz
I have a number field (Number, 0) but when i put valuee 10000 in it it will diplay it as 10,000 i want to display it without comma.
I have selected number field because i need to select Max number from it and add 1 in Max number for new entry.
Can any body help me how i can do it.
Thanks,
Faraz
- Shahab Khan
- August 29, 2014
- Like
- 3
- Continue reading or reply
Can we edit columns in Account lookup popup?
Hi,
Can anybody help me i want to edit the column data in lookup popup.
For example see below account lookup popup i want to update billing information directaly in this popup, is that possible?
Thanks in advance.
Can anybody help me i want to edit the column data in lookup popup.
For example see below account lookup popup i want to update billing information directaly in this popup, is that possible?
Thanks in advance.
- Shahab Khan
- August 15, 2014
- Like
- 0
- Continue reading or reply
I am not able to deploy my change set to production
Hi,
I am not able to deploy my change set to production my overall code coverage in sandbox is 90+% but when i deploy it to production it give me code coverage error and says my over all code coverage is 69%
I have include only one class in my change set and its code coverage is 93% in sandbox and overall code coverage in sandbox is also 90+
Can any body help me?
Thanks in advance.
I am not able to deploy my change set to production my overall code coverage in sandbox is 90+% but when i deploy it to production it give me code coverage error and says my over all code coverage is 69%
I have include only one class in my change set and its code coverage is 93% in sandbox and overall code coverage in sandbox is also 90+
Can any body help me?
Thanks in advance.
- Shahab Khan
- August 06, 2014
- Like
- 0
- Continue reading or reply
My Change set is not able to deploy even have 85% overall code coverage
Hi,
My Change set is not able to deploy to production even have 85% overall code coverage in sandbox as shown below
But in production it show 73% code coverage.
Can any body help me how to fix this problem
Thanks in advance.
My Change set is not able to deploy to production even have 85% overall code coverage in sandbox as shown below
But in production it show 73% code coverage.
Can any body help me how to fix this problem
Thanks in advance.
- Shahab Khan
- August 04, 2014
- Like
- 0
- Continue reading or reply
Want to add more than one record at time
Hi,
i want to add 100 records to opportunit and 100 records to opportunityrole
Here is my code
With this code i got the following exception.
Please let me know the best way how to fix this.
Thanks in advance
i want to add 100 records to opportunit and 100 records to opportunityrole
Here is my code
for (Integer i = 1; i <= 100; i++) { opportunity = null; role = null; opportunity = new Opportunity(); role = new OpportunityContactRole(); opportunity.name = account.name + ' Donation (' + i + ' of 5) ' + current_date; opportunity.Donation_Type__c = contact.Donation_Type__c; opportunity.Payment_Type__c = payment_type; opportunity.amount = Integer.valueof(contact.Donataion_Amount__c); opportunity.CloseDate = re_today_date; opportunity.stageName = 'Pledged'; oppList.add(opportunity); insert opportunity; // Then create opportunity role role.opportunityId = opportunity.id; if(is_anonymous == false) { role.contactId = contact.id; } else { role.contactId = prev_contact_id; } role.Role = '10'; insert role; }
With this code i got the following exception.
Please let me know the best way how to fix this.
Thanks in advance
- Shahab Khan
- July 25, 2014
- Like
- 0
- Continue reading or reply
unable to deploy my changes from sandbox to production Even have test class
Hi,
I have created a custom controler and visual force page in sandbox its working fine in sandbox now i want to deploy it to production.
Bit it fails due to test coverage percentage as shown below.
Here is my custom controller class
and here is may visual force page
And here is my test class
Can anybody help me how can i improve it so that it deployes to the production successfuly.
Thanks in advance.
I have created a custom controler and visual force page in sandbox its working fine in sandbox now i want to deploy it to production.
Bit it fails due to test coverage percentage as shown below.
Here is my custom controller class
public class Donor { Account account; Contact contact; //Opportunity opportunity; //OpportunityContactRole role; //npe03__Recurring_Donation__c recDonation; //BluePay_DNA__Rebilling_Cycle__c rebilling_cycle; //BluePay_DNA__Payment__c bluePayment; public String payment_type {get;set;} public String current_date {get;set;} public Donor() { account = new Account(); //opportunity = new Opportunity(); //role = new OpportunityContactRole(); //recDonation = new npe03__Recurring_Donation__c(); //bluePayment = new BluePay_DNA__Payment__c(); //rebilling_cycle = new BluePay_DNA__Rebilling_Cycle__c(); payment_type = 'Credit Card'; Datetime cDT = System.now(); current_date = cDT.format('MM/d/yyyy'); } public Contact getContact() { if(contact == null) contact = new Contact(); return contact; } public String StrSaveResult { get; set; } public PageReference save() { list<Contact> listCon = [select Id from Contact where Lastname=:contact.LastName and Firstname=:contact.FirstName and Email=:contact.Email]; if (listCon.size() > 0) { StrSaveResult = 'Sorry the information you provided has already registered!'; } else { try { // First create account account.name = contact.FirstName + ' ' + contact.LastName; account.phone = contact.phone; insert account; // Then create contact contact.accountId = account.id; contact.RecordTypeId = '012F00000013Gk2'; insert contact; // Enable gateway account //String account_id = '100181797727'; if(contact.Donation_Type__c != null && (contact.Donation_Type__c == 'ADAMS 10/10 Club' || contact.Donation_Type__c == 'ADAMS Operations' || contact.Donation_Type__c == 'Other')) { //Adams Operations //9EOFRZWUHAFHOFMXWHHYWMGLT/Y5.GBT //account_id = '100181797727'; } else if(contact.Donation_Type__c != null && contact.Donation_Type__c == 'Ashburn New Masjid') { //Ashburn Acquisition //CF7GXZN46AU8RMQQ7VCKQF89V5XNIFEO //account_id = '100181719805'; } else if(contact.Donation_Type__c != null && contact.Donation_Type__c == 'Ashburn Operations') { //Ashburn //QNLXPZ3/JSFU8ERRARDW6LBOMWCVMDG5 //account_id = '100181704859'; } else if(contact.Donation_Type__c != null && contact.Donation_Type__c == 'Gainesville New Masjid') { //Gainesville New Masjid //NS2ULFHQ2GDUYEE9VAWUAUWWEW3YRCJU //account_id = '100181686984'; } else if(contact.Donation_Type__c != null && contact.Donation_Type__c == 'Gainesville Operations') { //Gainesville Operations //PCPK2DOIVSLQR9ZT78HINNBLOVQA8KPN //account_id = '100181796062'; } else if(contact.Donation_Type__c != null && contact.Donation_Type__c == 'Phase III Construction') { //PhaseThree //OBDNHVA7KCMALRUII7OK8ZMSCQPBPSG8 //account_id = '100181703930'; } else if(contact.Donation_Type__c != null && contact.Donation_Type__c == 'Sully Center') { //Sully Ops //VGX6MUHHFACV4PDTTP2KM721NSXE72ML //account_id = '100181718020'; } else if(contact.Donation_Type__c != null && (contact.Donation_Type__c == 'Sadaqa' || contact.Donation_Type__c == 'Zakat' || contact.Donation_Type__c == 'Zakat Ul Fitr')) { //Zakat //0PG850Z/HD.14VMN1SONYWUDPCAAOW.R //account_id = '100181718495'; } //BluePay_DNA__BluePay_Gateway_Settings__c accountToUpdate; // accountToUpdate = [SELECT BluePay_DNA__Enabled__c FROM BluePay_DNA__BluePay_Gateway_Settings__c WHERE BluePay_DNA__Enabled__c =True LIMIT 1]; // accountToUpdate.BluePay_DNA__Enabled__c = False; // update accountToUpdate; //accountToUpdate = null; // accountToUpdate = [SELECT BluePay_DNA__Enabled__c FROM BluePay_DNA__BluePay_Gateway_Settings__c WHERE BluePay_DNA__Account_ID__c =:account_id LIMIT 1]; // accountToUpdate.BluePay_DNA__Enabled__c = True; // update accountToUpdate; // Add Donation if(contact.Donation_Frequeny__c != null && contact.Donation_Frequeny__c == 'Single') { //opportunity = null; //role = null; //bluePayment = null; //opportunity = new Opportunity(); //role = new OpportunityContactRole(); //bluePayment = new BluePay_DNA__Payment__c(); //opportunity.accountId = account.id; // opportunity.name = account.name + ' Donation ' + current_date; if(contact.Donataion_Amount__c != null && contact.Donataion_Amount__c != '') { //opportunity.amount = Integer.valueof(contact.Donataion_Amount__c); } else { //opportunity.amount = contact.DonataionAmountOther__c; } //opportunity.CloseDate = Date.today(); // opportunity.stageName = 'Posted'; // insert opportunity; // Then create opportunity role //role.opportunityId = opportunity.id; // role.contactId = contact.id; // role.Role = '10'; // insert role; // Add Blue Pay Payment //bluePayment.BluePay_DNA__Account_Name__c = account.id; // bluePayment.BluePay_DNA__Contact_Name__c = contact.id; // bluePayment.BluePay_DNA__Opportunity_Name__c = opportunity.id; // bluePayment.BluePay_DNA__Address__c = contact.MailingStreet; // bluePayment.BluePay_DNA__City__c = contact.MailingCity; // bluePayment.BluePay_DNA__State__c = contact.MailingState; // bluePayment.BluePay_DNA__Zipcode__c = contact.MailingPostalCode; // bluePayment.BluePay_DNA__Email__c = contact.Email; // bluePayment.BluePay_DNA__Phone__c = contact.Phone; // bluePayment.BluePay_DNA__Comments__c = contact.Member_Comments__c; if(contact.Donataion_Amount__c != null && contact.Donataion_Amount__c != '') { //bluePayment.BluePay_DNA__Amount__c = (Integer.valueof(contact.Donataion_Amount__c) - 1); } else { //bluePayment.BluePay_DNA__Amount__c = contact.DonataionAmountOther__c; } //bluePayment.BluePay_DNA__Transaction_Type__c = 'Sale'; // bluePayment.BluePay_DNA__Is_External__c = 'Yes'; // bluePayment.BluePay_DNA__Is_Recurring__c = 'No'; //bluePayment.BluePay_DNA__Payment_Type__c = payment_type; if(payment_type != null && payment_type == 'Credit Card') { //bluePayment.BluePay_DNA__Card_Number__c = contact.Card_Number__c; // bluePayment.BluePay_DNA__Expiration_Month__c = contact.Expiration_Month__c; // bluePayment.BluePay_DNA__Expiration_Year__c = contact.Expiration_Year__c; // bluePayment.BluePay_DNA__CVV2__c = contact.CVV2__c; } else { //bluePayment.BluePay_DNA__Account_Type__c = contact.Account_Type__c; // bluePayment.BluePay_DNA__Account_Number__c = contact.Account_Number__c; // bluePayment.BluePay_DNA__Routing_Number__c = contact.Routing_Number__c; } //insert bluePayment; } else if(contact.Donation_Frequeny__c != null && contact.Donation_Frequeny__c == 'Recurring') { //recDonation.Name = account.name + ' Recurring Donation ' + current_date; if(contact.Donataion_Amount__c != null && contact.Donataion_Amount__c != '') { //recDonation.npe03__Amount__c = Integer.valueof(contact.Donataion_Amount__c); } else { //recDonation.npe03__Amount__c = contact.DonataionAmountOther__c; } //recDonation.npe03__Date_Established__c = Date.today(); // recDonation.npe03__Installment_Period__c = contact.Recurring_Period__c; // recDonation.npe03__Contact__c = contact.id; // insert recDonation; // Add Rebilling Cycle //rebilling_cycle = null; // rebilling_cycle = new BluePay_DNA__Rebilling_Cycle__c(); //rebilling_cycle.BluePay_DNA__Contact_Name__c = contact.id; if(contact.Donataion_Amount__c != null && contact.Donataion_Amount__c != '') { //rebilling_cycle.BluePay_DNA__Rebill_Amount__c = Integer.valueof(contact.Donataion_Amount__c); } else { //rebilling_cycle.BluePay_DNA__Rebill_Amount__c = contact.DonataionAmountOther__c; } //rebilling_cycle.BluePay_DNA__Rebill_Cycles_Remaining__c = '12'; if(contact.Recurring_Period__c != null && contact.Recurring_Period__c == 'Weekly') { //rebilling_cycle.Name = account.name + ' - ' + rebilling_cycle.BluePay_DNA__Rebill_Amount__c + ' - 1Week(s) cycle'; // rebilling_cycle.BluePay_DNA__Rebill_Frequency_Number__c = '1'; // rebilling_cycle.BluePay_DNA__Rebill_Frequency__c = 'Week(s)'; } else if(contact.Recurring_Period__c != null && contact.Recurring_Period__c == 'Bi-Weekly') { //rebilling_cycle.Name = account.name + ' - ' + rebilling_cycle.BluePay_DNA__Rebill_Amount__c + ' - 2Week(s) cycle'; // rebilling_cycle.BluePay_DNA__Rebill_Frequency_Number__c = '2'; // rebilling_cycle.BluePay_DNA__Rebill_Frequency__c = 'Week(s)'; } else if(contact.Recurring_Period__c != null && contact.Recurring_Period__c == 'Monthly') { //rebilling_cycle.Name = account.name + ' - ' + rebilling_cycle.BluePay_DNA__Rebill_Amount__c + ' - 1Month(s) cycle'; // rebilling_cycle.BluePay_DNA__Rebill_Frequency_Number__c = '1'; // rebilling_cycle.BluePay_DNA__Rebill_Frequency__c = 'Month(s)'; } else if(contact.Recurring_Period__c != null && contact.Recurring_Period__c == 'Annually') { //rebilling_cycle.Name = account.name + ' - ' + rebilling_cycle.BluePay_DNA__Rebill_Amount__c + ' - 1Year(s) cycle'; // rebilling_cycle.BluePay_DNA__Rebill_Frequency_Number__c = '1'; // rebilling_cycle.BluePay_DNA__Rebill_Frequency__c = 'Year(s)'; } //rebilling_cycle.BluePay_DNA__Rebill_Next_Date__c = System.now(); // rebilling_cycle.BluePay_DNA__Is_External__c = 'Yes'; // rebilling_cycle.BluePay_DNA__Payment_Type__c = payment_type; if(payment_type != null && payment_type == 'Credit Card') { //rebilling_cycle.BluePay_DNA__Card_Number__c = contact.Card_Number__c; // rebilling_cycle.BluePay_DNA__Expiration_Month__c = contact.Expiration_Month__c; // rebilling_cycle.BluePay_DNA__Expiration_Year__c = contact.Expiration_Year__c; } else { //rebilling_cycle.BluePay_DNA__Payment_Type__c = 'Check'; // rebilling_cycle.BluePay_DNA__Account_Type__c = contact.Account_Type__c; // rebilling_cycle.BluePay_DNA__Account_Number__c = contact.Account_Number__c; // rebilling_cycle.BluePay_DNA__Routing_Number__c = contact.Routing_Number__c; } //insert rebilling_cycle; Date re_today_date = Date.today(); // Add Recurring Donations under Oppertunity for (Integer i = 1; i <= 12; i++) { //opportunity = null; // role = null; // opportunity = new Opportunity(); // role = new OpportunityContactRole(); //opportunity.accountId = account.id; // opportunity.npe03__Recurring_Donation__c = recDonation.id; // opportunity.name = account.name + ' Donation (' + i + ' of 5) ' + current_date; if(contact.Donataion_Amount__c != null && contact.Donataion_Amount__c != '') { //opportunity.amount = Integer.valueof(contact.Donataion_Amount__c); } else { //opportunity.amount = contact.DonataionAmountOther__c; } if(i == 1) { //opportunity.CloseDate = re_today_date; } else { if(contact.Recurring_Period__c != null && contact.Recurring_Period__c == 'Weekly') { re_today_date = re_today_date.addDays(7); //opportunity.CloseDate = re_today_date; } else if(contact.Recurring_Period__c != null && contact.Recurring_Period__c == 'Bi-Weekly') { re_today_date = re_today_date.addDays(14); //opportunity.CloseDate = re_today_date; } else if(contact.Recurring_Period__c != null && contact.Recurring_Period__c == 'Monthly') { re_today_date = re_today_date.addMonths(1); //opportunity.CloseDate = re_today_date; } else if(contact.Recurring_Period__c != null && contact.Recurring_Period__c == 'Yearly') { re_today_date = re_today_date.addYears(1); //opportunity.CloseDate = re_today_date; } } //opportunity.stageName = 'Pledged'; // insert opportunity; // Then create opportunity role //role.opportunityId = opportunity.id; // role.contactId = contact.id; // role.Role = '10'; // insert role; } } //account_id = '100181797727'; //accountToUpdate = null; // accountToUpdate = [SELECT BluePay_DNA__Enabled__c FROM BluePay_DNA__BluePay_Gateway_Settings__c WHERE BluePay_DNA__Account_ID__c =:account_id LIMIT 1]; // accountToUpdate.BluePay_DNA__Enabled__c = True; // update accountToUpdate; StrSaveResult = 'Your donnor account created successfully. Thank you for your donation.'; } catch (exception ex) { Delete account; StrSaveResult = 'Exception type caught: ' + ex.getTypeName(); StrSaveResult += '<br>Message: ' + ex.getMessage(); StrSaveResult += '<br>Cause: ' + ex.getCause(); StrSaveResult += '<br>Line number: ' + ex.getLineNumber(); StrSaveResult += '<br>Stack trace: ' + ex.getStackTraceString(); } } contact = null; return null; } }
and here is may visual force page
And here is my test class
@isTest(SeeAllData = true) private class Donor_TC { @isTest static void testCallout() { Donor MD = new Donor(); Contact contact = MD.getContact(); contact.FirstName = 'Humma'; contact.Middle_Name__c = 'Irfan'; contact.LastName = 'Khan'; contact.Email = 'huma.irfan@purelogics.net'; contact.Phone = '923236161853'; MD.save(); } }
Can anybody help me how can i improve it so that it deployes to the production successfuly.
Thanks in advance.
- Shahab Khan
- June 27, 2014
- Like
- 0
- Continue reading or reply
How to update all record in a custom object?
Hi,
I have a custom object "BluePay_DNA__BluePay_Gateway_Settings__c" and it has 10 rows/records
I want to update a field value for all 10 rows of that object.
Can any body help me how i can do that?
Thanks in advance.
I have a custom object "BluePay_DNA__BluePay_Gateway_Settings__c" and it has 10 rows/records
I want to update a field value for all 10 rows of that object.
Can any body help me how i can do that?
Thanks in advance.
- Shahab Khan
- June 26, 2014
- Like
- 0
- Continue reading or reply
I unable to deploy my changes from sandbox to production
Hi,
I have created a custom controler and visual force page in sandbox its working fine in sandbox now i want to deploy it to production.
Bit it fails due to test coverage percentage as shown below.
Here is my custom controller class
and here is may visual force page code
Can anybody help me how can i improve it so that it deployes to the production successfuly.
Thanks in advance.
I have created a custom controler and visual force page in sandbox its working fine in sandbox now i want to deploy it to production.
Bit it fails due to test coverage percentage as shown below.
Here is my custom controller class
public class MemberDonor { Account account; Contact contact; public MemberDonor() { account = new Account(); } public Contact getContact() { if(contact == null) contact = new Contact(); return contact; } public String StrSaveResult { get; set; } public PageReference save() { try { list<Contact> listCon = [select Id from Contact where Lastname=:contact.LastName and Firstname=:contact.FirstName and Email=:contact.Email]; if (listCon.size() > 0) { StrSaveResult = 'Sorry the information you provided has already registered!'; } else { account.name = contact.FirstName + ' ' + contact.LastName; account.phone = contact.phone; insert account; contact.accountId = account.id; insert contact; StrSaveResult = 'Your membership created successfully!'; } } catch (Exception ex) { StrSaveResult = ex.getMessage(); } contact = null; return null; } }
and here is may visual force page code
<apex:page controller="MemberDonor" showheader="false" sidebar="false" standardStylesheets="false" cache="false" > <apex:stylesheet value="/volunteers/servlet/servlet.FileDownload?file=015F0000002hVFR" /> <apex:form styleClass="cssForm" > <table columns="4" > <tr> <td colspan="4" ><b>Member Information:</b></td> </tr> <!-- first we specify the fields we require for Contact matching --> <tr> <td class="cssLabelsColumn" ><apex:outputLabel value="{!$ObjectType.Contact.Fields.FirstName.Label}" for="txtFirstName" /></td> <td class="cssInputFieldsColumn" ><apex:inputField value="{!contact.FirstName}" id="txtFirstName" required="true" styleClass="cssInputFields" /></td> <td class="cssLabelsColumn" ><apex:outputLabel value="{!$ObjectType.Contact.Fields.MI__c.Label}" for="txtMI" /></td> <td class="cssInputFieldsColumn" ><apex:inputField value="{!contact.MI__c}" id="txtMI" styleClass="cssInputFields" /></td> </tr> <tr> <td class="cssLabelsColumn" ><apex:outputLabel value="{!$ObjectType.Contact.Fields.LastName.Label}" for="txtLastName" /></td> <td class="cssInputFieldsColumn" ><apex:inputField value="{!contact.LastName}" id="txtLastName" required="true" styleClass="cssInputFields" /></td> <td class="cssLabelsColumn" ><apex:outputLabel value="{!$ObjectType.Contact.Fields.Spouse_First_Name__c.Label}" for="txtSpouse_First_Name" /></td> <td class="cssInputFieldsColumn" ><apex:inputField value="{!contact.Spouse_First_Name__c}" id="txtSpouse_First_Name" styleClass="cssInputFields" /></td> </tr> <tr> <td class="cssLabelsColumn" ><apex:outputLabel value="{!$ObjectType.Contact.Fields.Spouse_MI__c.Label}" for="txtSpouse_MI" /></td> <td class="cssInputFieldsColumn" ><apex:inputField value="{!contact.Spouse_MI__c}" id="txtSpouse_MI" styleClass="cssInputFields" /></td> <td class="cssLabelsColumn" ><apex:outputLabel value="{!$ObjectType.Contact.Fields.Spouse_Last_Name__c.Label}" for="txtSpouse_Last_Name" /></td> <td class="cssInputFieldsColumn" ><apex:inputField value="{!contact.Spouse_Last_Name__c}" id="txtSpouse_Last_Name" styleClass="cssInputFields" /></td> </tr> <tr> <td class="cssLabelsColumn" ><apex:outputLabel value="{!$ObjectType.Contact.Fields.MailingStreet.Label}" for="txtMailingStreet" /></td> <td class="cssInputFieldsColumn" ><apex:inputField value="{!contact.MailingStreet}" id="txtMailingStreet" styleClass="cssInputFields" /></td> <td class="cssLabelsColumn" ><apex:outputLabel value="{!$ObjectType.Contact.Fields.MailingCity.Label}" for="txtMailingCity" /></td> <td class="cssInputFieldsColumn" ><apex:inputField value="{!contact.MailingCity}" id="txtMailingCity" styleClass="cssInputFields" /></td> </tr> <tr> <td class="cssLabelsColumn" ><apex:outputLabel value="{!$ObjectType.Contact.Fields.MailingState.Label}" for="txtMailingState" /></td> <td class="cssInputFieldsColumn" ><apex:inputField value="{!contact.MailingState}" id="txtMailingState" styleClass="cssInputFields" /></td> <td class="cssLabelsColumn" ><apex:outputLabel value="{!$ObjectType.Contact.Fields.MailingPostalCode.Label}" for="txtMailingPostalCode" /></td> <td class="cssInputFieldsColumn" ><apex:inputField value="{!contact.MailingPostalCode}" id="txtMailingPostalCode" styleClass="cssInputFields" /></td> </tr> <tr> <td class="cssLabelsColumn" ><apex:outputLabel value="{!$ObjectType.Contact.Fields.MailingCountry.Label}" for="txtMailingCountry" /></td> <td class="cssInputFieldsColumn" ><apex:inputField value="{!contact.MailingCountry}" id="txtMailingCountry" styleClass="cssInputFields" /></td> <td class="cssLabelsColumn" ><apex:outputLabel value="{!$ObjectType.Contact.Fields.Email.Label}" for="txtEmail" /></td> <td class="cssInputFieldsColumn" ><apex:inputField value="{!contact.Email}" id="txtEmail" required="true" styleClass="cssInputFields" /></td> </tr> <tr> <td class="cssLabelsColumn" ><apex:outputLabel value="{!$ObjectType.Contact.Fields.Phone.Label}" for="txtPhone" /></td> <td class="cssInputFieldsColumn" colspan="3" ><apex:inputField value="{!contact.Phone}" id="txtPhone" styleClass="cssInputFields" /></td> </tr> <tr> <td colspan="4" ><b>Membership Information:</b></td> </tr> <tr> <td class="cssInputFieldsColumn" colspan="4" > <apex:selectRadio value="{!contact.New_Or_Renew__c}" > <apex:selectOption itemValue="New Membership" itemLabel="New Membership?"/> <apex:selectOption itemValue="Renew Membership" itemLabel="Renew Membership"/> </apex:selectRadio> </td> </tr> <tr> <td ><apex:outputLabel value="Select Membership:" /></td> <td class="cssInputFieldsColumn" colspan="3" > <apex:selectRadio value="{!contact.Select_Membership__c}" > <apex:selectOption itemValue="Yearly Membership Individual $60 Per Year" itemLabel="Yearly Indiviual $60"/> <apex:selectOption itemValue="Yearly Membership Husband and Wife $100 Per Year" itemLabel="Yearly Husband and Wife $100 per year"/> <apex:selectOption itemValue="Life Time Membership Individual $1000" itemLabel="Life Time Indiviual $1000"/> </apex:selectRadio> </td> </tr> <tr> <td colspan="4" ><b>I want to donate tax deductable donation to ADAMS Center.</b></td> </tr> <tr> <td ><apex:outputLabel value="Donation Frequency:" /></td> <td class="cssInputFieldsColumn" colspan="3" > <apex:selectRadio > <apex:selectOption itemValue="0" itemLabel="Single Donation"/> <apex:selectOption itemValue="1" itemLabel="Recurring Donation"/> </apex:selectRadio> </td> </tr> <tr> <td></td> <td class="cssInputFieldsColumn" colspan="3" ><apex:commandButton value="Save" action="{!save}" /></td> </tr> <tr> <td></td> <td class="cssInputFieldsColumn" colspan="3" ><apex:outputLabel value="{!StrSaveResult}" /></td> </tr> </table> </apex:form> </apex:page>
Can anybody help me how can i improve it so that it deployes to the production successfuly.
Thanks in advance.
- Shahab Khan
- June 19, 2014
- Like
- 0
- Continue reading or reply
How to redirect to the same page
Hi,
I have develop visual force page and getting it with my force.com site.
here is the pyblic link
http://adamscenter.force.com/volunteers/MemberSignup
I want when user submit the form it should return to the same page/form.
Can anybody help me how can i do that?
Thanks in advance
I have develop visual force page and getting it with my force.com site.
here is the pyblic link
http://adamscenter.force.com/volunteers/MemberSignup
I want when user submit the form it should return to the same page/form.
Can anybody help me how can i do that?
Thanks in advance
- Shahab Khan
- June 18, 2014
- Like
- 0
- Continue reading or reply
How to create custom controller class?
Under setup --> Develop --> Appex Classes there is no "New" button please see the image below.
I have clicked on developer console then in developer console window File --> New --> Appex Class
Give the new class name but when click on create button get the following error.
Please help me how can i fix this so that i can create my custom controller class.
Thanks in advance.
I have clicked on developer console then in developer console window File --> New --> Appex Class
Give the new class name but when click on create button get the following error.
Please help me how can i fix this so that i can create my custom controller class.
Thanks in advance.
- Shahab Khan
- June 18, 2014
- Like
- 0
- Continue reading or reply
How to remove comma from Number field
Hi,
I have a number field (Number, 0) but when i put valuee 10000 in it it will diplay it as 10,000 i want to display it without comma.
I have selected number field because i need to select Max number from it and add 1 in Max number for new entry.
Can any body help me how i can do it.
Thanks,
Faraz
I have a number field (Number, 0) but when i put valuee 10000 in it it will diplay it as 10,000 i want to display it without comma.
I have selected number field because i need to select Max number from it and add 1 in Max number for new entry.
Can any body help me how i can do it.
Thanks,
Faraz
- Shahab Khan
- August 29, 2014
- Like
- 3
- Continue reading or reply
salesforce option not showing in user license when adding new user
Hi,
On add new user page i am not able to select salesforce option in user license there are only two options
Chatter Free and Chatter External due to which i am not able to select my custum created new profile.
Can some body help me how i can select salesforce license?
Thanks,
Shahab
On add new user page i am not able to select salesforce option in user license there are only two options
Chatter Free and Chatter External due to which i am not able to select my custum created new profile.
Can some body help me how i can select salesforce license?
Thanks,
Shahab
- Shahab Khan
- May 21, 2015
- Like
- 0
- Continue reading or reply
Future method cannot be called from a future or batch method
Hello,
I have a scheduled class of managed package which insert paymnets i have added trigger after insert of payment and i want to add opportunity and opportunity contact role.
This works fine in Sandbox but in live i am getting following error and due to that error my opportunities not added.
"Future method cannot be called from a future or batch method: npo02.OpportunityRollups.rollupContactsandHouseholdsForTrigger(Set<Id>)"
Here is my scheduled apex class.
And here is my trigger code.
Can some body help me how to fix that error so that trigger works fine.
Thanks,
Faraz
I have a scheduled class of managed package which insert paymnets i have added trigger after insert of payment and i want to add opportunity and opportunity contact role.
This works fine in Sandbox but in live i am getting following error and due to that error my opportunities not added.
"Future method cannot be called from a future or batch method: npo02.OpportunityRollups.rollupContactsandHouseholdsForTrigger(Set<Id>)"
Here is my scheduled apex class.
/*** ScheduleRebillingCycle: ***/ public with sharing class ScheduleRebillingCycle implements Schedulable{ List<Rebilling_Cycle__c> rebillingCycles = new List<Rebilling_Cycle__c>(); List<List<Rebilling_Cycle__c>> cycleList = new List<List<Rebilling_Cycle__c>>(); List<Rebilling_Cycle__c> cycleTest = new List<Rebilling_Cycle__c>(); List<String> transactionIDs = new List<String>(); Boolean isFromBatchFile = false; public ScheduleRebillingCycle(List<Rebilling_Cycle__c> cycles, Boolean isBatchFile){ if (cycles != null) cycleTest = cycles; isFromBatchFile = isBatchFile; } public ScheduleRebillingCycle(){ } /* Executes the rebilling cycle that has been set up inside of SalesForce. If approved, create a Payment record. // */ public void execute(SchedulableContext ctx) { if (cycleTest.IsEmpty()) { try { rebillingCycles = [SELECT Id, Name, Account_Name__c, Contact_Name__c, Transaction_ID__c, Account_Type__c, Routing_Number__c, Rebill_Next_Date__c,Rebill_Frequency__c, Rebill_Frequency_Number__c, Payment_Type__c, Card_Number__c, Expiration_Month__c, Expiration_Year__c, Account_Number__c, Rebill_Cycles_Remaining__c, Rebill_Status__c, Rebill_Amount__c, Campaign_Name__c FROM Rebilling_Cycle__c WHERE Rebill_Next_Date__c = TODAY AND (Rebill_Cycles_Remaining__c = 'Infinite' OR Rebill_Cycles_Remaining__c != '0') AND Rebill_Status__c = 'Active']; } catch(Exception e){System.debug('ERROR' + e);} for(Rebilling_Cycle__c c: rebillingCycles){ cycleTest.add(c); } } if ([SELECT count() FROM AsyncApexJob WHERE JobType='BatchApex' AND (Status = 'Processing' OR Status = 'Preparing' OR Status = 'Holding' OR Status = 'Queued')] < 5){ BatchRebillingCycles cycle = new BatchRebillingCycles(cycleTest, isFromBatchFile); ID batchprocessid = Database.executeBatch(cycle); } else { ScheduleRebillingCycle sch = new ScheduleRebillingCycle(cycleTest, isFromBatchFile); Datetime dt = Datetime.now().addMinutes(2); String timeForScheduler = dt.format('s m H d M \'?\' yyyy'); Id schedId = System.Schedule('BluePayRetry'+timeForScheduler,timeForScheduler,sch); } cycleTest.clear(); } }
And here is my trigger code.
trigger BpRCTrigger on BluePay_DNA__Payment__c (after insert) { try { List < Opportunity > oppList = new List<Opportunity>(); List < String > contact_ids = new List<String>(); List < OpportunityContactRole > roleList = new List<OpportunityContactRole>(); oppList.clear(); roleList.clear(); Opportunity opportunity = new Opportunity(); OpportunityContactRole role = new OpportunityContactRole(); Contact prev_contact_rec; Account prev_account_rec; Datetime cDT = System.now(); String current_date = cDT.format('MM/d/yyyy'); Date re_today_date = Date.today(); for (BluePay_DNA__Payment__c bpp : trigger.new) { if(bpp.BluePay_DNA__Is_Recurring__c == 'Yes' && bpp.BluePay_DNA__Transaction_Result__c == 'APPROVED') { String contact_id = String.valueOf(bpp.BluePay_DNA__Contact_Name__c); String campaign_id = String.valueOf(bpp.BluePay_DNA__Campaign_Name__c); String rebilling_cycle_id = String.valueOf(bpp.BluePay_DNA__Rebilling_Cycle_Reference_ID__c); if(contact_id != null && contact_id != '' && campaign_id != null && campaign_id !='') { System.debug('test: 1'); prev_contact_rec = null; prev_account_rec = null; prev_contact_rec = [select AccountId, Donation_Type__c, Other_Gift_Type__c from Contact where Id=:contact_id limit 1]; prev_account_rec = [select Name from Account where id=:prev_contact_rec.AccountId limit 1]; opportunity = null; role = null; opportunity = new Opportunity(); role = new OpportunityContactRole(); System.debug('test: 2'); opportunity.accountId = prev_contact_rec.AccountId; opportunity.name = prev_account_rec.Name + ' $' + bpp.BluePay_DNA__Amount__c + ' Recurring Donation ' + current_date; opportunity.Donation_Type__c = prev_contact_rec.Donation_Type__c; opportunity.BluePay_DNA__Donation_Type__c = (prev_contact_rec.Donation_Type__c != null) ? prev_contact_rec.Donation_Type__c : ''; opportunity.Other_Donation_Type__c = prev_contact_rec.Other_Gift_Type__c; opportunity.Donation_Source_Type__c = 'Via Website'; opportunity.CampaignId = campaign_id; opportunity.amount = Double.valueof(bpp.BluePay_DNA__Amount__c); opportunity.CloseDate = re_today_date; opportunity.stageName = 'Posted'; if(rebilling_cycle_id != null && rebilling_cycle_id !='') { BluePay_DNA__Rebilling_Cycle__c reb_cycle = [select BluePay_DNA__Recurring_Donation_ID__c from BluePay_DNA__Rebilling_Cycle__c where Id=:rebilling_cycle_id limit 1]; if(reb_cycle.BluePay_DNA__Recurring_Donation_ID__c != null && reb_cycle.BluePay_DNA__Recurring_Donation_ID__c !='') { opportunity.npe03__Recurring_Donation__c = reb_cycle.BluePay_DNA__Recurring_Donation_ID__c; } } oppList.add(opportunity); contact_ids.add(contact_id); System.debug('test: 4'); } } } if (oppList != null && oppList.size() > 0) { insert(oppList); Integer count = 0; for(Opportunity opp: oppList) { role = null; role = new OpportunityContactRole(); role.contactId = contact_ids[count]; role.Role = '10'; role.opportunityId = opp.id; roleList.add(role); count++; } insert(roleList); } } catch (exception ex) { System.debug('Error occurd: ' + ex); } }
Can some body help me how to fix that error so that trigger works fine.
Thanks,
Faraz
- Shahab Khan
- April 10, 2015
- Like
- 0
- Continue reading or reply
Trigger.new not working on before update
Hello,
I have write trigger on Contact before insert and before update for avoiding duplicate entry of Email.
Here is my code
It is working fine when inserting new contact. But when i update the email address of existing contact then the trigger gets old value of email field instead of new value for example old value of email was "foo@yahoo.com" i have updated it to "foo123@yahoo.com" instead of assigning "foo123@yahoo.com" value to val_con object it assigns "foo@yahoo.com" to it in case of before update trigger event.
Can some body help me how to fix it.
Thanks,
Shahab
I have write trigger on Contact before insert and before update for avoiding duplicate entry of Email.
Here is my code
trigger DuplicateEmail on Contact (before insert, before update) { Contact val_con = trigger.new[0]; Contact prev_contact_rec = null; if(val_con.Email != null && val_con.Email != '') { try { if (trigger.isInsert) { prev_contact_rec = [select Email from Contact where Email=:val_con.Email limit 1]; system.debug('----->>> Email Before Insert New: ' + val_con.Email); } else if (trigger.isUpdate) { prev_contact_rec = [select Email from Contact where Email=:val_con.Email and Id !=:val_con.Id limit 1]; system.debug('----->>> Email Before Update New: ' + val_con.Email); system.debug('----->>> Id Before Update New: ' + val_con.Id); } if(prev_contact_rec.Email != null && prev_contact_rec.Email != '') { Trigger.new[0].adderror('Email you provided has already exists'); } } catch (exception ex) { System.debug('Error occurd: ' + ex); } } }
It is working fine when inserting new contact. But when i update the email address of existing contact then the trigger gets old value of email field instead of new value for example old value of email was "foo@yahoo.com" i have updated it to "foo123@yahoo.com" instead of assigning "foo123@yahoo.com" value to val_con object it assigns "foo@yahoo.com" to it in case of before update trigger event.
Can some body help me how to fix it.
Thanks,
Shahab
- Shahab Khan
- February 19, 2015
- Like
- 0
- Continue reading or reply
Invalid type Error
i have custom controller with following signature
public with sharing class ScheduleRebillingCycle implements Schedulable
But when i try to instantiate it in other controller like below
ScheduleRebillingCycle ss = new ScheduleRebillingCycle();
It give me error "Invalid type: ScheduleRebillingCycle"
Please somebody help me how i can fix it.
Thanks,
Shahab
public with sharing class ScheduleRebillingCycle implements Schedulable
But when i try to instantiate it in other controller like below
ScheduleRebillingCycle ss = new ScheduleRebillingCycle();
It give me error "Invalid type: ScheduleRebillingCycle"
Please somebody help me how i can fix it.
Thanks,
Shahab
- Shahab Khan
- February 13, 2015
- Like
- 0
- Continue reading or reply
Donation Information not updating under contact
Hello Every One,
I am adding oppertunities of a contact programatically with stage name posted.
But under contact detail page the donation information is not updating.
Can anyone help me how to make it work?
Thanks,
Shahab
I am adding oppertunities of a contact programatically with stage name posted.
But under contact detail page the donation information is not updating.
Can anyone help me how to make it work?
Thanks,
Shahab
- Shahab Khan
- February 03, 2015
- Like
- 0
- Continue reading or reply
How to display radio buttons with image or text box
Hi,
Can some one help me how to display radio button with image as shown below.
Thanks in advance.
Can some one help me how to display radio button with image as shown below.
Thanks in advance.
- Shahab Khan
- September 23, 2014
- Like
- 0
- Continue reading or reply
How to remove comma from Number field
Hi,
I have a number field (Number, 0) but when i put valuee 10000 in it it will diplay it as 10,000 i want to display it without comma.
I have selected number field because i need to select Max number from it and add 1 in Max number for new entry.
Can any body help me how i can do it.
Thanks,
Faraz
I have a number field (Number, 0) but when i put valuee 10000 in it it will diplay it as 10,000 i want to display it without comma.
I have selected number field because i need to select Max number from it and add 1 in Max number for new entry.
Can any body help me how i can do it.
Thanks,
Faraz
- Shahab Khan
- August 29, 2014
- Like
- 3
- Continue reading or reply
My Change set is not able to deploy even have 85% overall code coverage
Hi,
My Change set is not able to deploy to production even have 85% overall code coverage in sandbox as shown below
But in production it show 73% code coverage.
Can any body help me how to fix this problem
Thanks in advance.
My Change set is not able to deploy to production even have 85% overall code coverage in sandbox as shown below
But in production it show 73% code coverage.
Can any body help me how to fix this problem
Thanks in advance.
- Shahab Khan
- August 04, 2014
- Like
- 0
- Continue reading or reply