none
Add workflow on List by code (Arabic Portal) RRS feed

  • Question

  • Hello,

         I have an Arabic portal.

         I write the following code to add workflow "Publishing approval" on list by code .

         After code run . I open the list and check the work flow . it is not added properly. kindly check the attached file.

         if I run the same code on English portal , working fine

       private static void AddWorkFlowToList(SPSite site, SPWeb web)
            {
                SPWorkflowTemplate approvalWorkflowTemplate = null;
                Guid approvalWorkflowTemplateID = new Guid("e43856d2-1bb4-40ef-b08b-016d89a00409");

                foreach (SPWorkflowTemplate template in web.WorkflowTemplates)
                {
                    if (template.Id.Equals(approvalWorkflowTemplateID))
                    {
                        approvalWorkflowTemplate = template;
                    }
                }

                SPList workFlowTasks = web.Lists[web.Language == 1033 ? "Workflow Tasks" : "مهام سير العمل"];
                SPList historyList = web.Lists["Workflow History"];

                SPWorkflowAssociation wflAss = SPWorkflowAssociation.CreateListAssociation(approvalWorkflowTemplate, "Submit for approval", workFlowTasks, historyList);
                wflAss.AssociationData = GetApprovalWorkFlowData();

                SPList list = web.Lists["CloudTagsList"];

                web.AllowUnsafeUpdates = true;
                list.WorkflowAssociations.Add(wflAss);
                list.Update();
                web.AllowUnsafeUpdates = false;
            }

      

    as u see the work flow not selected . 


    ASk

    Thursday, May 29, 2014 7:06 PM

Answers

  • Hi,

    Please check whether the list name is valid?

    Also, it is recommended to debug your code to watch the variables in use, it will help us to collect more information about this issue.

    If all the steps executed as expected, I suggest you create a new list and do the test again.

    Feel free to reply with the test result.

    Best regards

    Patrick Liang
    TechNet Community Support

    Friday, May 30, 2014 8:41 AM
    Moderator