• sathya82
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 19
    Questions
  • 33
    Replies

HI,

 

       I am developing a custom webservice in that from third party application i am getting the different inputs they are

 

  product1--> comments on products--> quantity--> proposel price

 

                                                                    >> quantity--> proposel price

 

     that means i am getting different quantities and different proposel prices for same product1  how can i map that different

quanties and different proposel prices in my webservice can any one give me some sample code for that,

while insert the opportunity it throws an error requried field is missing[Name,StageName] but i asign the requried fields are Name,StageName the field my code is

global class OppWr {
    webservice String oName;
    webservice String ocDate;
    webservice String oStage;
}

// some other code which consit of account,contact insert code

List<Opportunity> lstopp = new List<Opportunity>();

{
    OppWr o1 = new OppWr(); 
    Opportunity o = new Opportunity();
    o.Name = o1.oName;
    o.CloseDate = system.today();
    o.StageName = o1.oStage;
    lstopp.add(o);
}
insert lstopp;

HI,

 

         I am working with custom webserice i need to prevent duplicates accounts in my custom webservice may i know how can it is possible can anyone provide some sample code for that.

global class Integration {

 global class AllObjects {

     webservice string aName;
     webservice string aNum;

     webservice string cName
 }

 global class Return {
     webservice string raName;
 }


webservice static List<Return> Allobjectsmethod(List<AllObjects> a1List) {

 List<Account> accounts = new List<Account>();
 List<Contact> contacts = new List<Contact>();
 List<Return> returns = new List<Return);
 for(AllObjects a1 : a1List)
 {
     Account a = new Account();
     a.Name = a1.aName;
     a.Number = a1.aNum;
     accounts.add(a);
     Contact c = new Contact();
     c.Name = a1.cName;
     contacts.add(c);
     Return r = new Return();
     r.raName = a.Name;
     results.add(r);
 }

 // Bulk insert accounts
 insert accounts;

 // Assign contacts to accounts
 **for(Integer rowIdx = 0; rowIdx < accounts.size(); rowIdx++)** // error occur point
     contacts[rowIdx].AccountId = accounts[rowIdx].Id;      

 // Bulk insert contacts
 insert contacts;

 return returns;
}

