Copy fields from "Problem Ticket" to "Problem Task Ticket"

kam_steven_
Kilo Contributor

I have created a client script to copy fields from "Problem Ticket" to "Problem Task Ticket", it didn't work. Can someone guide me through?

Table=Problem

Type=onLoad

function onLoad() {
    //Type appropriate comment here, and begin script below
if(g_form.isNewRecord() && g_form.getValue('parent') != ''){

var prb = g_form.getReference('parent', setFields);

}

function setFields(prb){

g_form.setValue('assignment_group',prb.assignment_group);
g_form.setValue('priority',prb.priority);

}  
}

Thanks.

Steven

1 ACCEPTED SOLUTION

And then do javascript:parent.priority for an override on the priority.


View solution in original post

29 REPLIES 29

interesting do you have it setting the values via script or from the action fields?


From the BR Action tab....


I would do a display BR with a condition that says assignment_group is empty and priority is empty, then actions that say assignment_group is same as problem.assignment_group and priority is same as problem.priority.



That will keep it from overwriting existing values.


try using the script from above instead of the action items...


current.assignment_group = current.parent.assignment_group;


current.priority = current.parent.assignment_group;



if this is an after business rule you will need to add



current.update();



see if that fixes it...



Mike Allen in answer to why not just create a br to update those fields you can do that... but it has to process the br every time a record is displayed.. by creating an on insert br it is ONY processed on an insert action.


But, no matter how you create that BR, it is not going to populate the fields until after the form is submitted.   He wants to populate the fields when the form is loaded.   So, the only way to do that is a display BR or an onLoad Client Script, both of which will get run every time the form is loaded.   I am always a fan of putting the load on the server as opposed to the client, so I suggested the BR.