I am having a SharePoint custom list which is having a designer workflow and event receiver attached to it.
In the event receiver on ItemUpdating event I am having the below code to check if a particular column value is changed or not.
if(properties.ListItem["ColumnName"] != properties.AfterProperties["ColumnName"]))
It gives proper result if item is updated manually, but when the workflow updates any item
properties.AfterProperties["ColumnName"] gives always
null value. So the if condition always gives result as
Moreover I call a method to update a SQL table when the above condition gets satisfied. But when the code tries to open the SQLConnection it gives an exception like:
"Cannot open database "DBName" requested by the login. The login failed. Login failed for user 'NT AUTHORITY\NETWORK SERVICE'."
Again, the same works when item is updated manually.
Any help how to handle this situation.