global class MainClass
{
global class RequestClass
{
webservice String errorMessage;

//Account Releated Fields

global Class AccountWrapper // Line9
{
webservice String accName;
webservice Integer accNumber;
webservice Id AccountId;
webservice List<AccountWrapper> accounts;
webservice List<ContactWrapper>;
webservice List<OpportunityWrapper>;
}

//Contact Releated Fields
//webservice String contactName;
global class ContactWrapper
{
webservice String clName;
webservice String cfName;

}

// Opportunity Releated Fields
global class OpportunityWrapper
{
webservice String oName;
webservice String ocDate;
webservice String oStage;
webservice List<ProductWrapper>;
}
// Quote Realeted Fields
webservice String qName;




// Product fields
global class ProductWrapper
{
webservice String productcode;
webservice String productName;
// boolean active;
webservice Integer quantity;
webservice Integer unitprice;
}
// QuoteItem Fields

webservice String qitemName;


}

webservice static ResponseClass behaviourOfWebService(RequestClass req)
{

List<Account> accountList = new List<Account>();
Account a;
for(AccountWrapper wrapper: req.accounts){
a = new Account();
a.Name = wrapper.accName;
a.AccountNumber =String.valueOf(wrapper.accNumber);
accountList.add(a);
}
insert AccountList;

ResponseClass res = new ResponseClass();
res.resId = a.Id;
res.resName = a.Name;
res.cresName = c.FirstName;
// res.respId = p.Id;
return res;
return res;

}

Hi,

 

       I am developing a webservice program, how can i prevent the duplicates

 

  ex: suppose in sfdc i have Acc1 again same account that is Acc1 is coming from third party system at that time how can i check Acc1 is exist or not if exist means under that Acc1 i have to insert Cont2 how can i achieve this..??

HI,

 

 

      I am working with webservice when i perform delete operation on contact at that time only contact is deleted the opportunity which belongs particular contact is not deleted may i know what i have to do.

 

my code is may i know where i have to do modifications

 

 webservice static DelClass Method2(String cfName, String clName)
 {
     DelClass res2 = new DelClass();
     res2.errorMessage = 'fnamelame  not exist!';
       List<Contact> lstContact = [Select Id,FirstName,LastName from Contact where FirstName =:cfName and LastName =:clName];
       if(lstContact.isEmpty()) return res2;
       delete lstContact;
       return null;
 
 }

HI,

 

       I am working with custom soap webservice, from third party system i am getting date format is Nov 12,2013 how can i insert this date into salesforce.

 

 

My Webservice Code how can i modify my code.

 

webservice static ResponseClass Method2(String accName)
{

ResponseClass res1 = new ResponseClass();
List<Account> del = [ Select ID, Name from Account where Name = :accName];
if(del.size() > 0)
{
res1.errorMessage = 'Account not  exists!';
return res1;
}

delete del;

}

HI,

 

          I develop a custom soap webservice, i am using soapui tool for testing, when i use this means at that time

 only single record is inserting, may i know how can i test my program for bulk data.

HI,

 

        I develop a webservice i am getting the date 12/9/2013 format while i am inserting this date in oppoertunity object but the date which comes from thirdparty system is not inserting exactly.

 

  my code is for date insert.

 

  Opportunity o = new Opportunity()

  o.Name = rName// rName Which Coming from Third Party system

  o.CloseDate =  ocDate; // when i map like this means it not taking may i know i want to da any modifications

   the date which was given by third party system that data must be insert in sfdc

 

      insert 0;

 

 

HI,

 

  I created a customwebservice for account,contac,opportunity insertion
all are inserting good, but here is one problem

when i click on account tab at that time contact,opportunity belongs to that account showing.

 

when i click on contact tab at that time opportunity is not showing in releated list block.

 

but that contact have opportunity may i know what i have to do. i have to do any modifications in my code

trigger insertMember2 on Account (after insert) {
 Set<Id> Ids= new Set<Id>();
    for (Account member : Trigger.new)
    {
        Ids.add(member.Id);        
    }
 List<Account> memberList = new List<Account>([Select Id,BillingStreet,BillingCity,BillingState,BillingPostalCode,BillingCountry From Account e where Id in :Ids]);

    for(Account temp : memberList )
    {
        Quote member2 = new Quote();
        member2.ShippingStreet = temp.BillingStreet;
        member2.ShippingCity = temp.BillingCity;
        member2.ShippingState = temp.BillingState;
        member2.ShippingPostalCode = temp.BillingPostalCode;
        member2.ShippingCountry = temp.BillingCountry;
        insert member2;

    }


 }

 How can i solve this error..??

HI,

 

         I am working with a custom webservice here i want to insert multiple accounts at a time how can i develop a webservice can anyone provide sample code.

HI,

 

          I am working with custom webservice in soap, when i comparing the fields in opportinity, i get strucked

 May i know how can i insert Closedate, value by using webservice program.

 

 

HI,

          

 

    for me i have 4 different objects.i want to reterview the records at a time, from different objects how can reterview the records and display them in visualforce page how it can be possible.

MY Vf Page

 

    <apex:page controller="SubmitCaseController">

    <h1>Submit New Case</h1>
    
    <apex:form >
        <apex:pageMessages />
        <table>
            <tr>
                <th>Your Name:</th>
                <td><apex:inputText value="{!c.SuppliedName}"/></td>
            </tr>
            <tr>
                <th>Your Email:</th>
                <td><apex:inputText value="{!c.SuppliedEmail}"/></td>
            </tr>
            <tr>
                <th>Your Account Number:</th>
                <td><apex:inputText required="true" value="{!acctNum}"/></td>
            </tr>
            <tr>
                <th>Title:</th>
                <td><apex:inputText required="true" value="{!c.Subject}"/></td>
            </tr>
            <tr>
                <th>Your Problem:</th>
                <td><apex:inputTextArea required="true" rows="5" value="{!c.Description}"/></td>
            </tr>
            <tr>
                <td><apex:commandButton value="Submit Case" action="{!submitCase}"/></td>
            </tr>
        </table>
    </apex:form>

</apex:page>


Apex Class---->>

 

 public class SubmitCaseController {
    
    public Case c { get; set; }
    
    public String acctNum { get; set; }
    
    public SubmitCaseController() {
        c = new Case();
    }
    
    public PageReference submitCase() {
        List<Account> accts = [SELECT Id FROM Account WHERE AccountNumber = :acctNum]; //error occuring point
        if (accts.size() != 1) {
            ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.FATAL, 'Invalid account number');
            ApexPages.addMessage(msg);
            return null;
        } else {
            try {
                c.AccountId = accts.get(0).Id;
                
                // now look for an associated contact with the same email
                Contact cnt = [SELECT Id FROM Contact WHERE AccountId = :c.AccountId AND Email = :c.SuppliedEmail LIMIT 1];
                if (cnt != null)
                    c.ContactId = cnt.Id;
                    
                // Specify DML options to ensure the assignment rules are executed
                Database.DMLOptions dmlOpts = new Database.DMLOptions();
                dmlOpts.assignmentRuleHeader.useDefaultRule = true;
                c.setOptions(dmlOpts);

                // Insert the case
                INSERT c;
                return new PageReference('/thanks');
            } catch (Exception e) {
                ApexPages.addMessages(e);
                return null;
            }
        }
    }
}


 

How can i slove this...??

HI,

 

            I am working with web-to-case.

 

            i created a web-to-case form from admin account when i enter all details in that form and click submit that case details are showing in the  admin account only. But the case details are not showing in the user account

 

          Can any one explain me what can i do for user account to show this case details.

