Modify in Visual Studio values of SPFieldChoice depending the state in State Machine Workflow RRS feed

  • Question

  • Hello,

    I'm a beginner with Sharepoint and I'm trying to change the values of SPFieldChoice field (Issue Status) in my List depending the state of the item List. For example when new item is created his state is "OpenState", and the values of the SPFieldChoice field will be only "Open". When this item will be modify by the responsible, the values of the SPFieldChoice should be change to ("Solved" and "Closed") I programmed this in Visual Studio with C#. This is the code added in Code activity in the workflow:

    SPFieldChoice fieldIssueStatus = (SPFieldChoice)workflowProperties.Item.Fields["Issue Status"];

    fieldIssueStatus.EditFormat = SPChoiceFormatType.Dropdown;


    It work fine in the item modified but if this item is waiting an action to change the state and another user will create a new item, the SPFieldChoice values contains "Solved" and "Closed" and should appear only "Open" value because it's new item and his state is "OpenState"
    Can anyone give me a solution to my problem?

    Thanks in advance.

    Wednesday, March 21, 2012 9:47 AM