I am running this code as a script task in a business process.
string POid = Get<string>("PurchaseOrderID");
var arParts = POid.Split('_');
int i = Convert.ToInt32(arParts[1]);
int newid = i + 1;
string prefix = string.Empty;
if(newid<10){
prefix="00000";
}
else if (newid<100)
{ prefix="0000";
}
else if (newid<1000)
{
prefix="000";
}
else if (newid<10000)
{
prefix="00";
}
else if (newid<100000)
{
prefix="0";
}
string intstringid = newid.ToString();
string name = prefix + intstringid;
string newPOid = "PO_" + name;
Set("NewPurchaseOrderID", newPOid);
return true;
I have "PurchaseOrderID" and "NewPurchaseOrderID" as the parameters that I've defined for this business process. They are spelled as in the code, I've checked that.
When I try to run this process, I get the error: Object reference not set to an instance of an object.
Can't seem to find which object I have not initiated.
Any help would be appreciated.
Thanks.
-AK