0 votes

Hi everyone.

Im working on a method with the C# proxy for add 377 projects with the same Name (Reporting)

and link it to a company with the efficyKey.

here is my code : 

            List<Company> Companies = GetAllCompanies();
            Companies = Companies.Where(a => a.TypeRelation == CompRelationType.Participee || Convert.ToInt32(a.TypeRelation) == 9).Select(a => a).ToList();

            TContextHandle EditContext;

            foreach (var Iterator in Companies)
                EditContext = Proxy.OpenEditContext("PROJ", 0);

                Hashtable Fields = new Hashtable();
                Fields.Add("NAME", "Reporting");

                Proxy.UpdateFields(EditContext, Fields);

                TContextHandle EditDocuProd = Proxy.OpenEditContextRelation("PROJ", EditContext.Key, "COMP", Iterator.EfficyKey, -1);
         catch(Exception E)
            Helper.LogHelper.LogMessage(Helper.LogHelper.MessageType.Error, "Error EfficyDataLayer.AddDossierForSoc()");

I got an error after the CloseContext because the project is not link to any company.

Do u have the right method to do that ?


Vessiere Thomas.

asked in SOAP by (105 points)

1 Answer

0 votes
Best answer

You have to use the insertDetail2 method, just like it's done in serverscripts and in the user interface.

Please learn first the difference between openeditcontextrelation, addlink and insertdetail before starting your developments. If you don't understand when to use what method, you will likely end up with a badly written integrations. Badly that it can be slow and you might risk not having a main detail.

answered by (6.8k points)
selected by
Thanks for the answer.

It's working well.
1,168 questions
1,426 answers
325 users