Setting default value from parent

scwillson
Mega Guru

I am attempting to do what I initally thought would be simple, but I just can't get it working.

I am trying to set the default value of a date field on the change_task form to match that of a date field on the parent change specified in the 'change_request' field.

first I tried javascript: current.expected_start = current.change_request.start_date;

Even after multiple attempts at slightly modifying the code to approach it differently, still nothing would populate. So I decided to go the route of script include.

Even then, it still wouldn't pull the value of the date field.

Is the script in the default value definition run on the Client or Server?

1 ACCEPTED SOLUTION

scwillson
Mega Guru

I just pit the bullet and put in script in 2 different areas (I was hoping for a single solution).



I added script in the task generation Workflow action to populate the dates from the parent Change into the Change Task.


I also implemented an onLoad client script that populates the same date fields from the parent if the date field is empty.


View solution in original post

8 REPLIES 8

Uncle Rob
Kilo Patron

Simon,



With default values I think the "current.<target_field> =" is implied.


Try...


javascript:current.change_request.start_date


This is one of the first ones I tried, but unfortunately it doesn't work.



I'm wondering if it is a problem with the timing. Perhaps when it runs, the change_request field isn't yet populated.


Anurag Tripathi
Mega Patron
Mega Patron

Hi Simon,



you need to write this in a before insert business rule on change task



current.expected_start = current.change_request.start_date;



PS: make sure that the field names are correct(custom fields start with u_)


-Anurag

Is there any reason why the dictionary entry can't just dot walk up and grab its parent's start_date value?