You need to sign in to do that
Don't have an account?
Surya@soa.com
Problem while Adding Contact using Apex Code? Urgent
I'm Trying to add contact using apex code and when i'm running test it is showing successful but Contacts are not adding
Please suggest me the solution soon.....
Here is my Apex Code
@isTest Public class Enterprise{ static testMethod void AddContact() { Account newAccount = new Account (name='XYZ Organization', BillingCity ='TestCity', BillingCountry ='TestCountry', BillingStreet ='TestStreet', BillingPostalCode ='t3stcd3' ); insert newAccount; Contact NewContact = new Contact ( FirstName = 'xyzFirst', LastName = 'XyZLast', Account = newAccount, Email = 'xyzmail@mail.com' ); } } |
I've save this as a class within my org and executed from developer console using - ContactUtil.AddContact('test1233'); and it worked
All Answers
Thanks for your reply... Even though after making changes as u said both Account as well as contact are not getting added.....Kindly reply soon
Thanks wake OS for ur Fast reply....
Here is my Requirement....
i want to add contact using my apex code......
please can u suggest me the code that i need to write on my developer console,....
Please kindly help me i'm very new to this salesforce world.....
Thanks for ur reply waveOS ...when i copy this code in my developer console it is throwing error "UNEXPECTED TOKEN ACCOUNT"
Heyy thank you so much for your help WAVE OC.....it's working fine now but i need to create a wsdl for this apex code so that i can use it in tibco framework....
Please help me waveOC in building wsdl
THANKS FOR YOUR REPLY WAVEOC.....
i generated wsdl file using apex class as shown below but when i'm invoking from tibco i'm getting response as "TRUE" but contact is not getting created in salesforce....Please suggest me soon waveOC
global without sharing class ContactUtil {
webService static Boolean AddContact(String AcName) {
try {
Account newAccount = new Account (name = AcName,
BillingCity ='TestCity',
BillingCountry ='TestCountry',
BillingStreet ='TestStreet',
BillingPostalCode ='t3stcd3'
);
insert newAccount;
Contact NewContact = new Contact (
FirstName = 'xyzFirst',
LastName = 'XyZLast',
Account = newAccount,
Email = 'xyzmail@mail.com'
);
return true;
} catch (Exception e) {
return false;
}
}
}
I've save this as a class within my org and executed from developer console using - ContactUtil.AddContact('test1233'); and it worked
Thanks alot waveOC for your valuable suggestions ..It's working fine now.....