Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

PhoneCall Activity C#

$
0
0

I guess this question has been asked before, however, I am a programming beginner and started with the part of the code that I will show you later, I appreciate your patience.

I have managed to create a Telephone Activity with the following characteristics: Subject, Description, Address, From, etc ... However, I have not been able to associate the "To" with the logged in user, could you see what I have done and tell me what I am doing wrong , please.


var nombreVariable = (from q in crmContext.ContactSet where q.MobilePhone == "xxxxxxx" select q).FirstOrDefault();
var Usuario = (from q in crmContext.SystemUserSet where q.PersonalEMailAddress == "xxxxxx" select q).FirstOrDefault();

IEnumerable<ActivityParty> party = new[] { new ActivityParty { LogicalName = ActivityParty.EntityLogicalName, PartyId = new EntityReference("contact", nombreVariable.Id), } };

IEnumerable<ActivityParty> party2 = new[] { new ActivityParty { LogicalName = ActivityParty.EntityLogicalName, PartyId = new EntityReference("SystemUserId", Usuario.Id), } };

PhoneCall crearphonecall = new PhoneCall
{
Subject = "Test Phocall # 5", 
Description = "Test PhoeCall",
DirectionCode = false, 
ActualDurationMinutes = xx, 
PhoneNumber = "xxxxxx",
StateCode = PhoneCallState.Open, //Open, Completed, Canceled
//RegardingObjectId = new EntityReference("contact", nombreVariable.Id),
From = party,
To= party2

};
_orgService.Create(crearphonecall);

I appreciate all the help you can give me.


Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>