Dynamic workflow, set assigned id based on drop down list

Hi,

I am new with C#

I am trying to read an ECO form drop down list value (manufsites) and then based on that add corresponding identity as assigned.

I can without the IF statement set the identities as assigned,
but when try to read my drop down list value it does not work,

any ideas, please help

my code:

// Called OnActivate from activities in the Simple Change workflow. Adds assignments to
// the activity based on the Owner or Manager of affected items

Innovator inn = this.getInnovator();
string actId = this.getID();


// Retrieve the workflow item
Item wflItem = this.newItem("Workflow","get");
wflItem.setAttribute("select","source_id,source_type");

Item wflProc = wflItem.createRelatedItem("Workflow Process","get");
wflProc.setAttribute("select","name");


Item wflProcAct = wflProc.createRelationship("Workflow Process Activity","get");
wflProcAct.setAttribute("select","related_id");
wflProcAct.setProperty("related_id",this.getID());
wflItem = wflItem.apply();
if (wflItem.getItemCount() != 1 ||
wflItem.getProperty("source_id","").Length != 32 ||
wflItem.getPropertyAttribute("source_type","keyed_name","").Length < 1)
{
return inn.newError("Error retrieving workflow: "+wflItem.getErrorDetail());
}

Item q = this.newItem();
q.loadAML("<Item type='Activity Assignment' action='get' select='id'><source_id>"+this.getAttribute("id")+"</source_id></Item>");
q = q.apply();
if (q.getItemCount()>0) return this;//The activity is reactivated.

bool permissionWasSet = false;
Aras.Server.Security.Identity transIdentity = Aras.Server.Security.Identity.GetByName("Aras PLM");
try
{
permissionWasSet = Aras.Server.Security.Permissions.GrantIdentity(transIdentity);

//GET the manufsite from the manufs drop down list ------------

string ManufSit = wflItem.getProperty("manufsites");


if (ManufSit== "aaaa")

//IF I remove the IF row above, then below Identity is set correctly (note fictive values in this example)

{
string identId = "xxxxxxxxxxxx";
Item assignment = this.newItem("Activity Assignment", "");
assignment.setAction("add");
assignment.setProperty("source_id", actId);
assignment.setPropertyAttribute("locked_by_id","is_null","1");
assignment.setProperty("related_id",identId);
assignment.setProperty("voting_weight", "50");
assignment.setProperty("is_required", "1");
assignment = assignment.apply();
if (assignment.getItemCount() != 1) return inn.newError("Error creating assignment: "+assignment.getErrorDetail());

}



if (ManufSit== "bbbb")
{
string identId = "yyyyyyyyyyy";
Item assignment = this.newItem("Activity Assignment", "");
assignment.setAction("add");
assignment.setProperty("source_id", actId);
assignment.setPropertyAttribute("locked_by_id","is_null","1");
assignment.setProperty("related_id",identId);
assignment.setProperty("voting_weight", "50");
assignment.setProperty("is_required", "1");
assignment = assignment.apply();
if (assignment.getItemCount() != 1) return inn.newError("Error creating assignment: "+assignment.getErrorDetail());

}



}

finally
{
if (permissionWasSet)
{
Aras.Server.Security.Permissions.RevokeIdentity(transIdentity);
}
}
return this;

Parents Reply Children