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

Capture.PNG


On second thought, you want the assignment group and priority to always be the problem's assignment group and priority?   Or just on create of a new record?


randrews
Tera Guru

I am a little confused on why we are taking the approach of using a BR to correct a ticket which was created incorrectly...



i am assuming a UI action was used to create the problem tasks.. why not correct that ui action to update the fields on the task when it is created instead of building a new br?



if you do want to use a br... like a previous poster mentioned you need to make sure it is ONLY on insert.. or each time the record is saved it will over write the current fields with the ones from the problem.


Well, if you use the New button in the related list, you don't have the choice to update the fields.   I would set it as before insert, set the fields and then allow them to be changed manually by the user.


i will buy that answer.. although personally we disable the add new button on the list view to prevent exactly that.. the only way you should be creating a problem task is from the UI/script/workflow