Item userItem = this.newItem("User","get"); userItem.setProperty("id",userId); userItem = userItem.apply();You can use (one line of code):
Item userItem = this.getInnovator().getItemById("User", userId);Instead creating if statement (5 lines of code), you can write something like (one line) :
updateIdnt.setProperty("name", userItem.getProperty("{prop1}", "") + ( (!string.IsNullOrEmpty(userItem.getProperty("{prop2}"))) ? " " + userItem.getProperty("{prop2}") + " " : "") + userItem.getProperty("{prop3}",""));If you prefer to keep the if statement, you need to update it as following:
if (string.IsNullOrEmpty(userItem.getProperty("{prop2}"))
Item userItem = this.newItem("User","get"); userItem.setProperty("id",userId); userItem = userItem.apply();You can use (one line of code):
Item userItem = this.getInnovator().getItemById("User", userId);Instead creating if statement (5 lines of code), you can write something like (one line) :
updateIdnt.setProperty("name", userItem.getProperty("{prop1}", "") + ( (!string.IsNullOrEmpty(userItem.getProperty("{prop2}"))) ? " " + userItem.getProperty("{prop2}") + " " : "") + userItem.getProperty("{prop3}",""));If you prefer to keep the if statement, you need to update it as following:
if (string.IsNullOrEmpty(userItem.getProperty("{prop2}"))