Hi,

 

           Can any one explain difference between Desk.com and Email to case in salesforce.

 

        May i know in which situation we use the desk.com and which situation we use email to case.

 

       for desk.com i have to purchased a licence version,for email to case i have to purchased any licence or it's free of cost.

while insert the opportunity it throws an error requried field is missing[Name,StageName] but i asign the requried fields are Name,StageName the field my code is

global class OppWr {
    webservice String oName;
    webservice String ocDate;
    webservice String oStage;
}

// some other code which consit of account,contact insert code

List<Opportunity> lstopp = new List<Opportunity>();

{
    OppWr o1 = new OppWr(); 
    Opportunity o = new Opportunity();
    o.Name = o1.oName;
    o.CloseDate = system.today();
    o.StageName = o1.oStage;
    lstopp.add(o);
}
insert lstopp;

HI,

 

         I am working with custom webserice i need to prevent duplicates accounts in my custom webservice may i know how can it is possible can anyone provide some sample code for that.

global class Integration {

 global class AllObjects {

     webservice string aName;
     webservice string aNum;

     webservice string cName
 }

 global class Return {
     webservice string raName;
 }


webservice static List<Return> Allobjectsmethod(List<AllObjects> a1List) {

 List<Account> accounts = new List<Account>();
 List<Contact> contacts = new List<Contact>();
 List<Return> returns = new List<Return);
 for(AllObjects a1 : a1List)
 {
     Account a = new Account();
     a.Name = a1.aName;
     a.Number = a1.aNum;
     accounts.add(a);
     Contact c = new Contact();
     c.Name = a1.cName;
     contacts.add(c);
     Return r = new Return();
     r.raName = a.Name;
     results.add(r);
 }

 // Bulk insert accounts
 insert accounts;

 // Assign contacts to accounts
 **for(Integer rowIdx = 0; rowIdx < accounts.size(); rowIdx++)** // error occur point
     contacts[rowIdx].AccountId = accounts[rowIdx].Id;      

 // Bulk insert contacts
 insert contacts;

 return returns;
}

global class MainClass
{
global class RequestClass
{
webservice String errorMessage;

//Account Releated Fields

global Class AccountWrapper // Line9
{
webservice String accName;
webservice Integer accNumber;
webservice Id AccountId;
webservice List<AccountWrapper> accounts;
webservice List<ContactWrapper>;
webservice List<OpportunityWrapper>;
}

//Contact Releated Fields
//webservice String contactName;
global class ContactWrapper
{
webservice String clName;
webservice String cfName;

}

// Opportunity Releated Fields
global class OpportunityWrapper
{
webservice String oName;
webservice String ocDate;
webservice String oStage;
webservice List<ProductWrapper>;
}
// Quote Realeted Fields
webservice String qName;




// Product fields
global class ProductWrapper
{
webservice String productcode;
webservice String productName;
// boolean active;
webservice Integer quantity;
webservice Integer unitprice;
}
// QuoteItem Fields

webservice String qitemName;


}

webservice static ResponseClass behaviourOfWebService(RequestClass req)
{

List<Account> accountList = new List<Account>();
Account a;
for(AccountWrapper wrapper: req.accounts){
a = new Account();
a.Name = wrapper.accName;
a.AccountNumber =String.valueOf(wrapper.accNumber);
accountList.add(a);
}
insert AccountList;

ResponseClass res = new ResponseClass();
res.resId = a.Id;
res.resName = a.Name;
res.cresName = c.FirstName;
// res.respId = p.Id;
return res;
return res;

}

Hi,

 

       I am developing a webservice program, how can i prevent the duplicates

 

  ex: suppose in sfdc i have Acc1 again same account that is Acc1 is coming from third party system at that time how can i check Acc1 is exist or not if exist means under that Acc1 i have to insert Cont2 how can i achieve this..??

HI,

 

          I develop a custom soap webservice, i am using soapui tool for testing, when i use this means at that time

 only single record is inserting, may i know how can i test my program for bulk data.

HI,

 

        I develop a webservice i am getting the date 12/9/2013 format while i am inserting this date in oppoertunity object but the date which comes from thirdparty system is not inserting exactly.

 

  my code is for date insert.

 

  Opportunity o = new Opportunity()

  o.Name = rName// rName Which Coming from Third Party system

  o.CloseDate =  ocDate; // when i map like this means it not taking may i know i want to da any modifications

   the date which was given by third party system that data must be insert in sfdc

 

      insert 0;

 

 

HI,

 

  I created a customwebservice for account,contac,opportunity insertion
all are inserting good, but here is one problem

when i click on account tab at that time contact,opportunity belongs to that account showing.

 

when i click on contact tab at that time opportunity is not showing in releated list block.

 

but that contact have opportunity may i know what i have to do. i have to do any modifications in my code