Add or Update Single Member via API not populating fields.

  • 0
  • 1
  • Question
  • Updated 2 years ago
  • Answered
  • (Edited)
It is adding the member however it is populating only required fields not any other fields.

Did I miss anything / any thought?

Code snippet :-
 // POST /#account_id/members/add          
var result = emmasharp.AddOrUpdateSingleMember(new AddMember
                MemberEmail = "",
                Fields = new Dictionary
                    {"First_Name", "Yared7"},
                    {"Last_Name", "Dirar"},
                    {"Address", "511 Mcclan Dr"},
                    {"Address2", ""},
                    {"City", "Dallas"},
                    {"State", "TEXAS"},
                    {"Postal_code", "75032"},
                    {"Phone", "8179075555"},
                    {"Consultant", "9553838"},
                    {"Customeraccount", "" },
                    {"Consultant-level", "MC"}
                GroupIds = new List { 2388725 }

I also tried by setting the value FieldTriggers = true but didn't help.

Photo of Ambit Energy

Ambit Energy

  • 13 Posts
  • 3 Reply Likes

Posted 2 years ago

  • 0
  • 1
Photo of Kyle Gregory | Lipscomb University

Kyle Gregory | Lipscomb University, Champion

  • 95 Posts
  • 67 Reply Likes
Official Response
Hey @Ambit Energy,

Here's my code and it added the member successfully.
EmmaApi emma = new EmmaApi("123456", "123456789", "123");

var fields = new Dictionary();
fields.Add("name_first", "Yared7");
fields.Add("name_last", "Dirar");
fields.Add("Address", "511 Mcclan Dr");
fields.Add("Address2", "");
fields.Add("City", "Dallas");
fields.Add("State", "TEXAS");
fields.Add("Postal_code", "75032");
fields.Add("Phone", "8179075555");
fields.Add("Consultant", "9553838");
fields.Add("Customeraccount", "" );
fields.Add("Consultant-level", "MC");

var member = new AddMember();
member.MemberEmail = "";
member.Fields = fields;
member.GroupIds = new List { 2388725 }; 

var result = emma.AddOrUpdateSingleMember(member);
One thing is to make sure  you're using the short-code values for the Key and all your fields expect the Values you're passing. All those fields are not in my account, so it may be tripping up somewhere on those. For instance, most accounts expect 'name_first,' not 'First_Name' as you had in your code. Capitalization may matter, and EmmaSharp will just pass the dictionary straight, it won't change your Key or Value names to normalize against Emma's API.

Also since EmmaSharp is a community project and not supported by Emma, you might want to ask your question as an issue in the repo on Github.

Hope that helps,