As we know there are many steps need top be followed to setup the K2.Net 2003. Each step it has its own importance.If we miss any step in configuration we get a specific error for that. Recently we have tried to move the SharePoint List to a new site collection and updated this URL in string table and submit the workflow. So while creating a new list item the workflow got into error state and the error reads like below (below image). We have given Full Permissions on the site and the list, but none of these things worked. Finally after doing this and that I have found that the service account is not listed under site collection administrators. So I have added the account there and tried to repair and it worked so fine. Thought this will help others. So shared here!
So just you know, the steps required for adding the permissions under site collection:
1. Go to Site Actions
2. Select Modify Site Settings
3. Go to site collection Administration
4. Select Top level Settings (if you see this link under that)
5. Next page, under Users and Permissions section click Site collection administrator
6. The next page will show you the Editor showing people picker (check names image and browse)
7. Add the service account into that.
Hope it helps!!!
I have an error in K2.net 2003 i.e. "Object Reference not set to an instance of an object". What could be the possible reasons fo r this,.
ReplyDeleteBelow is the code:
public void Main(ClientEventContext K2)
{
string strXmlFieldValue = K2.ProcessInstance.XmlFields["EDRequest"].Value;
string strPM = SourceCode.K2Utilities.XMLFieldMod.GetXMLValue(strXmlFieldValue,"//Request/CFUpdate/PMNetID").ToString().ToUpper();
string strEngineers = SourceCode.K2Utilities.XMLFieldMod.GetXMLValue(strXmlFieldValue,"//Request/CFUpdate/EngineersId").ToString().ToUpper();
string strCFMs = K2.ProcessInstance.DataFields["AllCFMs"].Value.ToString().ToUpper();
string strCurDes = K2.ActivityInstanceDestination.User.Name.ToString().ToUpper();
thirdVariable = K2.ProcessInstance.DataFields["PRJMGRACTSTAT"].Value;
secondVariable = "STOP";
try
{
if(strCurDes == strPM || (strCFMs.IndexOf(strCurDes) >= 0 )|| (strEngineers.IndexOf(strCurDes) >= 0))
{
if(thirdVariable.ToString().ToUpper() != secondVariable.ToString().ToUpper())
{
SMTPFunction(K2, thirdVariable.ToString());
}
}
}
catch (System.Exception ex)
{
throw new System.Exception(ex.InnerException.ToString());
}
try
{
HTTPFunction(K2);
}
catch (System.Exception ex)
{
throw new System.Exception(ex.InnerException.ToString());
}
}
public void SMTPFunction(ClientEventContext K2, string strAction)
{
System.Web.Mail.MailMessage objMsg = new System.Web.Mail.MailMessage();
System.Web.Mail.MailAttachment objAttachment;
object strFrom = "";
object strEmail = "";
object strSubject = "";
object strBody = "";
object strMailServer = "";
strMailServer = K2.StringTable["EmailServer"];
System.Web.Mail.SmtpMail.SmtpServer = strMailServer.ToString();
strFrom = K2.StringTable["Admin"];
SourceCode.KO.User oUser;
oUser = K2.ActivityInstanceDestination.User;
strEmail = oUser.Email;
if((strEmail==null)||(strEmail.ToString().Trim().Length == 0))
{
throw new System.Exception("No Email Address was supplied, please rectify and try again.");
}
strSubject = "RFA Updated by Customer Focus Manager.";
strBody += "Please click the below link to only View the document.";
strBody += System.Environment.NewLine + "" + System.Environment.NewLine;
strBody += K2.StringTable["ViewRequestURL"] + "?ProcId=" + K2.ProcessInstance.ID;
strBody += System.Environment.NewLine + "" + System.Environment.NewLine;
strBody += "If you want to edit the document click the below link.";
strBody += System.Environment.NewLine;
if(strAction == "ENGGCHANGED")
{
strSubject = "Engineers assigned to the project. Sales Order: " + SourceCode.K2Utilities.XMLFieldMod.GetXMLValue(
K2.ProcessInstance.XmlFields["EDRequest"].Value, "//Request/CFUpdate/SalesOrder");;
}
object strURL = "";
strURL = K2.StringTable["WebServer"] + "/ProjMgrAndEngineerUpdateForm.aspx?sn={SERIALNO}";
strURL = strURL.ToString().Replace("{SERIALNO}",K2.SerialNumber);
if(strBody.ToString().IndexOf("[Web Page URL]")>0)
{
strBody = strBody.ToString().Replace("[Web Page URL]", System.Web.HttpUtility.UrlPathEncode(strURL.ToString()));
}
else
{
strBody += System.Environment.NewLine + System.Environment.NewLine + "HTTP URL: " + System.Web.HttpUtility.UrlPathEncode(strURL.ToString());
}
Hi Mehra, aplogies for the late reply, if you have still not yet figured out the issue here. Below are the possible reasons I can think of for this error:
ReplyDelete1. Make sure the data fields that are used in this event code has values and especially the ones which has .ToString conversion.
You can verify the datafields values in workspace
2. Check this line
oUser = K2.ActivityInstanceDestination.User;
strEmail = oUser.Email;
Make sure that the instance destination user has the valid FQN (or username) listed here.
Focus on .ToString() used varibles mostly, I think that helps.