Inserting data into a contact

It seems that you’re trying to add a contact person to a party (using a hard-coded party ID).

Please always use Insert > Insert Code to paste source code. Among other things, it preserves indentation, making code easier to read it. Isn’t this much better?

public static void main(Args _args)
{
	smmContactPersonV2Entity contact;

	contact.FirstName = 'hai';
	contact.MiddleName = 'gang';
	contact.LastName = 'wang';
	contact.LastNamePrefix = 'abc';
	contact.ContactsType = 0;
	contact.Name = 'hai gang wang';
	contact.Contactforparty = 68719509753;
	contact.AssociatedPartyNumber = '000002456';
	contact.Locator = '15649978872';

	if (contact.validateWrite())
	{
		contact.insert();
	}
}

Unfortunately you forgot to mention what kind of problem you have with your code. Could you add this information, please?

Also, what is smmContactPersonV2Entity? I don’t remember such a table in AX 2012.