- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2024 04:28 AM
Hey guys!
I have a catalog item, the following one with field called "u_assignment_group". You can see my cat item here below in the screenshot:
I want to populate the corresponding field called "assignment_group" in the sc_req_item
So if i in the cat item form choose select box option 'minor_update_doc_plan' it should populate the sc_req_item with assignment group 82f2d480b5185210068bdbe3807c4f29. There is this workflow in the catalog item, with this script (this is a cutout), which is not working:
current.opened_by = current.variables.opened_by;
current.u_telefonnummer = current.variables.telefonnummer;
current.assignment_group = current.cat_item.u_assignment_group;
current.u_personnummer = current.variables.social_security_number;
current.business_service = current.cat_item.u_service_offering;
// Cat item "a306fda71ba3d4106de6f7c4464bcb09". Map case_type to assignment group
if (current.cat_item == 'a306fda71ba3d4106de6f7c4464bcb09') {
// Kontrollera värdet av case_type och sätt assignment_group därefter
switch (current.variables.case_type) {
case 'minor_update_doc_plan':
current.assignment_group = '82f2d480b5185210068bdbe3807c4f29';
break;
case 'update_site_templ_definition':
case 'configure_new_site_template_definition':
current.assignment_group = 'a6721440b5185210068bdbe3807c4fc0';
break;
case 'annual_update_doc_mgmnt_plan':
current.assignment_group = '82f2d480b5185210068bdbe3807c4f29';
break;
default:
// Hantera eventuella andra fall eller lämna tomt
break;
}
Thanks in advance!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2024 04:54 AM
Hi,
Your script seems to be correct. Try commenting the first two lines of this script or put logs in the script to check if the line 3 is being executed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2024 04:54 AM
Hi,
Your script seems to be correct. Try commenting the first two lines of this script or put logs in the script to check if the line 3 is being executed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-20-2024 02:05 AM
You were right about it being correct.
I had to use toString() function.
switch (current.variables.case_type.toString()) {