You need to sign in to do that
Don't have an account?
sathya82
Opportunity insertion Problem in soap
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;
@sathya82,
I think the problem is that you are initializing the Name and StageName fields from the oName and oStage fields of a new OppWr instance. You don't show the constructor for the OppWr class, so I will assume it doesn't have one. That means that the oName and oStage fields are both null when you copy them into the Opportunity. So, you are not actually setting those fields - it just looks like you are.
I don't know what you intend to be doing, so I can't offer a fix; but I hope this points you in the right direction so you can come up with a solution of your own.
If this helps, please mark it as a solution, and give kudos (click on the star) if you think I deserve them. Thanks!
-Glyn Anderson
Certified Salesforce Developer | Certified Salesforce Administrator
@GlynA
Thanq for giving reply i do some modifications in my program it's working properly. here one trouble how can i map my
opportunity to account. my code is
upsert AccountList; by uisng this statement i am upserting my all account fields.
insert lstopp; by using this statement i am inserting opportunity fields how can i map ..??
I'm not sure whether you want to map from Opportunity IDs to Account records, or from Account IDs to lists of Opportunities, so here is code for both:
I hope this helps. In the meantime, since my previous post provided the solution to you problem, could you please mark it as the solution. Thanks!
-Glyn