PDA

View Full Version : New to programming need help with if statement



luchmine1
Dec 22nd, 2015, 01:10 PM
I am having difficulties with my approach. I have a work date field that I need to be populated by the system when the ticket is closed Only if it is currently blank.

What I started with:
Condition: current.state.changes() && (current.state == 3 || current.state ==4)

current.active = false;
current.work_end = nowDateTime();
current.business_duration = gs.calDateDiff(current.work_start.getDisplayValue(),current.work_end.getDisplayValue(),false);

What I tried to do to fix it:
Condition: current.state.changes() && (current.state == 3 || current.state ==4)

current.active = false;
if (current.work_end.length === 0) current.work_end = nowDateTime();
current.business_duration = gs.calDateDiff(current.work_start.getDisplayValue(),current.work_end.getDisplayValue(),false);

As I said I am just learning to code so I expect that I am just an idiot. Please help.

Dormilich
Dec 22nd, 2015, 04:20 PM
I have a work date field that I need to be populated by the system
what system is it? it doesn’t look like it’s from a browser.