MSCRM: Setting Status / State on an Activity - Ernst Kuschke

   Ernst Kuschke

     Arbitrary thoughts and musings on life, the universe and everything else

Syndication

News

    ernst kuschke (v1.0)

    My Photos

    Microsoft Most Valuable Professional

    Member in good standing

    View Ernst Kuschke's profile on LinkedIn

    Add to Technorati Favorites

Blogs I read

Books I recommend

General Links

MSCRM: Setting Status / State on an Activity

In a recent (heavily customised) implementation of MSCRM for a call centre I have had the requirement to set the state of a Phonecall Activity to "Completed", depending certain actions by the user on the frontend.

MSCRM exposes itself via the "CrmWebservice"- and "MetadataService" web services. All the CRM entities, like Contact, Incident, etc. are extensions of the BusinessEntity base class, and so it is also for Activity, from which Phonecall derives.

Ussually when updating any BusinessEntity, I used the CrmService.Update(BusinessEntity) webmethod. This, however, does not work for updating the state (or status) on any type of activity - to do this you need to use the CrmService.Execute(CrmService.Request) webmethod, which returns a CrmService.Response.

This might seem unintuitive at first, though it is quite easy to use, as there are pre-defined classes deriving from Request and Response - one of these are SetStatePhoneCallRequest.

The state on a phonecall is updated as follows:

private void CloseCall(Guid callId)
{
    using (CrmService svc = ServiceFactory.GetWebService<CrmService>())
    {

        SetStatePhoneCallRequest request = new SetStatePhoneCallRequest();
        request.EntityId =
callId;
        request.PhoneCallState =
PhoneCallState.Completed;
        request.PhoneCallStatus = 2;
        svc.Execute(request);
    }
}

 

Examining the SetStatePhoneCallResponse being returned by Execute is not necessary, as it has no public fields. I am unsure why this specific property on a Phonecall can not be set using the Update webmethod (which works for all the other properties of a phonecall), however this is the correct way to do update status on *any* type of activity. (Note for example the SetStateQuoteRequest, SetStatePriceLevelRequest, etc. classes).

Published Tuesday, August 29, 2006 11:59 AM by Ernst Kuschke

Comments

# re: MSCRM: Setting Status / State on an Activity@ Wednesday, October 11, 2006 1:25 PM

Hey there - Was looking for some CRM info and stumbled across your link... How are things going

by Jonathan Mee (Liquid THought

# re: MSCRM: Setting Status / State on an Activity@ Tuesday, June 05, 2007 11:31 AM

Hello! My name is Ntsako Khoza and I’m 25 years old. I’m currently working for a company by the name of Fusion Integration which is in Johannesburg South Africa and it’s a Siebel implementation partner. We do all Siebel related jobs (configuration, maintenance & change management). I feel like its time to develop my skills and further get certification in Siebel, SAP and Microsoft CRM as i have previously worked on these systems and I have a good background in C# and ASP.NET. I’m willing to start from scratch and work my way up. Training programmes or learnerships can also be a good way to start as I do not have Siebel or SAP certification but the experience to do the job. Thank you and hope to hear from you soon.

Yours Faithfully

Khoza N.A. (Mr.)

by Ntsako Alan Khoza

Leave a Comment

(required) 
(required) 
(optional)
(required) 

Enter the numbers above: