gteachou - Thursday, November 7, 2013 5:10 PM:
I have some code from a method that is not working correctly (See code below) What is happening is after some text is entered into a data field and the item is saved the IF condition is false. But on the second save the IF condition becomes true. Which is the correct behavior I am looking for.
Code snippet:
string itemAction = this.getAction();
string itemVersion = this.getAttribute("version","");
if (itemAction != "version" && itemVersion != "0") {
So what I am trying to understand is what the variable "itemAction" is doing. If I remove the IF condition "itemAction != "version" " the code works correctly. I am fine with removing this condition but I am afraid I might be missing some other issue.
Any thoughts
Thanks
G.Teachout
Amit Nawale - Friday, November 22, 2013 4:02 AM:
Hi gteachou,
As per my knowledge, version is not attribute of Item and not a property by default.
Due to that this.getAttribute("version",""); always return blank which is not equal to 0;
use
string itemVersion = this.getProperty("generation","");
instead of string itemVersion = this.getAttribute("version","");.
Also you can create log file on server side method and check details is as:
CCO.Utilities.WriteDebug("versionLog","Item Version:"+itemVersion);
CCO.Utilities.WriteDebug("versionLog","Item Action"+itemAction );
write above line above if and Run your code check versionLog file inside innovator-->server-->temp directory.
You will check details.
Thanks,
Amit