You need to sign in to do that
Don't have an account?
sathya82
Custom weservice
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
Hi,
Can you please share your code snippet?
Insert an OpportunityContactRole record as well along with account,contact, opportunity insertion. Hope this would be helpful
SS
@digamberlucky
i am below code for account,contac,opportunity insertion
Account a = new Account();
a.Name = r.accName;
a.AccountNumber =String.valueOf(r.accNumber);
insert a;
Contact c = new Contact();
c.AccountId = a.Id;
c.FirstName = r.fName;
c.LastName = r.lName;
insert c;
Opportunity o = new Opportunity();
o.AccountId = a.Id;
// o.OpportunityContactRoles =c.Id;
o.Name = req.oName;
o.StageName =r.oStage;
insert o;
Hi,
Assuming, you have a contact lookup on Opportunity, you can use below code snippet to have contact-opportunity direct relationship. And you should be able to see desired related list.
Let me know if you have any question.
@digamberlucky
Hi,
As per code i think i can insert single contact at a time, if another system move multiple accounts to sfdc at that time i want to change any code. to insert multiple accounts
Hi,
I guess for that you will receive multiple information regarding account in request. Will you please share the structure for same.
@digamberlucky
HI,
May i know how can i modify my code if i get multiple accounts insertion
global class Integration
{
global class AllObjects
{
webservice string aName;
webservice string aNum;
webservice string cName
}
global class Return
{
webservice string raName;
}
webservice static Return Allobjectsmethod(AllObjects a1)
{
Account a = new Account();
a.Name = a1.aName;
a.Number = a1.aNum;
insert a;
Contact c = new Contact();
c.Name = a1.cName;
insert c;
Return r = new Return();
r.raName = a.Name;
return r;
}
Hi,
First of all AllObjects should return list of account related information. Could you please let me know how it will look like. After that I can suggest modification in your code.
@digamberlucky
My webservice is working for single account,contact insert i am testing by soapUI tool
but from third party system they push multiple accunts for that my webservice have to insert multiple accounts at a time rather than single account insertion based on that how can i modify my webservice.
i can't understand where i have to modify my code could you plz modify my code.and where i have to put list for account, contact, opportunity.
Hi,
Possible code snippet may look like below:-
Let me know if you have any specific question.
Happy to help you!
@digamberlucky
Suppose if i have 90 accounts which are pushing from thirdparty at that time
i hae to create a1,a2,a3......i think this is not a way can you one check it. any modifications ..in code.
That's why I said you earlier that requested will have all account related information in list.
@digamberlucky
May i know how can i modofied my code for different bulk insert of records.
Hi,
In that case your global class may look like something below:-
@digamberlucky
below is my code how can i modified that