November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
You can try this code snippet:
SecurityContext.Current.CheckPermissionForCurentUser(BafModuleConfig.GetDeletePermissionName(className), true);
int errorCount = 0;
try
{
Mediachase.BusinessFoundation.Data.Business.BusinessManager.Delete(className, key);
}
catch (Exception)
{
errorCount++;
}
className is the name of the class, key is the GUID of the EntityObject in question (e.g. CustomerContact)
Hi Richly,
I couldn't get your code above to work, I'm not sure whether I'm missing something in the config file or doing something in correctly. The error i'm getting is "default securityProvider not found"
var user = Membership.GetUser("admin");
var customerId = "BBB75882-45F3-48F2-ACE7-9F79F0FEA3D3";
SecurityContext.Current.CheckUserInGlobalRole(user, AppRoles.AdminRole);
var customerContact = CustomerContact.CreateInstance();
customerContact.PrimaryKeyId = (PrimaryKeyId?)customerId.ToGuid();
customerContact[App.Default.FieldContactId] = customerId;
Mediachase.BusinessFoundation.Data.Business.BusinessManager.Delete("CustomerContact", (PrimaryKeyId) customerContact.PrimaryKeyId);
Does anyone knows where in the api can we delete a CustomerContact?
I don't see anything in CustomerContext.Current, there's no delete function from the CustomerContact object. In the sdk documentation it's seems to only have examples to create or modify but never delete. There must be a way because we can do it from the commerce customer manager but I can't find it anywhere in the documentation.
If it's not in the api, do we have to do it on the SQL tables directly?