function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Anjana Sharma 9Anjana Sharma 9 

I have a cusom object of name Error log and Field name of auto-number i.e (EL-{0000}-1) & Custom Fields: 1. Parent Record Id: Type: Text 2. Error Details: Type: Long Text 3. Parent Record Name: Type: Text and i have to apply database dml on it

I have a method with two arguments List<Account>, List<Contact>  with return type void and in the list<Account > i have to do that some records in this list will have Id field populated and some of the records will not have Id field populated .and then Update the records where Id is populated and insert the records where Id is not populated. (Use Database.upsert for this) .Check the Database.upsert result and if there is any error with any of the record then create a new record of Error Log(in my custom object) for each error.  Now how can i cause error in this and how i hold that error in database.saveresult .

And in second argument of contact i have to hold only the new Contact Records. and like i have 2 contact then these 2 contacts were add to each account details which give success not error
ShivankurShivankur (Salesforce Developers) 
Hi Anjana,

Please post the code snippet in the description and then elaborate the concern to make it more understandable, so that community could provide specific suggestion for the issue you are facing.

Thanks.
Anjana Sharma 9Anjana Sharma 9
Actuallly i am new to salesforce and i cant understand how i do this..i make a custom object of name error log and make 4 custom fields in that namly  1.Parent Record Id  and Parent Record Name of text type and  Error Details of  Type  Long Text Area and the last one is  Parent Record which is a  Formula Field: URL.. 
Now i have to pass two arguments in my method one is list<Account > and other is list<contact> ..now what i am doing in my account list i am populated some record but what i need that like i am populating 10 records then some them are populated with id but some of them not..so as we know that every record has id then how can i poluatated record without id .....then after poplating theste records i have to Update that records where Id is populated and insert the records where Id is not populated. (Use Database.upsert ) ... now at last i have to Check the Database.upsert result and if there is any error with any of the record then it create a new record of Error Log (custom object) for each error.
and in my list of contact i have to hold the new contact records and these contact i have to add to those account which are success...like i have 2 contact in my list<contact> then these 2 contact add to all account record like i have 4 succes account record after database.upsert the 2 contact add to each and at last they became 8....then how can i polate record and cause error by which i save these error to my custom object ..for every new error a new record is added ..
keo nha caikeo nha cai
keowin365 – kèo nhà cái (https://keowin365.com) trực tiếp, nhận định bóng đá hôm nay siêu chuẩn, trực tiếp bóng đá với tỷ lệ kèo nhà cái siêu hot.
alonhatro phong troalonhatro phong tro
Alo nhà trọ - Kênh đăng tin cho thuê nhà trọ, thuê phòng trọ, tìm người ở ghép, cho thuê căn hộ, cho thuê mặt bằng hiệu quả cao với hơn 20.000+ tin đăng và 1.000.000+ lượt truy cập mỗi tháng. Chúng tôi luôn tự hào là một trong những đơn vị cung cấp dịch vụ đăng ký cho thuê phòng, nhà trọ, cho thuê căn hộ, cho thuê mặt bằng, tìm người ở ghép với giá thành phải gắn, kèm theo kết quả nổi bật .
xem ngay https://alonhatro.com/