On update field of contact record I want to create a systemuser(user) in dynamics crm 365 online.but I’m getting error like "usersettings With Id = 5fe33120-607f-e811-a95c-000d3af29269 Does Not Exist"
This is the below code I'm trying to create a user
Entity getEntity = (Entity)context.InputParameters["Target"];
string str = getEntity.Attributes["new_isaeon"].ToString();
if (str != null && str == "True")
{
// http://localhost:51625/api/Users
Entity sysuser = new Entity("systemuser");
sysuser.Attributes["fullname"] = "hsk";
sysuser.Attributes["internalemailaddress"] = "projectservice_9@crmdemo.dynamics.com";
sysuser.Attributes["domainname"] = "projectservice_9@crmdemo.dynamics.com";
Guid getGuid = new Guid("700F2217-786A-E811-A95A-000D3AF2793E");
sysuser.Attributes["businessunitid"] = new EntityReference("businessunit", getGuid);
sysuser.FormattedValues["accessmode"] = "Read-Write";
Guid getuserid = service.Create(sysuser);
}
can anyone help me on this thanks.
Update: Recently we started importing users in CRM online directly using OOB CSV import (this is new for me too), it will succeed, and later on when license assigned for same user - this wont create another user record, instead it will map the Azure object GUID to the existing user record based on username/domain name/email. This is more useful when creating stub users without license or roles quickly.
In Dynamics 365 CRM online, system users record creation/enabling flow happens from O365 Admin portal end. Read more
Steps go like this:
We cannot create system user using SDK directly because of above manual steps outside CRM online. Can be created using PowerShell like answered in community.