我正在尝试编写一个api将数据插入到查找关系对象中,并将所有子数据检索到该父ID的父对象中。 (假设我要为一个父对象插入3个子对象记录,它应该在父对象中显示所有3条记录) 我已经写了一个代码,但它只显示一个记录。
global static string lead(String firstName,String lastName, String
company, String status,String Projeted_project_status, String name)
{
Lead lead=new Lead();
RestContext.response.addHeader('Content-Type', 'application/json');
lead.FirstName=firstName;
lead.LastName=lastName;
lead.Company=company;
lead.Status=status;
lead.Projected_Project_Start__c=Projeted_project_status;
Insert lead;
Contact cont=new Contact();
cont.LastName=name;
cont.LeadRelated__c=lead.Id;
Insert cont;
Return Lead.Id;