You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I am trying to add customer using your wrapper, but I don't seem to be able to find a way to either create dynamically a new Tag / Group or to retreive existing Tag / Group.
Any help would be really appreciated !
Have a good one !
Sebastien
The text was updated successfully, but these errors were encountered:
Hi @lemieuxs,
I am new to this, but I had a similar need... Not fully tested yet, but I do have this code:
public IEnumerable<ContactGroup> GetAllTags()
{
var tags = _connectionClient.DataService.Query<ContactGroup>();
return tags;
}
public int GetTagId(string TagName, bool CreateIfNoMatch = false)
{
var tagId = 0;
var allIsTags = this.GetAllTags();
var matchingTags = allIsTags.Where(n => n.GroupName == TagName).ToList();
if (matchingTags.Any())
{
//Assume first tag if more than one
tagId = Int32.Parse(matchingTags.First().Id);
}
else
{
if (CreateIfNoMatch)
{
//Create new tag and return Id
var description = string.Format("Auto-created by Website InfusionsoftService code [{0}].", DateTime.Now.ToLongTimeString());
tagId = _connectionClient.DataService.Add<ContactGroup>(setter =>
{
setter.Set(t => t.GroupName, TagName);
setter.Set(t => t.GroupDescription, description);
});
}
}
return tagId;
}
Hi, I am trying to add customer using your wrapper, but I don't seem to be able to find a way to either create dynamically a new Tag / Group or to retreive existing Tag / Group.
Any help would be really appreciated !
Have a good one !
Sebastien
The text was updated successfully, but these errors were encountered: