Record producer not adding look up field variable to the produced record

Justin Dirks1
Tera Expert

Hello! 

 

I am having issues with a variable I created on a record producer for the "Standard Change Template Proposal"  What I am trying to do is have that field simply populate the Assignment group based on that field in the record producer (which is a look up field on the sys_user_group field) 

here is my script that I have written on the script field on teh record producer. 

producer.redirect = current.getLink(true);
gs.addInfoMessage(gs.getMessage('A Standard Change Proposal was created successfully. You can review this proposal later via Change > Standard Change > My Proposals'));

if (producer.template_approval_manager_assignment_group != '') {
	current.assignment_group = producer.template_approval_manager_assignment_group;
}

 Any help will be awesome! Thank you

7 REPLIES 7

Maddysunil
Kilo Sage

@Justin Dirks1 

 

producer.redirect = current.getLink(true);
gs.addInfoMessage(gs.getMessage('A Standard Change Proposal was created successfully. You can review this proposal later via Change > Standard Change > My Proposals'));

if (producer.template_approval_manager_assignment_group && producer.template_approval_manager_assignment_group.sys_id) {
    current.assignment_group = producer.template_approval_manager_assignment_group.sys_id;
} else {
    gs.addErrorMessage('Assignment group is not specified.');
}

 

Please Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks

Thank you for the help.  but it is giving me the error that you set up.  Do you have an suggestions?

@Justin Dirks1 

If you're receiving the "Assignment group is not specified" error message, it suggests that the condition producer.template_approval_manager_assignment_group && producer.template_approval_manager_assignment_group.sys_id is evaluating to false, indicating that either producer.template_approval_manager_assignment_group is not defined or it doesn't have a sys_id.

  1. Check Field Configuration: Verify that template_approval_manager_assignment_group is correctly configured on your record producer. Ensure that it is a reference field to the sys_user_group table and that it allows the selection of a valid assignment group.

  2. Check Field Value: Before the if condition, add a gs.info statement to print out the value of producer.template_approval_manager_assignment_group and producer.template_approval_manager_assignment_group.sys_id. This will help you debug and see what values are being passed.

Adding few more logs to debug:

 

producer.redirect = current.getLink(true);
gs.addInfoMessage(gs.getMessage('A Standard Change Proposal was created successfully. You can review this proposal later via Change > Standard Change > My Proposals'));

gs.info('template_approval_manager_assignment_group: ' + producer.template_approval_manager_assignment_group);
gs.info('template_approval_manager_assignment_group.sys_id: ' + producer.template_approval_manager_assignment_group.sys_id);

if (producer.template_approval_manager_assignment_group && producer.template_approval_manager_assignment_group.sys_id) {
    current.assignment_group = producer.template_approval_manager_assignment_group.sys_id;
} else {
    gs.addErrorMessage('Assignment group is not specified.');
}

 

Please Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks

still getting the same issue.  Any ideas?

JustinDirks1_0-1711553815559.png

JustinDirks1_1-1711553975583.png