Article ID: 932477
Article Last Modified on 8/21/2007
APPLIES TO
- Microsoft Dynamics CRM 3.0
- Microsoft CRM Software Development Kit, when used with:
- Microsoft Dynamics CRM 3.0
INTRODUCTION
This article describes how to use the Microsoft Dynamics CRM 3.0 Software Development Kit (SDK) to programmatically release a contract that was put on hold in Microsoft Dynamics CRM 3.0.
MORE INFORMATION
To programmatically release a contract that was put on hold in Microsoft Dynamics CRM 3.0, you must take advantage of the Microsoft Dynamics CRM Web service and its Execute message. Before you can release a contract that was put on hold, you must change the state of the contract. The Microsoft Dynamics CRM 3.0 SDK contains information about the SetStateContract message to help you change the state of a contract. You can specify the new state, and you can provide a status reason that accompanies this new state.
When you use the Microsoft Dynamics CRM 3.0 SDK to programmatically release a contract, you must set the state of the contract to Invoiced instead of Active. Microsoft Dynamics CRM disallows you to change a contract's state from OnHold to Active. If you try to change a contract's state from OnHold to Active, you receive the following error message if your code encounters a SOAPException exception:
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure. However, they will not modify these examples to provide extra functionality or construct procedures to meet your specific requirements.
The following code example illustrates how to programmatically release a contract that was put on hold in Microsoft Dynamics CRM 3.0.
try { CrmService service = new CrmService(); service.Credentials=System.Net.CredentialCache.DefaultCredentials; SetStateContractRequest change = new SetStateContractRequest(); change.ContractState = ContractState.Active; change.ContractStatus=-1; //Set EntityId to GUID of the contract being released. change.EntityId=new Guid("ED90535A-4FA6-DB11-B75B-000874DE7397"); SetStateContractResponse changed = (SetStateContractResponse)service.Execute(change); Console.WriteLine("Changed status successfully."); } catch (System.Web.Services.Protocols.SoapException err) { MessageBox.Show(err.Detail.OuterXml.ToString()); }
REFERENCES
For more information about the SetStateContract class, see the SetStateContract class topic in the Microsoft Dynamics CRM 3.0 SDK. To view the SetStateContract class topic, visit the following Microsoft Web site:
To download the Microsoft Dynamics CRM 3.0 SDK, visit the following Microsoft Web site:
Additional query words: crm3 crm30 crm3.0
Keywords: kbmbsmigrate kbhowto KB932477