Passing parameters on different forms
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2012 11:56 AM
I want to pass a parameter on different forms, is it possible? i.e.
I have the form A where is located the field "user name", what I'm looking for is to extract that parameter and assign it to other field on the form B, which is inherent from A form.
Any idea or suggestion?, thanks in advance for your responses.
Regards.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2012 07:02 AM
That scenario needs to be handled a bit differently because you're initiating the action from the 'New' UI action that is used for all related lists. Because of that, there's not as much control over the behavior. There are a couple of different ways you could approach this, but the simplest is probably to use a single client script on the Project Task table. The client script will need to be able to pull the value from the 'Parent' field (which you'll need to add to the form even if you choose to hide it with a client script). If it determines that the parent is a project then it will attempt to query for that record and pull back the project manager and populate it in the assignment group field. Here's the script you can use. It should work fine as long as you've got the 'Parent' field on the project task form.
function onLoad() {
//Only run for new project tasks
if(g_form.isNewRecord()){
//Populate assigned_to and assignment_group based on parent
var par = g_form.getReference('parent', popAssignment);
}
//Nested 'getReference' callback function for variable access
function popAssignment(par){
//If the parent is a project
if(par.sys_class_name == 'pm_project'){
//Get the actual project record so we can pull project_manager
var prj = new GlideRecord('pm_project');
prj.get(par.sys_id);
//Populate assigned_to
g_form.setValue('assigned_to', prj.project_manager);
}
else{
//Just populate the 'assigned_to' from the previous task
g_form.setValue('assigned_to', par.assigned_to);
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2014 08:42 AM