-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
22Questions
-
11Replies
Urgent HELP PLZZZZ:: SOQL QUERY
Hi ....i am new to salesforce.....can u plzz guide me.....
Actullay i have a standard and Custom object..Account and Webinfo ...relationship is master-detail....
...now i have to update account fields ....the query is follows:::
select National_Code__c, PersonEmail, Account where National_Code__c=:input.UserId but now i have to update Webinfo custom object based on this:::: In webinfo i have to update professional and two more fields.....Account id is used to link with professional in webinfo...
Thanks in advance........
- Reddy@SFDC
- December 27, 2011
- Like
- 0
- Continue reading or reply
How to retrieve only 5 records per page
Hi All, i am new to VisualForce so please help me.... here are my page and controller::::::::::
public class AccountSearchPGController {
String searchText;
List<Account> results;
public String getSearchText() {
return searchText;
}
public void setSearchText(String s) {
searchText = s;
}
public List<Account> getResults() {
return results;
}
public PageReference doSearch() {
//results = (List<Account>)[FIND :searchText RETURNING Account(Name, Type, Phone)][0];
results = [SELECT name,type,phone FROM Account];
return null;
}
}
////////////////////pagee///////////////////////////////////
<apex:page controller="AccountSearchPGController">
<apex:form >
<apex:pageBlock mode="edit" id="block">
<apex:pageBlockSection title="Account Search Page">
<apex:pageblockSectionItem >
<apex:outputLabel for="searchText">Search Text</apex:outputLabel>
<apex:panelGroup >
<apex:inputText id="searchText" value="{!searchText}"/>
<apex:commandButton value="Search" action="{!doSearch}" rerender="block" status="status"/>
</apex:panelGroup>
</apex:pageblockSectionItem>
</apex:pageblockSection>
<apex:actionStatus id="status" startText="requesting..."/>
<apex:pageBlockSection title="Results" id="results" columns="1">
<apex:pageBlockTable rows="5" value="{!results}" var="l" rendered="{!NOT(ISNULL(results))}">
<apex:column value="{!l.name}"/>
<apex:column value="{!l.type}"/>
<apex:column value="{!l.phone}"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
- Reddy@SFDC
- November 30, 2011
- Like
- 0
- Continue reading or reply
checking NULL and BLANK values
Hi.......am working with webservices. In That i have to check one field ...if it is null or blank also it should insert that record...
The filed name is Workplace_Id and in sfdc it is picklist datatype....see the code below ...and when i insert the record with space ...i am getting error like 'malformed Id'....
global class InboundLinxUserRegistration
{
global class dtRegistrationInput
{
webservice String UserId;
webservice String First_Name;
webservice String Last_Name;
webservice String Email_Address;
webservice Id Workplace_Id;
webservice String Workplace_Name;
webservice String Workplace_Province;
webservice String Workplace_City;
webservice String Workplace_Postal_Code;
webservice String Workplace_Address;
webservice String Speciality;
}
global class dtRegistrationOutput
{
webservice date mydate;
webservice String added;
webservice String status;
webservice String Message_Text;
webservice String error;
}
public webservice static dtRegistrationOutput userregistration(dtRegistrationInput userregistration)
{
dtRegistrationOutput retvalue=new dtRegistrationOutput();
List<Account> account = [select National_Code__c,PersonEmail from Account where National_Code__c=:userregistration.UserId OR PersonEmail=:userregistration.Email_Address];
RecordType rec=[Select Id from RecordType where Name='NVS Profesional WEB'];
Id RT=rec.Id;
If(account.size()>0)
{
retvalue.mydate=system.today();
retvalue.added='false';
retvalue.Message_Text='Duplicate';
}else{
Account acc=new Account();
If((userregistration.Workplace_Id!=NULL)||(userregistration.Workplace_Id!=''))
{
acc.Primary_Parent_vod__c=userregistration.Workplace_Id;
}
String Med='MED-';
acc.National_Code__c=Med+userregistration.UserId;
acc.FirstName=userregistration.First_Name;
acc.LastName=userregistration.Last_Name;
acc.PersonEmail=userregistration.Email_Address;
acc.Account_Status_NES__c='Pending Approval';
acc.Primary_Address_2_NES__c=userregistration.Workplace_Name;
acc.Primary_Province_NES__c=userregistration.Workplace_Province;
acc.Primary_City_NES__c=userregistration.Workplace_City;
acc.Primary_Postal_Code_NES__c=userregistration.Workplace_Postal_Code;
acc.Primary_Address_1_NES__c=userregistration.Workplace_Address;
acc.Specialty_1_vod__c=userregistration.Speciality;
acc.RecordTypeId=RT;
try{
insert acc;
retvalue.added='True';
retvalue.Message_Text='Registration Successfull';
} catch (Exception e){
retvalue.mydate=system.today();
retvalue.added='false';
retvalue.Message_Text=e.getMessage();
}
}
return retvalue;
}
}
- Reddy@SFDC
- November 21, 2011
- Like
- 0
- Continue reading or reply
CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, Account_After_Insert
Hi can u plzz help me withthe code:
global class Registration
{
global class dtRegistrationInput
{
webservice ID UserId;
webservice String First_Name;
webservice String Last_Name;
webservice String Email_Address;
webservice String Status;
webservice ID Workplace_Id;
webservice String Workplace_Name;
webservice String Workplace_Province;
webservice String Workplace_City;
webservice String Workplace_Postal_Code;
webservice String Workplace_Address;
webservice String Speciality;
webservice String Record_Type;
}
global class dtRegistrationOutput
{
webservice date mydate;
webservice String added;
webservice String status;
webservice String Message_Text;
webservice String error;
}
public webservice static dtRegistrationOutput userregistration(dtRegistrationInput userregistration)
{
dtRegistrationOutput retvalue=new dtRegistrationOutput();
List<Account> account = [select National_Code__c,PersonEmail from Account where National_Code__c=:userregistration.UserId or PersonEmail=:userregistration.Email_Address];
if(account.size()>0)
{
retvalue.mydate=system.today();
retvalue.added='false';
retvalue.Message_Text='Duplicate';
}else{
Account acc=new Account();
acc.National_Code__c=userregistration.UserId;
acc.FirstName=userregistration.First_Name;
acc.LastName=userregistration.Last_Name;
acc.PersonEmail=userregistration.Email_Address;
acc.Account_Status_NES__c=userregistration.Status;
acc.Primary_Parent_vod__c=userregistration.Workplace_Id;
acc.Primary_Province_NES__c=userregistration.Workplace_Province;
acc.Primary_City_NES__c=userregistration.Workplace_City;
acc.Primary_Postal_Code_NES__c=userregistration.Workplace_Postal_Code;
acc.Primary_Address_1_NES__c=userregistration.Workplace_Address;
acc.Specialty_1_vod__c=userregistration.Speciality;
acc.RecordTypeId=userregistration.Record_Type;
try{
insert acc;
retvalue.added='True';
retvalue.Message_Text='Registration Successfull';
} catch (Exception e){
retvalue.mydate=system.today();
retvalue.added='false';
retvalue.Message_Text=e.getMessage();
}
}
return retvalue;
}
}
- Reddy@SFDC
- November 16, 2011
- Like
- 0
- Continue reading or reply
Querying help plzzzzzzzzzzz
Hi All,
my actual query is
Select Id, Name,Primary_Province_nes__c, Primary_city_nes__c,
Primary_postal_code_nes__c,Primary_Address_2_NES__C
from Account where Novartis AND Account_Status_NES__c<>'Inactive'
and RecordTypeID in ('012A0000000YYzV','012A0000000RhHS','012A0000000Rirq') now i need to add this From account a, user b where a.ownerid = b.id and b.novartis_region_nes__c = 'Spain'
how can i do? please help
- Reddy@SFDC
- November 11, 2011
- Like
- 0
- Continue reading or reply
how to write query
Hi all, can you guys please help me .....i need to write a query for the below conditions
IspersonAccount.account = 'true'
|
From account a, user b where a.ownerid = b.id and b.region__c = 'EU' |
- Reddy@SFDC
- November 08, 2011
- Like
- 0
- Continue reading or reply
How can query with two standard objects
Hi All,
Actually i want to query on Account and User .....where account.ownerid==user.id how can i?
- Reddy@SFDC
- November 04, 2011
- Like
- 0
- Continue reading or reply
how to write testmethod
Hi ALL, how to write test method for the following code..
global class InboundLinxUserRegistration {
global class dtRegistrationInput {
webservice ID UserId;
webservice String First_Name;
webservice String Last_Name;
webservice String Email_Address;
webservice String Status;
webservice ID Workplace_Id;
webservice String Workplace_Name;
webservice String Workplace_Province;
webservice String Workplace_City;
webservice String Workplace_Postal_Code;
webservice String Workplace_Address;
webservice String Speciality;
webservice String Record_Type;
}
global class dtRegistrationOutput {
webservice date mydate;
webservice String added;
webservice String status;
webservice String Message_Text;
webservice String error;
}
public webservice static dtRegistrationOutput registration(dtRegistrationInput userregistration){
dtRegistrationOutput registration=new dtRegistrationOutput();
List<Account> account = [select National_Code__c,PersonEmail from Account where National_Code__c=:userregistration.UserId OR PersonEmail=:userregistration.Email_Address];
if(account.size()>0){
registration.mydate=system.today();
registration.added='false, http status code=200';
registration.error='Duplicate';
}else{
Account acc=new Account();
acc.National_Code__c=userregistration.UserId;
acc.FirstName=userregistration.First_Name;
acc.LastName=userregistration.Last_Name;
acc.PersonEmail=userregistration.Email_Address;
acc.Account_Status_NES__c=userregistration.Status;
acc.Primary_Parent_vod__c=userregistration.Workplace_Id;
acc.Primary_Province_NES__c=userregistration.Workplace_Province;
acc.Primary_City_NES__c=userregistration.Workplace_City;
acc.Primary_Postal_Code_NES__c=userregistration.Workplace_Postal_Code;
acc.Primary_Address_1_NES__c=userregistration.Workplace_Address;
acc.Specialty_1_vod__c=userregistration.Speciality;
acc.RecordTypeId=userregistration.Record_Type;
try{
insert acc;
registration.mydate=system.today();
registration.added='True,http status code=200';
registration.Message_Text='Registration Successfull';
} catch (Exception e){
registration.mydate=system.today();
registration.added='false';
registration.error=e.getTypeName();
registration.Message_Text=e.getMessage();
}
}
return registration;
}
}
- Reddy@SFDC
- November 03, 2011
- Like
- 0
- Continue reading or reply
can we catch http session code
Hi all,
Can we catch http session code in apex class which is outbound webservice
- Reddy@SFDC
- November 03, 2011
- Like
- 0
- Continue reading or reply
can i send http status code....
Hi All, can i send http status code in the following code
global class InboundLinxUserRegistration {
global class dtRegistrationInput {
webservice ID UserId;
webservice String First_Name;
webservice String Last_Name;
webservice String Email_Address;
webservice String Status;
webservice ID Workplace_Id;
webservice String Workplace_Name;
webservice String Workplace_Province;
webservice String Workplace_City;
webservice String Workplace_Postal_Code;
webservice String Workplace_Address;
webservice String Speciality;
webservice String Record_Type;
}
global class dtRegistrationOutput {
webservice date mydate;
webservice String added;
webservice String status;
webservice String Message_Text;
webservice String error;
}
public webservice static dtRegistrationOutput userregistration(dtRegistrationInput userregistration){
dtRegistrationOutput retvalue=new dtRegistrationOutput();
List<Account> account = [select National_Code__c,PersonEmail from Account where National_Code__c=:userregistration.UserId or PersonEmail=:userregistration.Email_Address];
if(account.size()>0){
retvalue.mydate=system.today();
retvalue.added='false, http status code="200"';
retvalue.error='Duplicate';
}else{
Account acc=new Account();
acc.National_Code__c=userregistration.UserId;
acc.FirstName=userregistration.First_Name;
acc.LastName=userregistration.Last_Name;
acc.PersonEmail=userregistration.Email_Address;
acc.Account_Status_NES__c=userregistration.Status;
acc.Primary_Parent_vod__c=userregistration.Workplace_Id;
acc.Primary_Province_NES__c=userregistration.Workplace_Province;
acc.Primary_City_NES__c=userregistration.Workplace_City;
acc.Primary_Postal_Code_NES__c=userregistration.Workplace_Postal_Code;
acc.Primary_Address_1_NES__c=userregistration.Workplace_Address;
acc.Specialty_1_vod__c=userregistration.Speciality;
acc.RecordTypeId=userregistration.Record_Type;
try{
insert acc;
retvalue.mydate=system.today();
retvalue.added='True,http status code="200"';
retvalue.Message_Text='Registration Successfull';
} catch (Exception e){
retvalue.mydate=system.today();
retvalue.added='false';
retvalue.Message_Text=e.getMessage();
}
}
return retvalue;
}
}
- Reddy@SFDC
- November 03, 2011
- Like
- 0
- Continue reading or reply
INVALID_FIELD_FOR_INSERT_UPDATE, cannot specify Id in an insert call: [Id]
How to avoide the error in the following code................actually when i am testing this webservice with xmlspy it is giving the error
global class InboundLinxUserRegistration {
global class dtRegistrationInput {
webservice ID UserId;
webservice String First_Name;
webservice String Last_Name;
webservice String Email_Address;
webservice String Status;
webservice ID Workplace_Id;
webservice String Workplace_Name;
webservice String Workplace_Province;
webservice String Workplace_City;
webservice String Workplace_Postal_Code;
webservice String Workplace_Address;
webservice String Speciality;
webservice String Record_Type;
}
global class dtRegistrationOutput {
webservice date mydate;
webservice String added;
webservice String status;
webservice String Message_Text;
webservice String error;
}
public webservice static dtRegistrationOutput userregistration(dtRegistrationInput userregistration){
dtRegistrationOutput retvalue=new dtRegistrationOutput();
for(List<Account> account :[select National_Code__c,PersonEmail from Account]){
for(Account acc : account) {
if((acc.National_Code__c==userregistration.UserId)||(acc.PersonEmail==userregistration.Email_Address)){
retvalue.status='Failure';
retvalue.error='Duplicate';
}else {
account[0].National_Code__c=userregistration.UserId;
account[0].FirstName=userregistration.First_Name;
account[0].LastName=userregistration.Last_Name;
account[0].PersonEmail=userregistration.Email_Address;
account[0].Account_Status_NES__c=userregistration.Status;
account[0].Primary_Parent_vod__c=userregistration.Workplace_Id;
account[0].Primary_Province_NES__c=userregistration.Workplace_Province;
account[0].Primary_City_NES__c=userregistration.Workplace_City;
account[0].Primary_Postal_Code_NES__c=userregistration.Workplace_Postal_Code;
account[0].Primary_Address_1_NES__c=userregistration.Workplace_Address;
account[0].Specialty_1_vod__c=userregistration.Speciality;
account[0].RecordTypeId=userregistration.Record_Type;
try{
insert acc;
retvalue.added='True';
retvalue.Message_Text='Registration Successfull';
} /*catch(DMLException e) {
retvalue.mydate=system.today();
retvalue.added='false';
retvalue.Message_Text=e.getMessage();
}*/
catch (Exception e){
retvalue.mydate=system.today();
retvalue.added='false';
retvalue.Message_Text=e.getMessage();
}
}
}
return retvalue;
}
return retvalue;
}
}
- Reddy@SFDC
- November 02, 2011
- Like
- 0
- Continue reading or reply
how can i catch http errors and status code
Hi all, i need to send http erros to external...so how can i with the following code....
global class InboundLinxUserRegistration {
global class dtRegistrationInput {
webservice ID UserId;
webservice String First_Name;
webservice String Last_Name;
webservice String Email_Address;
webservice String Status;
webservice ID Workplace_Id;
webservice String Workplace_Name;
webservice String Workplace_Province;
webservice String Workplace_City;
webservice String Workplace_Postal_Code;
webservice String Workplace_Address;
webservice String Speciality;
webservice String Record_Type;
}
global class dtRegistrationOutput {
webservice date mydate;
webservice String added;
webservice String status;
webservice String Message_Text;
webservice String error;
}
public webservice static dtRegistrationOutput userregistration(dtRegistrationInput userregistration){
dtRegistrationOutput retvalue=new dtRegistrationOutput();
for(List<Account> account :[select National_Code__c,PersonEmail from Account]){
for(Account acc : account) {
if((acc.National_Code__c==userregistration.UserId)||(acc.PersonEmail==userregistration.Email_Address)){
retvalue.status='Failure';
retvalue.Message_Text='Duplicate User';
}else {
acc.National_Code__c=userregistration.UserId;
acc.FirstName=userregistration.First_Name;
acc.LastName=userregistration.Last_Name;
acc.PersonEmail=userregistration.Email_Address;
acc.Account_Status_NES__c=userregistration.Status;
acc.Primary_Parent_vod__c=userregistration.Workplace_Id;
acc.Primary_Province_NES__c=userregistration.Workplace_Province;
acc.Primary_City_NES__c=userregistration.Workplace_City;
acc.Primary_Postal_Code_NES__c=userregistration.Workplace_Postal_Code;
acc.Primary_Address_1_NES__c=userregistration.Workplace_Address;
acc.Specialty_1_vod__c=userregistration.Speciality;
acc.RecordTypeId=userregistration.Record_Type;
try{
insert acc;
retvalue.added='True';
retvalue.Message_Text='Registration Successfull';
} /*catch(DMLException e) {
retvalue.mydate=system.today();
retvalue.added='false';
retvalue.Message_Text=e.getMessage();
}*/
catch (Exception e){
retvalue.mydate=system.today();
retvalue.added='false';
retvalue.Message_Text=e.getMessage();
}
}
}
return retvalue;
}
return retvalue;
}
}
- Reddy@SFDC
- November 02, 2011
- Like
- 0
- Continue reading or reply
INVALID_FIELD_FOR_INSERT_UPDATE, Account: bad field names on insert/update call
Hi, i am getting the error in the follwing code .....plzz help
global class InboundLinxUserRegistration {
global class dtRegistrationInput {
webservice ID UserId;
webservice String First_Name;
webservice String Last_Name;
webservice String Email_Address;
webservice String Status;
webservice ID Workplace_Id;
webservice String Workplace_Name;
webservice String Workplace_Province;
webservice String Workplace_City;
webservice String Workplace_Postal_Code;
webservice String Workplace_Address;
webservice String Speciality;
webservice String Record_Type;
}
global class dtRegistrationOutput {
webservice date mydate;
webservice String added;
webservice String status;
webservice String Message_Text;
}
public webservice static dtRegistrationOutput userregistration(dtRegistrationInput userregistration){
dtRegistrationOutput retvalue=new dtRegistrationOutput();
Account acc=new Account();
acc.National_Code__c=userregistration.UserId;
acc.FirstName=userregistration.First_Name;
acc.LastName=userregistration.Last_Name;
acc.PersonEmail=userregistration.Email_Address;
acc.Account_Status_NES__c=userregistration.Status;
acc.Primary_Parent_vod__c=userregistration.Workplace_Id;
acc.Primary_Province_NES__c=userregistration.Workplace_Province;
acc.Primary_City_NES__c=userregistration.Workplace_City;
acc.Primary_Postal_Code_NES__c=userregistration.Workplace_Postal_Code;
acc.Primary_Address_1_NES__c=userregistration.Workplace_Address;
acc.Specialty_1_vod__c=userregistration.Speciality;
acc.RecordTypeId=userregistration.Record_Type;
try{
insert acc;
} catch(DMLException e) {
retvalue.mydate=system.today();
retvalue.added='false';
retvalue.Message_Text=e.getMessage();
}catch (Exception e){
//HttpResponse res = http.send(req);
retvalue.mydate=system.today();
//retvalue.statuscode=res.getStatusCode();
}
return retvalue;
}
}
- Reddy@SFDC
- November 02, 2011
- Like
- 0
- Continue reading or reply
System.CalloutException: Endpoint can not be null
Hi all....how to fix this error in the below code.....
global class InboundLinxUserRegistration {
global class dtRegistrationInput {
webservice ID UserId;
webservice String First_Name;
webservice String Last_Name;
webservice String Email_Address;
webservice String Status;
webservice ID Workplace_Id;
webservice String Workplace_Name;
webservice String Workplace_Province;
webservice String Workplace_City;
webservice String Workplace_Postal_Code;
webservice String Workplace_Address;
webservice String Speciality;
webservice String Record_Type;
}
global class dtRegistrationOutput {
webservice date mydate;
webservice string added;
webservice String status;
webservice String Message_Text;
webservice integer statuscode;
}
public webservice static dtRegistrationOutput userregistration(dtRegistrationInput userregistration){
dtRegistrationOutput retvalue=new dtRegistrationOutput();
HttpRequest req=new HttpRequest();
Http http=new Http();
HttpResponse res = http.send(req);
retvalue.status='Success';
Account acc=new Account();
acc.National_Code__c=userregistration.UserId;
acc.FirstName=userregistration.First_Name;
acc.LastName=userregistration.Last_Name;
acc.PersonEmail=userregistration.Email_Address;
acc.Account_Status_NES__c=userregistration.Status;
acc.Primary_Parent_vod__c=userregistration.Workplace_Id;
acc.Primary_Province_NES__c=userregistration.Workplace_Province;
acc.Primary_City_NES__c=userregistration.Workplace_City;
acc.Primary_Postal_Code_NES__c=userregistration.Workplace_Postal_Code;
acc.Primary_Address_1_NES__c=userregistration.Workplace_Address;
acc.Specialty_1_vod__c=userregistration.Speciality;
acc.RecordTypeId=userregistration.Record_Type;
try{
insert acc;
} catch(DMLException e) {
retvalue.mydate=system.today();
retvalue.statuscode=res.getStatusCode();
retvalue.added='false';
retvalue.Message_Text=e.getMessage();
}catch (Exception e){
retvalue.mydate=system.today();
retvalue.statuscode=res.getStatusCode();
}
return retvalue;
}
}
- Reddy@SFDC
- November 02, 2011
- Like
- 0
- Continue reading or reply
how i can check duplicate userid and email ......please help
Hi, i need to check duplicates for userid and email fir the following code....please help
global class InboundLinxUserRegistration {
global class dtRegistrationInput {
webservice ID UserId;
webservice String First_Name;
webservice String Last_Name;
webservice String Email_Address;
webservice String Status;
webservice ID Workplace_Id;
webservice String Workplace_Name;
webservice String Workplace_Province;
webservice String Workplace_City;
webservice String Workplace_Postal_Code;
webservice String Workplace_Address;
webservice String Speciality;
webservice String Record_Type;
}
global class dtRegistrationOutput {
webservice date mydate;
webservice string added;
webservice String status;
webservice String Message_Text;
}
public webservice static dtRegistrationOutput userregistration(dtRegistrationInput userregistration){
dtRegistrationOutput retvalue=new dtRegistrationOutput();
retvalue.status='Success';
Account acc=new Account();
acc.National_Code__c=userregistration.UserId;
acc.FirstName=userregistration.First_Name;
acc.LastName=userregistration.Last_Name;
acc.PersonEmail=userregistration.Email_Address;
acc.Account_Status_NES__c=userregistration.Status;
acc.Primary_Parent_vod__c=userregistration.Workplace_Id;
acc.Primary_Province_NES__c=userregistration.Workplace_Province;
acc.Primary_City_NES__c=userregistration.Workplace_City;
acc.Primary_Postal_Code_NES__c=userregistration.Workplace_Postal_Code;
acc.Primary_Address_1_NES__c=userregistration.Workplace_Address;
acc.Specialty_1_vod__c=userregistration.Speciality;
acc.RecordTypeId=userregistration.Record_Type;
try{
insert acc;
} catch(DMLException e) {
retvalue.status='Failure';
retvalue.mydate=system.today();
retvalue.added='false';
retvalue.Message_Text=e.getMessage();
}catch (Exception e){
retvalue.mydate=system.today();
HttpRequest req=new HttpRequest();
Http http=new Http();
HttpResponse res = http.send(req);
System.debug('STATUS:'+res.getStatus());
System.debug('STATUS_CODE:'+res.getStatusCode());
retvalue.Status='Failure';
retvalue.Message_text=e.getMessage();
}
return retvalue;
}
}
- Reddy@SFDC
- November 02, 2011
- Like
- 0
- Continue reading or reply
list index out of bounds 0 error ...plzz help-
here is my code::::::
global class InboundLinxUserRegistration {
global class dtRegistrationInput {
webservice ID UserId;
webservice String First_Name;
webservice String Last_Name;
webservice String Email_Address;
webservice String Status;
webservice ID Workplace_Id;
webservice String Workplace_Name;
webservice String Workplace_Province;
webservice String Workplace_City;
webservice String Workplace_Postal_Code;
webservice String Workplace_Address;
webservice String Speciality;
webservice String Record_Type;
}
global class dtRegistrationOutput {
webservice date mydate;
webservice string added;
webservice String status;
webservice String Message_Text;
}
public webservice static dtRegistrationOutput userregistration(dtRegistrationInput userregistration){
dtRegistrationOutput retvalue=new dtRegistrationOutput();
retvalue.status='Success';
List<Account> acc=[select National_Code__c,FirstName,LastName,PersonEmail,Account_Status_NES__c,Primary_Parent_vod__c,Primary_Province_NES__c,Primary_City_NES__c,Primary_Postal_Code_NES__c,Primary_Address_1_NES__c,Specialty_1_vod__c,RecordTypeId from Account where National_Code__c=:userregistration.UserId];
if(acc.size()==0){
acc[0].National_Code__c=userregistration.UserId;
acc[0].FirstName=userregistration.First_Name;
acc[0].LastName=userregistration.Last_Name;
acc[0].PersonEmail=userregistration.Email_Address;
acc[0].Account_Status_NES__c=userregistration.Status;
acc[0].Primary_Parent_vod__c=userregistration.Workplace_Id;
acc[0].Primary_Province_NES__c=userregistration.Workplace_Province;
acc[0].Primary_City_NES__c=userregistration.Workplace_City;
acc[0].Primary_Postal_Code_NES__c=userregistration.Workplace_Postal_Code;
acc[0].Primary_Address_1_NES__c=userregistration.Workplace_Address;
acc[0].Specialty_1_vod__c=userregistration.Speciality;
acc[0].RecordTypeId=userregistration.Record_Type;
try{
insert acc;
} catch(DMLException e) {
retvalue.status='Failure';
retvalue.mydate=system.today();
retvalue.added='false';
retvalue.Message_Text=e.getMessage();
}catch (Exception e){
retvalue.mydate=system.today();
HttpRequest req=new HttpRequest();
Http http=new Http();
HttpResponse res = http.send(req);
System.debug('STATUS:'+res.getStatus());
System.debug('STATUS_CODE:'+res.getStatusCode());
retvalue.Status='Failure';
retvalue.Message_text=e.getMessage();
}
}else {
retvalue.status='Failure';
retvalue.mydate=system.today();
retvalue.added='false';
}
return retvalue;
}
}
- Reddy@SFDC
- October 31, 2011
- Like
- 0
- Continue reading or reply
send error messages
Hi all, please help me.....i want to throw http error messages in this code with the status code.....
global class InboundLinxUserRegistration {
global class dtRegistrationInput {
webservice ID UserId;
webservice String First_Name;
webservice String Last_Name;
webservice String Email_Address;
webservice String Status;
webservice ID Workplace_Id;
webservice String Workplace_Name;
webservice String Workplace_Province;
webservice String Workplace_City;
webservice String Workplace_Postal_Code;
webservice String Workplace_Address;
webservice String Speciality;
webservice String Record_Type;
}
global class dtRegistrationOutput {
webservice String status;
webservice String Message_Text;
}
public webservice static dtRegistrationOutput userregistration(dtRegistrationInput userregistration){
dtRegistrationOutput retvalue=new dtRegistrationOutput();
retvalue.status='Success';
Account account=new Account();
account.National_Code__c=userregistration.UserId;
account.FirstName=userregistration.First_Name;
account.LastName=userregistration.Last_Name;
account.PersonEmail=userregistration.Email_Address;
account.Account_Status_NES__c=userregistration.Status;
account.Primary_Parent_vod__c=userregistration.Workplace_Id;
account.Primary_Province_NES__c=userregistration.Workplace_Province;
account.Primary_City_NES__c=userregistration.Workplace_City;
account.Primary_Postal_Code_NES__c=userregistration.Workplace_Postal_Code;
account.Primary_Address_1_NES__c=userregistration.Workplace_Address;
account.Specialty_1_vod__c=userregistration.Speciality;
account.RecordTypeId=userregistration.Record_Type;
try{
insert account;
} catch (Exception e){
retvalue.Status='Failure';
retvalue.Message_text=e.getMessage();
}
return retvalue;
}
}
- Reddy@SFDC
- October 31, 2011
- Like
- 0
- Continue reading or reply
System.ListException: List index out of bounds: 0 error
Hi, my code as follows
global class InboundLinxUserRegistration {
global class dtRegistrationInput {
webservice ID UserId;
webservice String First_Name;
webservice String Last_Name;
webservice String Email_Address;
webservice String Status;
webservice ID Workplace_Id;
webservice String Workplace_Name;
webservice String Workplace_Province;
webservice String Workplace_City;
webservice String Workplace_Postal_Code;
webservice String Workplace_Address;
webservice String Speciality;
webservice String Record_Type;
}
global class dtRegistrationOutput {
webservice String status;
webservice String Message_Text;
}
public webservice static dtRegistrationOutput Registration(dtRegistrationInput Registration){
dtRegistrationOutput retvalue=new dtRegistrationOutput();
retvalue.status='Success';
List<Account> account=new List<Account>();
account[0].National_Code__c=Registration.UserId;
account[0].FirstName=Registration.First_Name;
account[0].LastName=Registration.Last_Name;
account[0].PersonEmail=Registration.Email_Address;
account[0].Account_Status_NES__c=Registration.Status;
account[0].Primary_Parent_vod__c=Registration.Workplace_Id;
account[0].Primary_Province_NES__c=Registration.Workplace_Province;
account[0].Primary_City_NES__c=Registration.Workplace_City;
account[0].Primary_Postal_Code_NES__c=Registration.Workplace_Postal_Code;
account[0].Primary_Address_1_NES__c=Registration.Workplace_Address;
account[0].Specialty_1_vod__c=Registration.Speciality;
account[0].RecordTypeId=Registration.Record_Type;
try{
insert account[0];
} catch (Exception e){
retvalue.Status='Failure';
retvalue.Message_Text= e.getMessage();
}
return retvalue;
}
}
when i am trying this code with xmlspy i am getting the error
<
faultcode>soapenv:Client</faultcode><faultstring>System.ListException: List index out of bounds: 0
Class.InboundLinxUserRegistration.Registration: line 28, column 30
External entry point
</faultstring>
- Reddy@SFDC
- October 31, 2011
- Like
- 0
- Continue reading or reply
how to write login() apex...plz urgent
Hi,
I generated a wsdl from apex class. Now i want to test this, so i am using xmlspy, but how can i get session id and header...plzzz help
- Reddy@SFDC
- October 27, 2011
- Like
- 0
- Continue reading or reply
how to export Account fields
Hi All,
I need to export some field values of account to another vendor. How can i do this?
- Reddy@SFDC
- October 25, 2011
- Like
- 0
- Continue reading or reply
INVALID_FIELD_FOR_INSERT_UPDATE, cannot specify Id in an insert call: [Id]
How to avoide the error in the following code................actually when i am testing this webservice with xmlspy it is giving the error
global class InboundLinxUserRegistration {
global class dtRegistrationInput {
webservice ID UserId;
webservice String First_Name;
webservice String Last_Name;
webservice String Email_Address;
webservice String Status;
webservice ID Workplace_Id;
webservice String Workplace_Name;
webservice String Workplace_Province;
webservice String Workplace_City;
webservice String Workplace_Postal_Code;
webservice String Workplace_Address;
webservice String Speciality;
webservice String Record_Type;
}
global class dtRegistrationOutput {
webservice date mydate;
webservice String added;
webservice String status;
webservice String Message_Text;
webservice String error;
}
public webservice static dtRegistrationOutput userregistration(dtRegistrationInput userregistration){
dtRegistrationOutput retvalue=new dtRegistrationOutput();
for(List<Account> account :[select National_Code__c,PersonEmail from Account]){
for(Account acc : account) {
if((acc.National_Code__c==userregistration.UserId)||(acc.PersonEmail==userregistration.Email_Address)){
retvalue.status='Failure';
retvalue.error='Duplicate';
}else {
account[0].National_Code__c=userregistration.UserId;
account[0].FirstName=userregistration.First_Name;
account[0].LastName=userregistration.Last_Name;
account[0].PersonEmail=userregistration.Email_Address;
account[0].Account_Status_NES__c=userregistration.Status;
account[0].Primary_Parent_vod__c=userregistration.Workplace_Id;
account[0].Primary_Province_NES__c=userregistration.Workplace_Province;
account[0].Primary_City_NES__c=userregistration.Workplace_City;
account[0].Primary_Postal_Code_NES__c=userregistration.Workplace_Postal_Code;
account[0].Primary_Address_1_NES__c=userregistration.Workplace_Address;
account[0].Specialty_1_vod__c=userregistration.Speciality;
account[0].RecordTypeId=userregistration.Record_Type;
try{
insert acc;
retvalue.added='True';
retvalue.Message_Text='Registration Successfull';
} /*catch(DMLException e) {
retvalue.mydate=system.today();
retvalue.added='false';
retvalue.Message_Text=e.getMessage();
}*/
catch (Exception e){
retvalue.mydate=system.today();
retvalue.added='false';
retvalue.Message_Text=e.getMessage();
}
}
}
return retvalue;
}
return retvalue;
}
}
- Reddy@SFDC
- November 02, 2011
- Like
- 0
- Continue reading or reply
System.CalloutException: Endpoint can not be null
Hi all....how to fix this error in the below code.....
global class InboundLinxUserRegistration {
global class dtRegistrationInput {
webservice ID UserId;
webservice String First_Name;
webservice String Last_Name;
webservice String Email_Address;
webservice String Status;
webservice ID Workplace_Id;
webservice String Workplace_Name;
webservice String Workplace_Province;
webservice String Workplace_City;
webservice String Workplace_Postal_Code;
webservice String Workplace_Address;
webservice String Speciality;
webservice String Record_Type;
}
global class dtRegistrationOutput {
webservice date mydate;
webservice string added;
webservice String status;
webservice String Message_Text;
webservice integer statuscode;
}
public webservice static dtRegistrationOutput userregistration(dtRegistrationInput userregistration){
dtRegistrationOutput retvalue=new dtRegistrationOutput();
HttpRequest req=new HttpRequest();
Http http=new Http();
HttpResponse res = http.send(req);
retvalue.status='Success';
Account acc=new Account();
acc.National_Code__c=userregistration.UserId;
acc.FirstName=userregistration.First_Name;
acc.LastName=userregistration.Last_Name;
acc.PersonEmail=userregistration.Email_Address;
acc.Account_Status_NES__c=userregistration.Status;
acc.Primary_Parent_vod__c=userregistration.Workplace_Id;
acc.Primary_Province_NES__c=userregistration.Workplace_Province;
acc.Primary_City_NES__c=userregistration.Workplace_City;
acc.Primary_Postal_Code_NES__c=userregistration.Workplace_Postal_Code;
acc.Primary_Address_1_NES__c=userregistration.Workplace_Address;
acc.Specialty_1_vod__c=userregistration.Speciality;
acc.RecordTypeId=userregistration.Record_Type;
try{
insert acc;
} catch(DMLException e) {
retvalue.mydate=system.today();
retvalue.statuscode=res.getStatusCode();
retvalue.added='false';
retvalue.Message_Text=e.getMessage();
}catch (Exception e){
retvalue.mydate=system.today();
retvalue.statuscode=res.getStatusCode();
}
return retvalue;
}
}
- Reddy@SFDC
- November 02, 2011
- Like
- 0
- Continue reading or reply
list index out of bounds 0 error ...plzz help-
here is my code::::::
global class InboundLinxUserRegistration {
global class dtRegistrationInput {
webservice ID UserId;
webservice String First_Name;
webservice String Last_Name;
webservice String Email_Address;
webservice String Status;
webservice ID Workplace_Id;
webservice String Workplace_Name;
webservice String Workplace_Province;
webservice String Workplace_City;
webservice String Workplace_Postal_Code;
webservice String Workplace_Address;
webservice String Speciality;
webservice String Record_Type;
}
global class dtRegistrationOutput {
webservice date mydate;
webservice string added;
webservice String status;
webservice String Message_Text;
}
public webservice static dtRegistrationOutput userregistration(dtRegistrationInput userregistration){
dtRegistrationOutput retvalue=new dtRegistrationOutput();
retvalue.status='Success';
List<Account> acc=[select National_Code__c,FirstName,LastName,PersonEmail,Account_Status_NES__c,Primary_Parent_vod__c,Primary_Province_NES__c,Primary_City_NES__c,Primary_Postal_Code_NES__c,Primary_Address_1_NES__c,Specialty_1_vod__c,RecordTypeId from Account where National_Code__c=:userregistration.UserId];
if(acc.size()==0){
acc[0].National_Code__c=userregistration.UserId;
acc[0].FirstName=userregistration.First_Name;
acc[0].LastName=userregistration.Last_Name;
acc[0].PersonEmail=userregistration.Email_Address;
acc[0].Account_Status_NES__c=userregistration.Status;
acc[0].Primary_Parent_vod__c=userregistration.Workplace_Id;
acc[0].Primary_Province_NES__c=userregistration.Workplace_Province;
acc[0].Primary_City_NES__c=userregistration.Workplace_City;
acc[0].Primary_Postal_Code_NES__c=userregistration.Workplace_Postal_Code;
acc[0].Primary_Address_1_NES__c=userregistration.Workplace_Address;
acc[0].Specialty_1_vod__c=userregistration.Speciality;
acc[0].RecordTypeId=userregistration.Record_Type;
try{
insert acc;
} catch(DMLException e) {
retvalue.status='Failure';
retvalue.mydate=system.today();
retvalue.added='false';
retvalue.Message_Text=e.getMessage();
}catch (Exception e){
retvalue.mydate=system.today();
HttpRequest req=new HttpRequest();
Http http=new Http();
HttpResponse res = http.send(req);
System.debug('STATUS:'+res.getStatus());
System.debug('STATUS_CODE:'+res.getStatusCode());
retvalue.Status='Failure';
retvalue.Message_text=e.getMessage();
}
}else {
retvalue.status='Failure';
retvalue.mydate=system.today();
retvalue.added='false';
}
return retvalue;
}
}
- Reddy@SFDC
- October 31, 2011
- Like
- 0
- Continue reading or reply
send error messages
Hi all, please help me.....i want to throw http error messages in this code with the status code.....
global class InboundLinxUserRegistration {
global class dtRegistrationInput {
webservice ID UserId;
webservice String First_Name;
webservice String Last_Name;
webservice String Email_Address;
webservice String Status;
webservice ID Workplace_Id;
webservice String Workplace_Name;
webservice String Workplace_Province;
webservice String Workplace_City;
webservice String Workplace_Postal_Code;
webservice String Workplace_Address;
webservice String Speciality;
webservice String Record_Type;
}
global class dtRegistrationOutput {
webservice String status;
webservice String Message_Text;
}
public webservice static dtRegistrationOutput userregistration(dtRegistrationInput userregistration){
dtRegistrationOutput retvalue=new dtRegistrationOutput();
retvalue.status='Success';
Account account=new Account();
account.National_Code__c=userregistration.UserId;
account.FirstName=userregistration.First_Name;
account.LastName=userregistration.Last_Name;
account.PersonEmail=userregistration.Email_Address;
account.Account_Status_NES__c=userregistration.Status;
account.Primary_Parent_vod__c=userregistration.Workplace_Id;
account.Primary_Province_NES__c=userregistration.Workplace_Province;
account.Primary_City_NES__c=userregistration.Workplace_City;
account.Primary_Postal_Code_NES__c=userregistration.Workplace_Postal_Code;
account.Primary_Address_1_NES__c=userregistration.Workplace_Address;
account.Specialty_1_vod__c=userregistration.Speciality;
account.RecordTypeId=userregistration.Record_Type;
try{
insert account;
} catch (Exception e){
retvalue.Status='Failure';
retvalue.Message_text=e.getMessage();
}
return retvalue;
}
}
- Reddy@SFDC
- October 31, 2011
- Like
- 0
- Continue reading or reply
System.ListException: List index out of bounds: 0 error
Hi, my code as follows
global class InboundLinxUserRegistration {
global class dtRegistrationInput {
webservice ID UserId;
webservice String First_Name;
webservice String Last_Name;
webservice String Email_Address;
webservice String Status;
webservice ID Workplace_Id;
webservice String Workplace_Name;
webservice String Workplace_Province;
webservice String Workplace_City;
webservice String Workplace_Postal_Code;
webservice String Workplace_Address;
webservice String Speciality;
webservice String Record_Type;
}
global class dtRegistrationOutput {
webservice String status;
webservice String Message_Text;
}
public webservice static dtRegistrationOutput Registration(dtRegistrationInput Registration){
dtRegistrationOutput retvalue=new dtRegistrationOutput();
retvalue.status='Success';
List<Account> account=new List<Account>();
account[0].National_Code__c=Registration.UserId;
account[0].FirstName=Registration.First_Name;
account[0].LastName=Registration.Last_Name;
account[0].PersonEmail=Registration.Email_Address;
account[0].Account_Status_NES__c=Registration.Status;
account[0].Primary_Parent_vod__c=Registration.Workplace_Id;
account[0].Primary_Province_NES__c=Registration.Workplace_Province;
account[0].Primary_City_NES__c=Registration.Workplace_City;
account[0].Primary_Postal_Code_NES__c=Registration.Workplace_Postal_Code;
account[0].Primary_Address_1_NES__c=Registration.Workplace_Address;
account[0].Specialty_1_vod__c=Registration.Speciality;
account[0].RecordTypeId=Registration.Record_Type;
try{
insert account[0];
} catch (Exception e){
retvalue.Status='Failure';
retvalue.Message_Text= e.getMessage();
}
return retvalue;
}
}
when i am trying this code with xmlspy i am getting the error
<
faultcode>soapenv:Client</faultcode><faultstring>System.ListException: List index out of bounds: 0
Class.InboundLinxUserRegistration.Registration: line 28, column 30
External entry point
</faultstring>
- Reddy@SFDC
- October 31, 2011
- Like
- 0
- Continue reading or reply
Integer to Text In Apex code error
Hi All, please help with the following code
global class InboundLinxUserRegistration {
global class dtRegistrationInput {
webservice Integer UserId;
webservice String First_Name;
webservice String Last_Name;
webservice String Email_Address;
webservice String Status;
webservice String Workplace_Id;
webservice String Workplace_Name;
webservice String Workplace_Province;
webservice String Workplace_City;
webservice String Workplace_Postal_Code;
webservice String Workplace_Address;
webservice String Speciality;
webservice String Record_Type;
}
global class dtRegistrationOutput {
webservice String status;
webservice String Message_Text;
}
public webservice static dtRegistrationOutput Registration(dtRegistrationInput Registration){
dtRegistrationOutput retvalue=new dtRegistrationOutput();
retvalue.status='Success';
return retvalue;
List<Account> user=[select National_Code__c, FirstName,LastName,PersonEmail,Account_Status_NES__c,Primary_Parent_vod__c,Primary_Province_NES__c,Primary_City_NES__c,Primary_Postal_Code_NES__c,Primary_Address_1_NES__c,Specialty_1_vod__c, RecordtypeId from Account where National_Code__c=:Registration.UserId];
if(user.size()==0) {
retvalue.status='Failur';
retvalue.Message_Text='Record Not Found';
}else {
user[0].National_Code__c=String.valueOf(Registration.UserId); // HERE THE ERROR
user[0].FirstName=Registration.First_Name;
user[0].LastName=Registration.Last_Name;
user[0].PersonEmail=Registration.Email_Address;
user[0].Account_Status_NES__c=Registration.Status;
user[0].Primary_Parent_vod__c=Registration.Workplace_Id;
user[0].Primary_Province_NES__c=Registration.Workplace_Province;
user[0].Primary_City_NES__c=Registration.Workplace_City;
user[0].Primary_Postal_Code_NES__c=Registration.Workplace_Postal_Code;
user[0].Primary_Address_1_NES__c=Registration.Workplace_Address;
user[0].Specialty_1_vod__c=Registration.Speciality;
user[0].recordtypeId=Registration.Record_Type;
try{
insert user[0];
} catch (Exception e){
retValue.Status='Failure';
retValue.Message_Text= e.getMessage();
}
}
return retvalue;
}
}
a
nd the error is
Error: Compile Error: Invalid bind expression type of Integer for column of type String at line 27 column 296
- Reddy@SFDC
- October 25, 2011
- Like
- 0
- Continue reading or reply
Type casting in apex
Hi,
In apex class ,
webservice Integer UserId;
then i want to insert this value in to SFDC Account field which is text datatype, how can i do this
- Reddy@SFDC
- October 24, 2011
- Like
- 0
- Continue reading or reply