We’ve developed some resources to help you work effectively from home during COVID-19 Click to learn more

Set Code (Number1) for companies created via ContactAgent?

Hi,

I'm creating companies using the ContactAgent's CreateDefaultContactEntity method, but I end up with empty values for Code/Number1.

Is there anything in the API I can use to get it to suggest a similar Code-value, or do I have to figure it out myself based on the name? What are the rules that SuperOffice uses to suggest the Code value?

Frode

RE: Set Code (Number1) for companies created via ContactAgent?

These are only generated when an entity has been saved.

Von: Tony Yates 21. Jan 2020

RE: Set Code (Number1) for companies created via ContactAgent?

Hi Tony, the following script with end up with a blank Code field. Do you mean it should have been generated automatically here?

#setLanguageLevel 3;

NSContactAgent contactAgent;
NSContactEntity contact = contactAgent.CreateDefaultContactEntity();

contact.SetName("My example company");

contact = contactAgent.SaveContactEntity(contact);

Von: Frode Lillerud 21. Jan 2020