This topic is locked
[SOLVED]

 ASPRunner Email Variables in Edit event

4/13/2017 3:11:53 PM
ASPRunner.NET General questions
S
swiersman author

All,
I have 2 questions probably the same solution.
In my EDIT PAGE/BEFORE RECORD UPDATED event I am trying to embed a value (txtProjectName) into the Subject line with text:
//** Send email with new data ****
string email = "scott.wiersman@ropesgray.com";

string from = "release.management@ropesgray.com";

StringBuilder msg = new StringBuilder("");

string subject = "A SUBMITTER UPDATE Was Applied to the" .value ["txtProjectName"] "Deployment Plan";
foreach(var field in values.GetEnumerator())

{

if(!CommonFunctions.IsBinaryType(pageObject.pSet.getFieldType(field.Key)))

{

msg.Append(field.Key.ToString() + " : " + field.Value.ToString() + "\r\n");

}

}
XVar ret = MVCFunctions.runner_mail(new XVar("to", email, "subject", subject, "body", msg.ToString(), "from", from));

if(!ret["mailed"])

{

MVCFunctions.EchoToOutput(ret["message"]);

}
I can not get the project to compile. What am I missing?
Thanks,
Scott

admin 4/14/2017
S
swiersman author 4/18/2017



You need to concatenate your strings properly:

https://msdn.microsoft.com/en-us/library/ms228504.aspx?f=255&MSPPError=-2147217396


I concatenated as the article defined:
string subject = "A SUBMITTER UPDATE Was Applied to the " + txtProjectName + " Deployment Plan";
Now when I try to build it fails and sys "txtProjectName does not exist. That is the name of the database field I would like to insert.
When looking at the web site source code for this project I see an object called "value_txtProjectName_1". I tried this and it failed saying it did not exist either.
Any ideas what I am doing wrong?

admin 4/19/2017

You cannot just use txtProjectName in your code. If you check BeforeEdit event documentation in the manual you can see that you can access the value of any field as values["FieldName"]
So most likely you need to use the following:

string subject = "A SUBMITTER UPDATE Was Applied to the " + values["txtProjectName"].ToString() + " Deployment Plan";


More info:

https://xlinesoft.com/asprunnernet/docs/before_record_updated.htm